diff --git a/views/honkpage.html b/views/honkpage.html index d2eb72f..8b4b63c 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -10,7 +10,7 @@ {{ template "honkform.html" . }} {{ end }} -{{ if .TopXID }} +{{ if .HonkCSRF }}

diff --git a/views/honkpage.js b/views/honkpage.js index d04d2cb..e46c160 100644 --- a/views/honkpage.js +++ b/views/honkpage.js @@ -164,6 +164,9 @@ function pageswitcher(name, arg) { } switchtopage(name, arg) var url = evt.srcElement.href + if (!url) { + url = evt.srcElement.parentElement.href + } history.pushState(newpagestate(name, arg), "some title", url) window.scrollTo(0, 0) return false diff --git a/web.go b/web.go index db798f1..ff2243a 100644 --- a/web.go +++ b/web.go @@ -99,9 +99,6 @@ func homepage(w http.ResponseWriter, r *http.Request) { honks = gethonksforuser(userid) honks = osmosis(honks, userid) } - if len(honks) > 0 { - templinfo["TopXID"] = honks[0].XID - } templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) } @@ -582,9 +579,6 @@ func showcombo(w http.ResponseWriter, r *http.Request) { templinfo["PageArg"] = "name" templinfo["ServerMessage"] = "honks by combo: " + name templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) - if len(honks) > 0 { - templinfo["TopXID"] = honks[0].XID - } honkpage(w, u, honks, templinfo) } func showconvoy(w http.ResponseWriter, r *http.Request) { @@ -720,6 +714,9 @@ func honkpage(w http.ResponseWriter, u *login.UserInfo, honks []*Honk, templinfo } reverbolate(userid, honks) templinfo["Honks"] = honks + if len(honks) > 0 { + templinfo["TopXID"] = honks[0].XID + } err := readviews.Execute(w, "honkpage.html", templinfo) if err != nil { log.Print(err)