about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-07 01:34:59 -0500
committerJune McEnroe <june@causal.agency>2019-01-07 01:34:59 -0500
commit2170945fab0904f7d631ab14d2e3c3192a6ddad4 (patch)
treee63247a758d5998abbc6eb35f5a72ef51dc0f11b
parentCompress PNG data in image (diff)
downloadtorus-2170945fab0904f7d631ab14d2e3c3192a6ddad4.tar.gz
torus-2170945fab0904f7d631ab14d2e3c3192a6ddad4.zip
Set img src when explore fragment changes
Diffstat (limited to '')
-rw-r--r--explore.html9
1 files changed, 7 insertions, 2 deletions
diff --git a/explore.html b/explore.html
index 004eb2b..6fa5858 100644
--- a/explore.html
+++ b/explore.html
@@ -64,14 +64,19 @@ Code is available from
 	let uarr = document.getElementById("uarr");
 	let rarr = document.getElementById("rarr");
 
-	let state = new URLSearchParams(document.location.hash.slice(1));
+	let state = new URLSearchParams();
 
 	function setImage() {
 		let url = new URL(tile.src);
 		url.search = "?" + state.toString();
 		tile.src = url.toString();
 	}
-	setImage();
+
+	window.onhashchange = function() {
+		state = new URLSearchParams(document.location.hash.slice(1));
+		setImage();
+	}
+	window.onhashchange();
 
 	function setState(x, y) {
 		state.set("x", x);