allow setting local.js

This commit is contained in:
Ted Unangst 2022-03-02 14:44:40 -05:00
parent a21fb44491
commit e4ab17cbc9
3 changed files with 12 additions and 2 deletions

View File

@ -54,7 +54,7 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
<details class="noise" {{ .Open }} >
<summary>{{ .HTPrecis }}<p></summary>
<p>{{ .HTPrecis }}
<p>{{ .HTML }}
<p class="content">{{ .HTML }}
{{ with .Time }}
<p>Time: {{ .StartTime.Local.Format "03:04PM EDT Mon Jan 02"}}
{{ if .Duration }}<br>Duration: {{ .Duration }}{{ end }}

View File

@ -29,6 +29,9 @@ function playit(elem, word, wordlist, xid) {
})
}
</script>
{{ if .LocalJSParam }}
<script src="/local.js{{ .LocalJSParam }}"></script>
{{ end }}
</div>
{{ if and .HonkCSRF (not .IsPreview) }}
<div class="info" id="refreshbox">

9
web.go
View File

@ -78,6 +78,7 @@ func getInfo(r *http.Request) map[string]interface{} {
templinfo["StyleParam"] = getassetparam(viewDir + "/views/style.css")
templinfo["LocalStyleParam"] = getassetparam(dataDir + "/views/local.css")
templinfo["JSParam"] = getassetparam(viewDir + "/views/honkpage.js")
templinfo["LocalJSParam"] = getassetparam(dataDir + "/views/local.js")
templinfo["ServerName"] = serverName
templinfo["IconName"] = iconName
templinfo["UserSep"] = userSep
@ -2470,7 +2471,12 @@ func serve() {
viewDir+"/views/honkpage.js",
)
if !develMode {
assets := []string{viewDir + "/views/style.css", dataDir + "/views/local.css", viewDir + "/views/honkpage.js"}
assets := []string{
viewDir + "/views/style.css",
dataDir + "/views/local.css",
viewDir + "/views/honkpage.js",
dataDir + "/views/local.js",
}
for _, s := range assets {
savedassetparams[s] = getassetparam(s)
}
@ -2521,6 +2527,7 @@ func serve() {
getters.HandleFunc("/honkpage.js", serveviewasset)
getters.HandleFunc("/wonk.js", serveviewasset)
getters.HandleFunc("/local.css", servedataasset)
getters.HandleFunc("/local.js", servedataasset)
getters.HandleFunc("/icon.png", servedataasset)
getters.HandleFunc("/favicon.ico", servedataasset)