summaryrefslogtreecommitdiff
path: root/public/static/collapse.js
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-01-12 13:56:23 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-01-12 13:56:23 +0100
commit70d838bb0825cf5a7fa8dcc2eb4e712001da2c1d (patch)
treebe501b2a011a164e8d99f06d89abc99b19127aea /public/static/collapse.js
parent7e4727af603cdd8bbb3746842a9603054ddca7cb (diff)
support linking to individual trains1.15
Diffstat (limited to 'public/static/collapse.js')
-rw-r--r--public/static/collapse.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/public/static/collapse.js b/public/static/collapse.js
index ba34001..0015c89 100644
--- a/public/static/collapse.js
+++ b/public/static/collapse.js
@@ -1,10 +1,20 @@
$(document).ready(function() {
+ if (document.location.hash.length > 1) {
+ var wanted = document.location.hash.replace('#', '');
+ $('div.app > ul > li > .moreinfo, div.infoscreen > ul > li > .moreinfo').each(function() {
+ if ($(this).data('train') == wanted) {
+ $(this).removeClass('collapsed-moreinfo');
+ $(this).addClass('expanded-moreinfo');
+ }
+ });
+ }
$('div.app > ul > li, div.infoscreen > ul > li').each(function() {
$(this).click(function() {
$(this).children('.moreinfo').each(function() {
if ($(this).hasClass('expanded-moreinfo')) {
$(this).removeClass('expanded-moreinfo');
$(this).addClass('collapsed-moreinfo');
+ document.location.hash = '';
}
else {
$('.moreinfo').each(function() {
@@ -15,6 +25,7 @@ $(document).ready(function() {
});
$(this).removeClass('collapsed-moreinfo');
$(this).addClass('expanded-moreinfo');
+ document.location.hash = $(this).data('train');
}
});
});