aboutsummaryrefslogtreecommitdiff
path: root/.themes/classic/source
diff options
context:
space:
mode:
authorPhilip Hofstetter <phofstetter@sensational.ch>2011-08-04 10:17:09 +0200
committerPhilip Hofstetter <phofstetter@sensational.ch>2011-08-04 10:17:09 +0200
commit81dcb0301be3529264411783ccd893ec0e20a178 (patch)
tree5e84ef8e12e36d2d65dacd0ed61a0f336f36ecca /.themes/classic/source
parent140198b87a4c92cc4c86cd3e2380d9c6364c9d63 (diff)
downloadmy_new_personal_website-81dcb0301be3529264411783ccd893ec0e20a178.tar.xz
my_new_personal_website-81dcb0301be3529264411783ccd893ec0e20a178.zip
correctly scope locals
having such generic variables as feed and i global is a recipe for trouble waiting to happen. These variables aren't used outside of the twitter plugin, so we can easily make them local to getTwitterFeed
Diffstat (limited to '.themes/classic/source')
-rw-r--r--.themes/classic/source/javascripts/twitter.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/.themes/classic/source/javascripts/twitter.js b/.themes/classic/source/javascripts/twitter.js
index 676619e1..1f1b2f91 100644
--- a/.themes/classic/source/javascripts/twitter.js
+++ b/.themes/classic/source/javascripts/twitter.js
@@ -1,13 +1,15 @@
// JSON-P Twitter fetcher for Octopress
// (c) Brandon Mathis // MIT Lisence
function getTwitterFeed(user, count, replies) {
- feed = new jXHR();
+ var feed = new jXHR();
+
feed.onerror = function (msg,url) {
$('#tweets li.loading').addClass('error').text("Twitter's busted");
}
feed.onreadystatechange = function(data){
if (feed.readyState === 4) {
var tweets = new Array();
+ var i = 0;
for (i in data){
if(tweets.length < count){
if(replies || data[i].in_reply_to_user_id == null){