Fix the control panel scripts.

This commit is contained in:
Azareal 2019-04-20 12:22:57 +10:00
parent b3c4cc4bfc
commit 114afe0b13
2 changed files with 18 additions and 14 deletions

View File

@ -218,6 +218,7 @@ function fetchPhrases(plist) {
runInitHook("pre_iife"); runInitHook("pre_iife");
let loggedIn = document.head.querySelector("[property='x-loggedin']").content == "true"; let loggedIn = document.head.querySelector("[property='x-loggedin']").content == "true";
if(!window.location.pathname.startsWith("/panel/")) {
let toLoad = 2; let toLoad = 2;
// TODO: Shunt this into loggedIn if there aren't any search and filter widgets? // TODO: Shunt this into loggedIn if there aren't any search and filter widgets?
let q = (f) => { let q = (f) => {
@ -232,6 +233,9 @@ function fetchPhrases(plist) {
} }
notifyOnScriptW("template_topics_topic", () => q(!Template_topics_topic)); notifyOnScriptW("template_topics_topic", () => q(!Template_topics_topic));
notifyOnScriptW("template_paginator", () => q(!Template_paginator)); notifyOnScriptW("template_paginator", () => q(!Template_paginator));
} else {
initPhrases(false);
}
if(loggedIn) { if(loggedIn) {
fetch("/api/me/") fetch("/api/me/")

View File

@ -7,7 +7,7 @@
{{range .Header.PreScriptsAsync}} {{range .Header.PreScriptsAsync}}
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}} <script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
<meta property="x-loggedin" content="{{.CurrentUser.Loggedin}}" /> <meta property="x-loggedin" content="{{.CurrentUser.Loggedin}}" />
<script type="text/javascript" src="/static/init.js?i=1"></script> <script type="text/javascript" src="/static/init.js?i=2"></script>
{{range .Header.ScriptsAsync}} {{range .Header.ScriptsAsync}}
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}} <script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>