all repos — honk @ 6778d96af7b264b0a99f89d8a0f3a2cd245e2357

my fork of honk

when zonking a convoy, remove it from the page
Ted Unangst tedu@tedunangst.com
Tue, 28 May 2019 20:57:55 -0400
commit

6778d96af7b264b0a99f89d8a0f3a2cd245e2357

parent

b395b9c93c6ea4c6ce2a6fc6dd7db6dee2aa05d5

2 files changed, 16 insertions(+), 1 deletions(-)

jump to
M views/honk.htmlviews/honk.html

@@ -1,4 +1,4 @@

-<article class="honk {{ .Honk.What }} {{ and (not .Honk.Public) "limited" }}"> +<article class="honk {{ .Honk.What }} {{ and (not .Honk.Public) "limited" }}" data-convoy="{{ .Honk.Convoy }}"> {{ with .Honk }} <header> <img alt="avatar" src="/a?a={{ .Honker}}">
M views/honkpage.htmlviews/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() + } + } + } } </script> {{ end }}