diff --git a/index.html b/index.html
index 3c0d6cc..04fad7f 100644
--- a/index.html
+++ b/index.html
@@ -221,6 +221,12 @@
}
});
+ // Check for coordinates in hash
+ parseWindowHash();
+ window.addEventListener('hashchange', function () {
+ parseWindowHash();
+ }, false);
+
$("body").on("click", ".copyonclick", function () {
var copyitem = $(this);
var copytext = copyitem.text();
@@ -276,6 +282,20 @@
alert(e);
}
}
+
+ function parseWindowHash() {
+ var hash = window.location.hash.substr(1);
+ if (/^-?[0-9]{1,2}\.?[0-9]*,-?[0-9]{1,3}\.?[0-9]*$/.test(hash)) {
+ var lat = hash.split(",")[0];
+ var lon = hash.split(",")[1];
+ lat = (Math.round(lat * 10000) / 10000);
+ lon = (Math.round(lon * 10000) / 10000);
+ lookupAndShowCoords(lat, lon);
+ setTimeout(function () {
+ window.location.hash = hash;
+ }, 1000);
+ }
+ }