fix js errors

This commit is contained in:
Ted Unangst 2020-02-25 13:45:59 -05:00
parent cd7537c110
commit 64b710019e
2 changed files with 13 additions and 14 deletions

View File

@ -1,17 +1,5 @@
{{ 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 }}
@ -22,6 +10,16 @@ servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}"
</div>
{{ if .HonkCSRF }}
{{ template "honkform.html" . }}
<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>
{{ if and .HonkCSRF (not .IsPreview) }}

View File

@ -243,8 +243,7 @@ function relinklinks() {
history.replaceState(curpagestate, "some title", "")
})();
(function() {
var el = document.getElementById("donkdescriptor")
el.style.display = "none"
hideelement("donkdescriptor")
})();
function showhonkform(elem, rid, hname) {
var form = lehonkform
@ -278,11 +277,13 @@ function cancelhonking() {
function showelement(el) {
if (typeof(el) == "string")
el = document.getElementById(el)
if (!el) return
el.style.display = "block"
}
function hideelement(el) {
if (typeof(el) == "string")
el = document.getElementById(el)
if (!el) return
el.style.display = "none"
}
function updatedonker() {