katja's git: flauschehorn.sexy

source-code of flauschehorn.sexy

commit 527a66cb5616ddae4ef737f060c8ea6856249cba
parent 377470b8e1f1c3cccbeffdf39faf09077b71ebc6
Author: Katja (ctucx) <git@ctu.cx>
Date: Mon, 17 Mar 2025 18:20:24 +0100

src/website.tpl: add reload fuction
1 file changed, 10 insertions(+), 0 deletions(-)
M
src/website.tpl
|
10
++++++++++
diff --git a/src/website.tpl b/src/website.tpl
@@ -55,5 +55,15 @@
 	<body>
 		<a href="{{SCRIPT_URL}}"><img src="{{IMAGE_URL}}"></a>
 		<p>{{{POST_CONTENT}}} <a href="{{POST_URL}}" target="_blank">{{POST_DATE}}, {{POST_TIME}} Uhr</a></p>
+		<script>
+			addEventListener("DOMContentLoaded", () => {
+				const searchParams = new URLSearchParams(window.location.search);
+
+				// reload page if queryString has parameter 'reload' with amout of secs
+				if (searchParams.has("reload") && Number(searchParams.get("reload")) != "NaN") {
+					setInterval(() => window.location.reload(), searchParams.get("reload") * 1000);
+				}
+			});
+		</script>
 	</body>
 </html>