Fix the control panel scripts.
This commit is contained in:
parent
b3c4cc4bfc
commit
114afe0b13
|
@ -218,20 +218,24 @@ function fetchPhrases(plist) {
|
|||
runInitHook("pre_iife");
|
||||
let loggedIn = document.head.querySelector("[property='x-loggedin']").content == "true";
|
||||
|
||||
let toLoad = 2;
|
||||
// TODO: Shunt this into loggedIn if there aren't any search and filter widgets?
|
||||
let q = (f) => {
|
||||
toLoad--;
|
||||
if(toLoad===0) initPhrases(loggedIn);
|
||||
if(f) throw("template function not found");
|
||||
};
|
||||
if(loggedIn) {
|
||||
toLoad += 2;
|
||||
notifyOnScriptW("template_topic_c_edit_post", () => q(!Template_topic_c_edit_post));
|
||||
notifyOnScriptW("template_topic_c_attach_item", () => q(!Template_topic_c_attach_item));
|
||||
if(!window.location.pathname.startsWith("/panel/")) {
|
||||
let toLoad = 2;
|
||||
// TODO: Shunt this into loggedIn if there aren't any search and filter widgets?
|
||||
let q = (f) => {
|
||||
toLoad--;
|
||||
if(toLoad===0) initPhrases(loggedIn);
|
||||
if(f) throw("template function not found");
|
||||
};
|
||||
if(loggedIn) {
|
||||
toLoad += 2;
|
||||
notifyOnScriptW("template_topic_c_edit_post", () => q(!Template_topic_c_edit_post));
|
||||
notifyOnScriptW("template_topic_c_attach_item", () => q(!Template_topic_c_attach_item));
|
||||
}
|
||||
notifyOnScriptW("template_topics_topic", () => q(!Template_topics_topic));
|
||||
notifyOnScriptW("template_paginator", () => q(!Template_paginator));
|
||||
} else {
|
||||
initPhrases(false);
|
||||
}
|
||||
notifyOnScriptW("template_topics_topic", () => q(!Template_topics_topic));
|
||||
notifyOnScriptW("template_paginator", () => q(!Template_paginator));
|
||||
|
||||
if(loggedIn) {
|
||||
fetch("/api/me/")
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{{range .Header.PreScriptsAsync}}
|
||||
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
|
||||
<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}}
|
||||
<script async type="text/javascript" src="/static/{{.}}"></script>{{end}}
|
||||
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
||||
|
|
Loading…
Reference in New Issue