|
@ -13,7 +13,7 @@ var github = (function(){ |
|
|
return { |
|
|
return { |
|
|
showRepos: function(options){ |
|
|
showRepos: function(options){ |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: "https://api.github.com/users/"+options.user+"/repos?callback=?" |
|
|
url: "https://api.github.com/users/"+options.user+"/repos?sort=pushed;callback=?" |
|
|
, type: 'jsonp' |
|
|
, type: 'jsonp' |
|
|
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } |
|
|
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); } |
|
|
, success: function(data) { |
|
|
, success: function(data) { |
|
@ -23,14 +23,6 @@ var github = (function(){ |
|
|
if (options.skip_forks && data.data[i].fork) { continue; } |
|
|
if (options.skip_forks && data.data[i].fork) { continue; } |
|
|
repos.push(data.data[i]); |
|
|
repos.push(data.data[i]); |
|
|
} |
|
|
} |
|
|
repos.sort(function(a, b) { |
|
|
|
|
|
var aDate = new Date(a.pushed_at).valueOf(), |
|
|
|
|
|
bDate = new Date(b.pushed_at).valueOf(); |
|
|
|
|
|
|
|
|
|
|
|
if (aDate === bDate) { return 0; } |
|
|
|
|
|
return aDate > bDate ? -1 : 1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (options.count) { repos.splice(options.count); } |
|
|
if (options.count) { repos.splice(options.count); } |
|
|
render(options.target, repos); |
|
|
render(options.target, repos); |
|
|
} |
|
|
} |
|
|