diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-03-25 01:23:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-25 02:34:29 -0700 |
commit | 3ff73d0a6621b118b43358f420723eb7e50a9807 (patch) | |
tree | 127b14c32be3057dce04e69bb029d624bda4256a /theme/list_lib.js | |
parent | 605d2f7386e253030e7c37eda1a7c45108b773ce (diff) | |
download | subsurface-3ff73d0a6621b118b43358f420723eb7e50a9807.tar.gz |
HTML: don't collapse the dive if hyperlink is clicked
fixes the wrong behaviour as dive details must not be closed when
hyperlinks are clicking, So check for Hyperlinks before toggling the
dive.
Fixes #713
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme/list_lib.js')
-rw-r--r-- | theme/list_lib.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js index 2d5b62632..6ca82ea51 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -47,7 +47,7 @@ function updateView(start, end) var divelist = document.getElementById('diveslist'); divelist.innerHTML = ""; for (var i = start; i <= end; i++) { - divelist.innerHTML += '<ul id="' + itemsToShow[i] + '" onclick="toggleExpantion(this)"</ul>'; + divelist.innerHTML += '<ul id="' + itemsToShow[i] + '" onclick="toggleExpantion(event, this)"</ul>'; expand(document.getElementById(itemsToShow[i])); items[itemsToShow[i]].expanded = true; }; @@ -63,7 +63,7 @@ function addHTML(indexes) var divelist = document.getElementById('diveslist'); divelist.innerHTML = ""; for (var i = 0; i < indexes.length; i++) { - divelist.innerHTML += '<ul id="' + indexes[i] + '" onclick="toggleExpantion(this)"</ul>'; + divelist.innerHTML += '<ul id="' + indexes[i] + '" onclick="toggleExpantion(event, this)"</ul>'; expand(document.getElementById(indexes[i])); itemsToShow[indexes[i]].expanded = true; }; @@ -165,8 +165,11 @@ function setNumberOfDives(e) viewInPage(); } -function toggleExpantion(ul) +function toggleExpantion(e, ul) { + if (e.toElement.localName === "a" ) { + return; + } if (!items[ul.id].expanded) { expand(ul); items[ul.id].expanded = true; @@ -773,7 +776,7 @@ function expand_trip(trip) trips[trip].expanded = true; var d = document.getElementById("trip_dive_list_" + trip); for (var j in trips[trip].dives) { - d.innerHTML += '<ul id="' + trips[trip].dives[j].number + '" onclick="toggleExpantion(this)" onmouseover="highlight(this)"' + + d.innerHTML += '<ul id="' + trips[trip].dives[j].number + '" onclick="toggleExpantion(event, this)" onmouseover="highlight(this)"' + ' onmouseout="unhighlight(this)">' + getlimited(trips[trip].dives[j]) + '</ul>'; } } |