all repos — honk @ a7b12f7cc706b4ad652a52e489019a7f301754a1

my fork of honk

gross hack to hide refresh when it won't work
Ted Unangst tedu@tedunangst.com
Fri, 21 Feb 2020 09:54:25 -0500
commit

a7b12f7cc706b4ad652a52e489019a7f301754a1

parent

293ff347eb76ff9e94df252c33a1ab612af2ef7b

2 files changed, 14 insertions(+), 13 deletions(-)

jump to
M views/honkpage.htmlviews/honkpage.html

@@ -1,5 +1,17 @@

{{ template "header.html" . }} <main> +{{ if .HonkCSRF }} +<script> +var csrftoken = {{ .HonkCSRF }} +var honksforpage = { } +var curpagestate = { name: "{{ .PageName }}", arg : "{{ .PageArg }}" } +var tophid = { } +tophid[curpagestate.name + ":" + curpagestate.arg] = "{{ .TopHID }}" +var servermsgs = { } +servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}" +</script> +<script src="/honkpage.js{{ .JSParam }}"></script> +{{ end }} <div class="info" id="infobox"> <div id="srvmsg"> {{ if .Name }}

@@ -17,19 +29,7 @@ <div class="info" id="refreshbox">

<p><button onclick="refreshhonks(this)">refresh</button><span></span> <button onclick="oldestnewest(this)">scroll down</button> </div> -{{ end }} -{{ if .HonkCSRF }} -<script> -var csrftoken = {{ .HonkCSRF }} -var honksforpage = { } -var curpagestate = { name: "{{ .PageName }}", arg : "{{ .PageArg }}" } -var tophid = { } -tophid[curpagestate.name + ":" + curpagestate.arg] = "{{ .TopHID }}" -var servermsgs = { } -servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}" - -</script> -<script src="/honkpage.js{{ .JSParam }}"></script> +{{ if eq .ServerMessage "one honk maybe more" }} <script> hideelement("refreshbox")</script> {{ end }} {{ end }} <div id="honksonpage"> <div>
M views/honkpage.jsviews/honkpage.js

@@ -167,6 +167,7 @@ if (msg) {

msg.remove() servermsgs[stash] = msg } + showelement("refreshbox") honksforpage[stash] = holder