From 81dcb0301be3529264411783ccd893ec0e20a178 Mon Sep 17 00:00:00 2001 From: Philip Hofstetter Date: Thu, 4 Aug 2011 10:17:09 +0200 Subject: 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 --- .themes/classic/source/javascripts/twitter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.themes/classic') 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){ -- cgit v1.2.1