simplify the async zonking
This commit is contained in:
parent
50f0222eb1
commit
42d9306893
19
honk.go
19
honk.go
|
@ -807,20 +807,10 @@ func savebonk(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func zonkit(w http.ResponseWriter, r *http.Request) {
|
func zonkit(w http.ResponseWriter, r *http.Request) {
|
||||||
wherefore := r.FormValue("wherefore")
|
wherefore := r.FormValue("wherefore")
|
||||||
var what string
|
what := r.FormValue("what")
|
||||||
switch wherefore {
|
switch wherefore {
|
||||||
case "this honk":
|
case "zonk":
|
||||||
what = r.FormValue("honk")
|
case "zonvoy":
|
||||||
wherefore = "zonk"
|
|
||||||
case "this honker":
|
|
||||||
what = r.FormValue("honker")
|
|
||||||
wherefore = "zonker"
|
|
||||||
case "this convoy":
|
|
||||||
what = r.FormValue("convoy")
|
|
||||||
wherefore = "zonvoy"
|
|
||||||
}
|
|
||||||
if what == "" {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("zonking %s %s", wherefore, what)
|
log.Printf("zonking %s %s", wherefore, what)
|
||||||
|
@ -843,14 +833,13 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
|
||||||
go honkworldwide(user, &zonk)
|
go honkworldwide(user, &zonk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
_, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore)
|
_, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error saving zonker: %s", err)
|
log.Printf("error saving zonker: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func savehonk(w http.ResponseWriter, r *http.Request) {
|
func savehonk(w http.ResponseWriter, r *http.Request) {
|
||||||
rid := r.FormValue("rid")
|
rid := r.FormValue("rid")
|
||||||
|
|
|
@ -39,7 +39,7 @@ function bonk(el, xid) {
|
||||||
function muteit(el, convoy) {
|
function muteit(el, convoy) {
|
||||||
el.innerHTML = "muted"
|
el.innerHTML = "muted"
|
||||||
el.disabled = true
|
el.disabled = true
|
||||||
post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=this+convoy&convoy=" + escape(convoy))
|
post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=zonvoy&what=" + escape(convoy))
|
||||||
var els = document.querySelectorAll('article.honk')
|
var els = document.querySelectorAll('article.honk')
|
||||||
for (var i = 0; i < els.length; i++) {
|
for (var i = 0; i < els.length; i++) {
|
||||||
var e = els[i]
|
var e = els[i]
|
||||||
|
@ -51,7 +51,7 @@ function muteit(el, convoy) {
|
||||||
function zonkit(el, xid) {
|
function zonkit(el, xid) {
|
||||||
el.innerHTML = "zonked"
|
el.innerHTML = "zonked"
|
||||||
el.disabled = true
|
el.disabled = true
|
||||||
post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=this+honk&honk=" + escape(xid))
|
post("/zonkit", "CSRF={{ $BonkCSRF }}&wherefore=zonk&what=" + escape(xid))
|
||||||
var p = el
|
var p = el
|
||||||
while (p && p.tagName != "ARTICLE") {
|
while (p && p.tagName != "ARTICLE") {
|
||||||
p = p.parentElement
|
p = p.parentElement
|
||||||
|
|
Loading…
Reference in New Issue