diff options
Diffstat (limited to 'public/static/collapse.js')
-rw-r--r-- | public/static/collapse.js | 11 |
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'); } }); }); |