diff options
Diffstat (limited to 'pelican-bootstrap3/static/js/github.js')
-rw-r--r-- | pelican-bootstrap3/static/js/github.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pelican-bootstrap3/static/js/github.js b/pelican-bootstrap3/static/js/github.js index 7bdb6a4..0ac60ef 100644 --- a/pelican-bootstrap3/static/js/github.js +++ b/pelican-bootstrap3/static/js/github.js @@ -24,13 +24,11 @@ var github = (function(){ 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 (a[options.sort_attribute] > b[options.sort_attribute]) { return 1; } + if (a[options.sort_attribute] < b[options.sort_attribute]) { return -1; } + return 0; }); - + if (options.sort_descending) { repos.reverse(); } if (options.count) { repos.splice(options.count); } render(options.target, repos); } |