From 492fc5cc9d458df5e4b296d45ed171db8c734e03 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Tue, 06 Dec 2016 22:00:00 +0000
Subject: [PATCH] Append stop identifier to the URL using #!

---
 index.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/index.js b/index.js
index f6c900c..854cc18 100644
--- a/index.js
+++ b/index.js
@@ -314,6 +314,7 @@
 		e.preventDefault();
 		if(!stop_name_autocomplete.value) return;
 		stop_id = stop_name_autocomplete.value;
+		window.location.hash = '#!' + stop_id;
 		loadTimes(stop_id, true);
 	});
 	
@@ -324,6 +325,11 @@
 	alert_close.addEventListener('click', function(e) {
 		alert.style.display = 'none';
 	});
+	
+	if(window.location.hash.match(/^#![0-9]+$/)) {
+		stop_id = parseInt(window.location.hash.slice(2));
+		loadTimes(stop_id);
+	}
 }
 
 init();

--
Gitblit v1.9.1