From 6823f07f3a8c28515f41293cbabaf185fd2a9e64 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Thu, 29 Sep 2011 16:05:58 -0500 Subject: [PATCH] updated github.js --- source/javascripts/github.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/source/javascripts/github.js b/source/javascripts/github.js index 0187743..82e1160 100644 --- a/source/javascripts/github.js +++ b/source/javascripts/github.js @@ -9,12 +9,11 @@ var github = (function(){ } return { showRepos: function(options){ - var feed = new jXHR(); - feed.onerror = function (msg,url) { - $(options.target + ' li.loading').addClass('error').text("Error loading feed"); - }; - feed.onreadystatechange = function(data) { - if (feed.readyState === 4) { + $.ajax({ + url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?" + , type: 'jsonp' + , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } + , success: function(data) { var repos = []; for (var i = 0; i < data.repositories.length; i++){ if (options.skip_forks && data.repositories[i].fork) { continue; } @@ -31,9 +30,7 @@ var github = (function(){ if (options.count) { repos.splice(options.count); } render(options.target, repos); } - }; - feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?"); - feed.send(); + }) } }; -})(); \ No newline at end of file +})();