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" . }} {{ template "header.html" . }}
<main> <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 class="info" id="infobox">
<div id="srvmsg"> <div id="srvmsg">
{{ if .Name }} {{ if .Name }}
@ -22,6 +10,16 @@ servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}"
</div> </div>
{{ if .HonkCSRF }} {{ if .HonkCSRF }}
{{ template "honkform.html" . }} {{ 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 }} {{ end }}
</div> </div>
{{ if and .HonkCSRF (not .IsPreview) }} {{ if and .HonkCSRF (not .IsPreview) }}

View File

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