From 35ec65de0869c77fc66bf3f2702c561efd98f4af Mon Sep 17 00:00:00 2001 From: piernov Date: Wed, 4 May 2016 14:52:35 +0200 Subject: Move onhashchange event hook from XHTML to JavaScript Add some comments --- js/craftmine.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js/craftmine.js') diff --git a/js/craftmine.js b/js/craftmine.js index 61abbf7..0e95aa3 100644 --- a/js/craftmine.js +++ b/js/craftmine.js @@ -70,7 +70,8 @@ function updateMine() { function init() { initCraftMine(); - changeTab(); - listSaves(); - window.setInterval(updateMine, 1000); + changeTab(); // Switch to tab specified in URL + listSaves(); // Update save list on page load + window.setInterval(updateMine, 1000); // Increase mine amount every 1 second + window.onhashchange = changeTab; // Hook changeTab from js/gui.js to hashchange event } -- cgit v1.2.3-70-g09d2