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
This commit is contained in:
parent
140198b87a
commit
81dcb0301b
@ -1,13 +1,15 @@
|
|||||||
// JSON-P Twitter fetcher for Octopress
|
// JSON-P Twitter fetcher for Octopress
|
||||||
// (c) Brandon Mathis // MIT Lisence
|
// (c) Brandon Mathis // MIT Lisence
|
||||||
function getTwitterFeed(user, count, replies) {
|
function getTwitterFeed(user, count, replies) {
|
||||||
feed = new jXHR();
|
var feed = new jXHR();
|
||||||
|
|
||||||
feed.onerror = function (msg,url) {
|
feed.onerror = function (msg,url) {
|
||||||
$('#tweets li.loading').addClass('error').text("Twitter's busted");
|
$('#tweets li.loading').addClass('error').text("Twitter's busted");
|
||||||
}
|
}
|
||||||
feed.onreadystatechange = function(data){
|
feed.onreadystatechange = function(data){
|
||||||
if (feed.readyState === 4) {
|
if (feed.readyState === 4) {
|
||||||
var tweets = new Array();
|
var tweets = new Array();
|
||||||
|
var i = 0;
|
||||||
for (i in data){
|
for (i in data){
|
||||||
if(tweets.length < count){
|
if(tweets.length < count){
|
||||||
if(replies || data[i].in_reply_to_user_id == null){
|
if(replies || data[i].in_reply_to_user_id == null){
|
||||||
|
Loading…
Reference in New Issue
Block a user