From 6e9a2308a0563018fbb3e70b991571d132b34a0e Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 28 May 2019 20:57:55 -0400 Subject: [PATCH] when zonking a convoy, remove it from the page --- views/honk.html | 2 +- views/honkpage.html | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/views/honk.html b/views/honk.html index 96b144d..71d9449 100644 --- a/views/honk.html +++ b/views/honk.html @@ -1,4 +1,4 @@ -
+
{{ with .Honk }}
avatar diff --git a/views/honkpage.html b/views/honkpage.html index 330819d..c6a3445 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -40,13 +40,28 @@ function zonkit(el) { el.innerHTML = "zonked" el.disabled = true var data = { } + var convoy, wherefore for (var i in el.parentElement.elements) { var e = el.parentElement.elements[i] if (e.name) { data[e.name] = e.value + if (e.name == "convoy") { + convoy = e.value + } else if (e.name == "wherefore") { + wherefore = e.value + } } } post("/zonkit", encode(data)) + if (wherefore == "this convoy") { + var els = document.querySelectorAll('article.honk') + for (var i = 0; i < els.length; i++) { + var e = els[i] + if (e.getAttribute("data-convoy") == convoy) { + e.remove() + } + } + } } {{ end }}