summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-06-17 21:46:38 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-17 16:38:03 -0700
commitcfd001702ff8b76b54f468ff3cce92abbb105f15 (patch)
tree357af54a797ab0ef4b0a7fd3f01f593c4a18f209
parent00db47b19e1621455978775b2ea148b0c120b229 (diff)
downloadsubsurface-cfd001702ff8b76b54f468ff3cce92abbb105f15.tar.gz
Make the expand/collapse buttons usefull on trips
There where some issues with trying to access non-existing dom elements when clicking them when showing trips. Instead of fixing that issue, this actually makes them do something useful, expanding and collapsing the trips. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--theme/list_lib.js34
1 files changed, 24 insertions, 10 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 17f52061d..0459aad81 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -134,11 +134,18 @@ function view_pagging(start, end)
*/
function expandAll()
{
- for (var i = start; i < start + sizeofpage; i++) {
- if (i >= itemsToShow.length)
- break;
- unexpand(document.getElementById(itemsToShow[i]));
- items[itemsToShow[i]].expanded = false;
+ if (tripsShown) {
+ for (var i = 0 ; i < trips.length ; i++) {
+ if (trips[i].expanded === false)
+ expand_trip(i);
+ }
+ } else {
+ for (var i = start; i < start + sizeofpage; i++) {
+ if (i >= itemsToShow.length)
+ break;
+ unexpand(document.getElementById(itemsToShow[i]));
+ items[itemsToShow[i]].expanded = false;
+ }
}
}
@@ -147,11 +154,18 @@ function expandAll()
*/
function collapseAll()
{
- for (var i = start; i < start + sizeofpage; i++) {
- if (i >= itemsToShow.length)
- break;
- expand(document.getElementById(itemsToShow[i]));
- items[itemsToShow[i]].expanded = true;
+ if (tripsShown) {
+ for (var i = 0 ; i < trips.length ; i++) {
+ if (trips[i].expanded === true)
+ unexpand_trip(i);
+ }
+ } else {
+ for (var i = start; i < start + sizeofpage; i++) {
+ if (i >= itemsToShow.length)
+ break;
+ expand(document.getElementById(itemsToShow[i]));
+ items[itemsToShow[i]].expanded = true;
+ }
}
}