From c39ed8895042bff2b73188fbc09bd9597327cfa8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 1 Oct 2019 19:45:17 -0400 Subject: [PATCH] jazz up honkerlinks, remove classes --- views/honk.html | 4 ++-- views/honkpage.js | 18 ++++++++++++++---- web.go | 6 ++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/views/honk.html b/views/honk.html index 58fbba1..066993f 100644 --- a/views/honk.html +++ b/views/honk.html @@ -8,7 +8,7 @@ {{ end }}

{{ if $bonkcsrf }} -{{ .Username }} +{{ .Username }} {{ else }} {{ .Username }} {{ end }} @@ -17,7 +17,7 @@
{{ if $bonkcsrf }} -original: {{ .Oondle }} +original: {{ .Oondle }} {{ else }} original: {{ .Oondle }} {{ end }} diff --git a/views/honkpage.js b/views/honkpage.js index 19f0fec..94c4ee5 100644 --- a/views/honkpage.js +++ b/views/honkpage.js @@ -86,6 +86,9 @@ function hydrargs() { } else if (name == "combo") { console.log("loading combo " + arg) args["c"] = arg + } else if (name == "honker") { + console.log("loading honker " + arg) + args["xid"] = arg } else { var stash = name + ":" + arg args["topxid"] = topxid[stash] @@ -156,12 +159,19 @@ function pageswitcher(name, arg) { } function relinklinks() { var els = document.getElementsByClassName("convoylink") - for (var i = 0; i < els.length; i++) { - els[i].onclick = pageswitcher("convoy", els[i].text) + while (els.length) { + els[0].onclick = pageswitcher("convoy", els[0].text) + els[0].classList.remove("convoylink") } els = document.getElementsByClassName("combolink") - for (var i = 0; i < els.length; i++) { - els[i].onclick = pageswitcher("combo", els[i].text) + while (els.length) { + els[0].onclick = pageswitcher("combo", els[0].text) + els[0].classList.remove("combolink") + } + els = document.getElementsByClassName("honkerlink") + while (els.length) { + els[0].onclick = pageswitcher("honker", els[0].text) + els[0].classList.remove("honkerlink") } } (function() { diff --git a/web.go b/web.go index 002e8fd..5b50325 100644 --- a/web.go +++ b/web.go @@ -1450,6 +1450,12 @@ func webhydra(w http.ResponseWriter, r *http.Request) { case "convoy": c := r.FormValue("c") honks = gethonksbyconvoy(userid, c) + case "honker": + xid := r.FormValue("xid") + if strings.IndexByte(xid, '@') != -1 { + xid = gofish(xid) + } + honks = gethonksbyxonker(userid, xid) default: http.NotFound(w, r) }