mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
00db47b19e
commit
cfd001702f
1 changed files with 24 additions and 10 deletions
|
@ -134,12 +134,19 @@ function view_pagging(start, end)
|
||||||
*/
|
*/
|
||||||
function expandAll()
|
function expandAll()
|
||||||
{
|
{
|
||||||
|
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++) {
|
for (var i = start; i < start + sizeofpage; i++) {
|
||||||
if (i >= itemsToShow.length)
|
if (i >= itemsToShow.length)
|
||||||
break;
|
break;
|
||||||
unexpand(document.getElementById(itemsToShow[i]));
|
unexpand(document.getElementById(itemsToShow[i]));
|
||||||
items[itemsToShow[i]].expanded = false;
|
items[itemsToShow[i]].expanded = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,12 +154,19 @@ function expandAll()
|
||||||
*/
|
*/
|
||||||
function collapseAll()
|
function collapseAll()
|
||||||
{
|
{
|
||||||
|
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++) {
|
for (var i = start; i < start + sizeofpage; i++) {
|
||||||
if (i >= itemsToShow.length)
|
if (i >= itemsToShow.length)
|
||||||
break;
|
break;
|
||||||
expand(document.getElementById(itemsToShow[i]));
|
expand(document.getElementById(itemsToShow[i]));
|
||||||
items[itemsToShow[i]].expanded = true;
|
items[itemsToShow[i]].expanded = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNumberOfDives(e)
|
function setNumberOfDives(e)
|
||||||
|
|
Loading…
Reference in a new issue