From 5a15824ed5fc1af2bb12bd98eb2346ebda3a774f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Mon, 10 Nov 2025 10:02:34 +0100 Subject: [PATCH] Nicer handling of dead tabs, introduced version. --- main.go | 8 +++++++- static/css/main.css | 6 ++++++ static/html/index.html | 23 +++++++++++++---------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index a5dda15..336aa88 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,8 @@ import ( "strings" ) +const VERSION = "v1" + var ( flagVerbose bool flagWsURL string @@ -70,7 +72,11 @@ func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{ return } - tmpl.Execute(w, sites) + data := map[string]any{ + "Sites": sites, + "VERSION": VERSION, + } + tmpl.Execute(w, data) } // }}} func pageCSS(w http.ResponseWriter, r *http.Request) { // {{{ w.Header().Add("Content-Type", "text/css") diff --git a/static/css/main.css b/static/css/main.css index 5462b71..2b0e032 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -3,6 +3,12 @@ body { margin: 32px; } +#version { + position: absolute; + right: 16px; + top: 16px; +} + input { font-size: 1em; } diff --git a/static/html/index.html b/static/html/index.html index 455fc8f..030ff24 100644 --- a/static/html/index.html +++ b/static/html/index.html @@ -44,8 +44,9 @@ for (const uuid of Object.keys(json.Sites)) { const site = json.Sites[uuid] if (site.StopLoop) { - document.querySelector(`.url[data-uuid="${uuid}"]`)?.classList.add('dead') - document.querySelector(`.watch[data-uuid="${uuid}"]`)?.classList.add('dead') + const els = document.querySelectorAll(`[data-uuid="${uuid}"]`) + for (const el of els) + el.remove() } } }) @@ -64,6 +65,7 @@ +
{{ .VERSION }}

Browser

@@ -81,14 +83,15 @@ - {{ range . }} - {{ if .StopLoop }} - {{ continue }} - {{ end }} -
-
{{ .URL }}
-
{{ .Watch }}
-
{{ if not .StopLoop }}❌{{ end }}
+ {{ range .Sites }} + {{ if .StopLoop }} + {{ continue }} + {{ end }} +
+
{{ .URL }}
+
{{ .Watch }}
+
{{ if not .StopLoop }}❌{{ + end }}
{{ end }}