diff --git a/common/files.go b/common/files.go index d2fbdeb4..31c5e732 100644 --- a/common/files.go +++ b/common/files.go @@ -185,13 +185,18 @@ func (list SFileList) JSTmplInit() error { data = replace(data, " c.", "") data = replace(data, "phrases.", "") data = replace(data, ", 10;", "") + //data = replace(data, "var plist = GetTmplPhrasesBytes("+shortName+"_tmpl_phrase_id)", "const plist = tmplPhrases[\""+tmplName+"\"];") - data = replace(data, "//var plist = GetTmplPhrasesBytes("+shortName+"_tmpl_phrase_id)", "const "+shortName+"_phrase_arr = tmplPhrases[\""+tmplName+"\"];") - data = replace(data, "var cached_var_", "let cached_var_") - data = replace(data, `tmpl_vars, ok := tmpl_i.`, `/*`) + //data = replace(data, "//var plist = GetTmplPhrasesBytes("+shortName+"_tmpl_phrase_id)", "const "+shortName+"_phrase_arr = tmplPhrases[\""+tmplName+"\"];") + data = replace(data, "//var plist = GetTmplPhrasesBytes("+shortName+"_tmpl_phrase_id)", "const pl=tmplPhrases[\""+tmplName+"\"];") + data = replace(data, shortName+"_phrase_arr", "pl") + data = replace(data, "tmpl_"+shortName+"_vars", "t_vars") + + data = replace(data, "var c_var_", "let c_var_") + data = replace(data, `t_vars, ok := tmpl_i.`, `/*`) data = replace(data, "[]byte(", "") data = replace(data, "StringToBytes(", "") - data = replace(data, "RelativeTime(tmpl_"+shortName+"_vars.", "tmpl_"+shortName+"_vars.Relative") + data = replace(data, "RelativeTime(t_vars.", "t_vars.Relative") // TODO: Format dates properly on the client side data = replace(data, ".Format(\"2006-01-02 15:04:05\"", "") data = replace(data, ", 10", "") @@ -239,7 +244,7 @@ func (list SFileList) JSTmplInit() error { return err } // Don't use Gzip if we get meagre gains from it as it takes longer to process the responses - if len(gzipData) >= (len(data) + 150) { + if len(gzipData) >= (len(data) + 120) { gzipData = nil } else { diff := len(data) - len(gzipData) diff --git a/common/templates/templates.go b/common/templates/templates.go index 2c2bb006..39fda2be 100644 --- a/common/templates/templates.go +++ b/common/templates/templates.go @@ -1959,7 +1959,7 @@ func (c *CTemplateSet) afterTemplate(con CContext, startIndex int) { varmap := make(map[string]int) for name, count := range varcounts { if count > 1 { - varstr += "var cached_var_" + strconv.Itoa(i) + " = " + name + "\n" + varstr += "var c_var_" + strconv.Itoa(i) + "=" + name + "\n" varmap[name] = i i++ } @@ -1979,7 +1979,7 @@ func (c *CTemplateSet) afterTemplate(con CContext, startIndex int) { } else if item.Type == "varsub" && loopDepth == 0 { index, ok := varmap[item.Body] if ok { - item.Body = "cached_var_" + strconv.Itoa(index) + item.Body = "c_var_" + strconv.Itoa(index) item.Type = "cvarsub" outBuf[i] = item } diff --git a/templates/topics.html b/templates/topics.html index 7430ab11..35cd2c73 100644 --- a/templates/topics.html +++ b/templates/topics.html @@ -1,6 +1,6 @@ {{template "header.html" . }}
- +

{{.Title}}

@@ -26,8 +26,7 @@
{{else}}
{{end}} - -
+
{{end}} @@ -39,7 +38,7 @@ {{/** TODO: Add ARIA attributes for this **/}}
-
+
{{lang
diff --git a/templates/topics_topic.html b/templates/topics_topic.html index a614a9d8..eb215341 100644 --- a/templates/topics_topic.html +++ b/templates/topics_topic.html @@ -1,10 +1,10 @@
- + - {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}} -
{{.Creator.Name}} + {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}} +
{{.Creator.Name}} {{/** TODO: Avoid the double '|' when both .IsClosed and .Sticky are set to true. We could probably do this with CSS **/}} {{if .IsClosed}} | 🔒︎{{end}} {{if .Sticky}} | 📍︎{{end}} @@ -24,7 +24,7 @@
- + {{.LastUser.Name}}
{{reltime .LastReplyAt}} diff --git a/themes/nox/overrides/topics_topic.html b/themes/nox/overrides/topics_topic.html index c1c3e185..82a259ec 100644 --- a/themes/nox/overrides/topics_topic.html +++ b/themes/nox/overrides/topics_topic.html @@ -1,9 +1,9 @@ -
+
- {{.Title}}{{if .ForumName}}-{{.ForumName}}{{end}} -
{{.Creator.Name}} + {{.Title}}{{if .ForumName}}-{{.ForumName}}{{end}} +
{{.Creator.Name}}