Browse code

Updated Github API to V3.

Github API V2 has been removed. The response data format also changed.

Zhao Lü authored on 20/07/2012 at 05:09:48
Showing 1 changed files
... ...
@@ -10,15 +10,15 @@ var github = (function(){
10 10
   return {
11 11
     showRepos: function(options){
12 12
       $.ajax({
13
-          url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?"
13
+          url: "https://api.github.com/users/"+options.user+"/repos?callback=?"
14 14
         , type: 'jsonp'
15 15
         , error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
16 16
         , success: function(data) {
17 17
           var repos = [];
18
-          if (!data || !data.repositories) { return; }
19
-          for (var i = 0; i < data.repositories.length; i++) {
20
-            if (options.skip_forks && data.repositories[i].fork) { continue; }
21
-            repos.push(data.repositories[i]);
18
+          if (!data || !data.data) { return; }
19
+          for (var i = 0; i < data.data.length; i++) {
20
+            if (options.skip_forks && data.data[i].fork) { continue; }
21
+            repos.push(data.data[i]);
22 22
           }
23 23
           repos.sort(function(a, b) {
24 24
             var aDate = new Date(a.pushed_at).valueOf(),