diff options
author | Daan Debie <debie.daan@gmail.com> | 2013-12-27 22:58:14 +0100 |
---|---|---|
committer | Daan Debie <debie.daan@gmail.com> | 2013-12-27 22:58:14 +0100 |
commit | f02333f6e1ad4da0a36d880037168e3eb0621c84 (patch) | |
tree | 87abcf89230988110cf9ddf5f49538107d0e9c4e /pelican-bootstrap3/static/js/github.js | |
parent | 23701c6d825833372bff819bedfd9773dcc02160 (diff) | |
download | pelican-themes-f02333f6e1ad4da0a36d880037168e3eb0621c84.tar.gz |
Updated pelican-bootstrap3 to v1.1
Diffstat (limited to 'pelican-bootstrap3/static/js/github.js')
-rw-r--r-- | pelican-bootstrap3/static/js/github.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pelican-bootstrap3/static/js/github.js b/pelican-bootstrap3/static/js/github.js index 0ac60ef..7bdb6a4 100644 --- a/pelican-bootstrap3/static/js/github.js +++ b/pelican-bootstrap3/static/js/github.js @@ -24,11 +24,13 @@ var github = (function(){ repos.push(data.data[i]); } repos.sort(function(a, b) { - if (a[options.sort_attribute] > b[options.sort_attribute]) { return 1; } - if (a[options.sort_attribute] < b[options.sort_attribute]) { return -1; } - return 0; + 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.sort_descending) { repos.reverse(); } + if (options.count) { repos.splice(options.count); } render(options.target, repos); } |