more consistency in page switching
Ted Unangst tedu@tedunangst.com
Mon, 07 Oct 2019 16:33:31 -0400
3 files changed,
7 insertions(+),
7 deletions(-)
M
views/honkpage.html
→
views/honkpage.html
@@ -10,7 +10,7 @@ {{ if .HonkCSRF }}
{{ template "honkform.html" . }} {{ end }} </div> -{{ if .TopXID }} +{{ if .HonkCSRF }} <div class="info" id="refreshbox"> <p><button onclick="refreshhonks(this)">refresh</button><span></span> </div>
M
views/honkpage.js
→
views/honkpage.js
@@ -164,6 +164,9 @@ return false
} 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
M
web.go
→
web.go
@@ -99,9 +99,6 @@ templinfo["PageName"] = "home"
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 @@ templinfo["PageName"] = "combo"
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 @@ w.Header().Set("Cache-Control", "max-age=60")
} 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)