Commit 70d838bb authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

support linking to individual trains

parent 7e4727af
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
$(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');
				}
			});
		});
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+0 −0

File moved.

+8 −5
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@
%     }
      </div>
%   }
    <div class="moreinfo collapsed-moreinfo">
    <div class="moreinfo collapsed-moreinfo"
      data-train="<%= ($departure->{train_type} // 'none') . ($departure->{train_no} // 0) %>">
    <div class="mheader">
    <div>
%   if ($departure->{train_no} or $departure->{train_line}) {
@@ -164,18 +165,20 @@
%         if ($first++) {
            <span class="separator">–</span>
%         }
          <a href="/<%= $stop->{name} %>#<%= $departure->{train_type} . $departure->{train_no} %>" class="
%         if ($stop->{isAdditional}) {
            <span class="additional-stop"><%= $stop->{name} %></span>
            additional-stop
%         }
%         elsif ($stop->{isCancelled}) {
            <span class="cancelled-stop"><%= $stop->{name} %></span>
            cancelled-stop
%         }
%         elsif ($self->is_important($stop->{name})) {
            <span class="important-stop"><%= $stop->{name} %></span>
            important-stop
%         }
%         else {
            <span class="generic-stop"><%= $stop->{name} %></span>
            generic-stop
%         }
          "><%= $stop->{name} %></a>
%       }
      </div> <!-- mroute -->
%   }
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
	<meta http-equiv="refresh" content="<%= $self->stash('refresh_interval') %>"/>
% }

	% my $av = 'v2'; # asset version
	% my $av = 'v3'; # asset version
	%= stylesheet "/static/${av}/default.css"
	%= stylesheet "/static/${av}/jquery-ui.min.css"
% my $force_mobile = param('force_mobile') // -1;