jazz up honkerlinks, remove classes

This commit is contained in:
Ted Unangst 2019-10-01 19:45:17 -04:00
parent 67ae66ca26
commit c39ed88950
3 changed files with 22 additions and 6 deletions

View File

@ -8,7 +8,7 @@
{{ end }}
<p>
{{ if $bonkcsrf }}
<a href="/h?xid={{ .Honker }}" rel=noreferrer>{{ .Username }}</a>
<a class="honkerlink" href="/h?xid={{ .Honker }}">{{ .Username }}</a>
{{ else }}
<a href="{{ .Honker }}" rel=noreferrer>{{ .Username }}</a>
{{ end }}
@ -17,7 +17,7 @@
<br>
<span style="margin-left: 1em;" class="clip">
{{ if $bonkcsrf }}
original: <a href="/h?xid={{ .Oonker }}" rel=noreferrer>{{ .Oondle }}</a>
original: <a class="honkerlink" href="/h?xid={{ .Oonker }}">{{ .Oondle }}</a>
{{ else }}
original: <a href="{{ .Oonker }}" rel=noreferrer>{{ .Oondle }}</a>
{{ end }}

View File

@ -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() {

6
web.go
View File

@ -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)
}