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

View File

@ -86,6 +86,9 @@ function hydrargs() {
} else if (name == "combo") { } else if (name == "combo") {
console.log("loading combo " + arg) console.log("loading combo " + arg)
args["c"] = arg args["c"] = arg
} else if (name == "honker") {
console.log("loading honker " + arg)
args["xid"] = arg
} else { } else {
var stash = name + ":" + arg var stash = name + ":" + arg
args["topxid"] = topxid[stash] args["topxid"] = topxid[stash]
@ -156,12 +159,19 @@ function pageswitcher(name, arg) {
} }
function relinklinks() { function relinklinks() {
var els = document.getElementsByClassName("convoylink") var els = document.getElementsByClassName("convoylink")
for (var i = 0; i < els.length; i++) { while (els.length) {
els[i].onclick = pageswitcher("convoy", els[i].text) els[0].onclick = pageswitcher("convoy", els[0].text)
els[0].classList.remove("convoylink")
} }
els = document.getElementsByClassName("combolink") els = document.getElementsByClassName("combolink")
for (var i = 0; i < els.length; i++) { while (els.length) {
els[i].onclick = pageswitcher("combo", els[i].text) 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() { (function() {

6
web.go
View File

@ -1450,6 +1450,12 @@ func webhydra(w http.ResponseWriter, r *http.Request) {
case "convoy": case "convoy":
c := r.FormValue("c") c := r.FormValue("c")
honks = gethonksbyconvoy(userid, c) honks = gethonksbyconvoy(userid, c)
case "honker":
xid := r.FormValue("xid")
if strings.IndexByte(xid, '@') != -1 {
xid = gofish(xid)
}
honks = gethonksbyxonker(userid, xid)
default: default:
http.NotFound(w, r) http.NotFound(w, r)
} }