when zonking a convoy, remove it from the page
This commit is contained in:
parent
1a88b3dbc9
commit
6e9a2308a0
|
@ -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}}">
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Loading…
Reference in New Issue