Created
August 15, 2010 14:39
-
-
Save JeffreyWay/525558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before | |
<script type="text/javascript"> | |
function recent_tweets(data) { | |
for (i=0; i<data.length; i++) { | |
document.getElementById("tweets").innerHTML = | |
document.getElementById("tweets").innerHTML + | |
'<a href="http://twitter.com/{TwitterUsername}/status/' + | |
data[i].id + '"><div class="content">' + data[i].text + | |
'</div></a>'; | |
} | |
document.getElementById("twitter").style.display = 'block'; | |
} | |
</script> | |
// After | |
<script> | |
function recent_tweets(data) { | |
var frag = document.createDocumentFragment(), | |
len = data.length, | |
i, li, a; | |
for (i = 0; i < len; i++ ) { | |
li = document.createElement('li'); | |
a = document.createElement('a'); | |
a.href = 'http://twitter.com/{TwitterUsername}/status/' + data[i].id; | |
a.appendChild(document.createTextNode(data[i].text)); | |
li.appendChild(a); | |
frag.appendChild(li); | |
} | |
document.getElementById("tweets").appendChild(frag); | |
document.getElementById("twitter").style.display = 'block'; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment