From 9da93ab50dd6a959069cc95f398d687e3aa31d50 Mon Sep 17 00:00:00 2001 From: Peter Binkley Date: Fri, 7 Sep 2012 12:31:52 -0600 Subject: [PATCH 1/2] fixed oldest-first option --- js/script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/script.js b/js/script.js index b1b7486..d8c8ccb 100755 --- a/js/script.js +++ b/js/script.js @@ -9,6 +9,15 @@ $(function() { var direction = 'newest'; + /** + * default active sort button is "newest" + * if this timeline uses direction='oldest', change active button + */ + if (direction != 'newest') { + $('#sort-buttons a').removeClass('active'); + $('#sort-buttons a.sort-oldest').addClass('active'); + } + /** * get data via Tabletop */ @@ -84,7 +93,7 @@ $(function() { } }, sortBy: 'timestamp', - sortAscending: false, + sortAscending: (direction != 'newest'), itemPositionDataEnabled: true }); }); From 76eb93c11692341ac017560002a10688feb9d8af Mon Sep 17 00:00:00 2001 From: Peter Binkley Date: Fri, 7 Sep 2012 12:31:52 -0600 Subject: [PATCH 2/2] fixed bug that prevented initial oldest-first from formatting properly --- js/script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/script.js b/js/script.js index b1b7486..f294ccf 100755 --- a/js/script.js +++ b/js/script.js @@ -9,6 +9,15 @@ $(function() { var direction = 'newest'; + /** + * default active sort button is "newest" + * if this timeline uses direction='oldest', change active button + */ + if (direction != 'newest') { + $('#sort-buttons a').removeClass('active'); + $('#sort-buttons a.sort-oldest').addClass('active'); + } + /** * get data via Tabletop */ @@ -84,7 +93,7 @@ $(function() { } }, sortBy: 'timestamp', - sortAscending: false, + sortAscending: (direction != 'newest'), itemPositionDataEnabled: true }); });