diff --git a/overviewer_core/data/js_src/util.js b/overviewer_core/data/js_src/util.js index 156640e..59e884f 100644 --- a/overviewer_core/data/js_src/util.js +++ b/overviewer_core/data/js_src/util.js @@ -3,7 +3,9 @@ overviewer.util = { // vars for callback readyQueue: [], isReady: false, - + + lastHash: null, + /* fuzz tester! */ 'testMaths': function(t) { @@ -466,18 +468,23 @@ overviewer.util = { }); }, 'initHash': function() { - if(window.location.hash.split("/").length > 1) { - overviewer.util.goToHash(); - // Clean up the hash. - overviewer.util.updateHash(); - + var newHash = window.location.hash; + if (overviewer.util.lastHash !== newHash) { + overviewer.util.lastHash = newHash; + if(newHash.split("/").length > 1) { + overviewer.util.goToHash(); + // Clean up the hash. + overviewer.util.updateHash(); + } } }, 'setHash': function(x, y, z, zoom, w, maptype) { // save this info is a nice easy to parse format var currentWorldView = overviewer.mapModel.get("currentWorldView"); currentWorldView.options.lastViewport = [x,y,z,zoom]; - window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype); + var newHash = "#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype; + overviewer.util.lastHash = newHash; // this should not trigger initHash + window.location.replace(newHash); }, 'updateHash': function() { var currTileset = overviewer.mapView.options.currentTileSet;