From f337aa42ad657f8a6e9a60e704bdff1bb5e542a3 Mon Sep 17 00:00:00 2001
From: psy <psy@darmstadt.ccc.de>
Date: Fri, 26 Mar 2021 22:16:10 +0100
Subject: [PATCH] listen to hashchange event

---
 index.html | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/index.html b/index.html
index 51d434f..e6d8dba 100644
--- a/index.html
+++ b/index.html
@@ -21,11 +21,16 @@
 
 	<script type="text/javascript">
 	function generateQR() {
-		new QRCode(document.getElementById("qrcode"), location.hash.substring(1));
+		var qrcode = new QRCode(document.getElementById("qrcode"), location.hash.substring(1));
 	}
 	$( document ).ready(function() {
 		generateQR();
 	});
+
+	window.addEventListener('hashchange', function() {
+		qrcode.clear(); 
+		qrcode.makeCode(location.hash.substring(1));
+	});
 			
 	</script>
 
-- 
GitLab