reorder lang key rewrites. reorder code.load event
This commit is contained in:
parent
db16ef3545
commit
339dc7fa21
2 changed files with 16 additions and 13 deletions
|
|
@ -2520,6 +2520,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update static html elements with language overrides
|
||||||
|
UI.lang = function() {
|
||||||
|
for (let el of [...DOC.querySelectorAll("[lk]")]) {
|
||||||
|
let key = el.getAttribute('lk');
|
||||||
|
let val = LANG[key];
|
||||||
|
if (val) {
|
||||||
|
el.innerText = val;
|
||||||
|
} else {
|
||||||
|
console.log({missing_ln: key});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// if a language needs to load, the script is injected and loaded
|
// if a language needs to load, the script is injected and loaded
|
||||||
// first. once this loads, or doesn't, the initialization begins
|
// first. once this loads, or doesn't, the initialization begins
|
||||||
let lang_set = undefined;
|
let lang_set = undefined;
|
||||||
|
|
@ -2535,6 +2548,7 @@
|
||||||
STATS.set('ll',lang);
|
STATS.set('ll',lang);
|
||||||
scr.onload = function() {
|
scr.onload = function() {
|
||||||
KIRI.lang.set(lang);
|
KIRI.lang.set(lang);
|
||||||
|
UI.lang();
|
||||||
init_one();
|
init_one();
|
||||||
};
|
};
|
||||||
scr.onerror = function(err) {
|
scr.onerror = function(err) {
|
||||||
|
|
@ -2546,17 +2560,7 @@
|
||||||
// set to browser default which will be overridden
|
// set to browser default which will be overridden
|
||||||
// by any future script loads (above)
|
// by any future script loads (above)
|
||||||
KIRI.lang.set();
|
KIRI.lang.set();
|
||||||
|
UI.lang();
|
||||||
// update static html elements with language overrides
|
|
||||||
for (let el of [...DOC.querySelectorAll("[lk]")]) {
|
|
||||||
let key = el.getAttribute('lk');
|
|
||||||
let val = LANG[key];
|
|
||||||
if (val) {
|
|
||||||
el.innerText = val;
|
|
||||||
} else {
|
|
||||||
console.log({missing_ln: key});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// schedule init_one to run after all page content is loaded
|
// schedule init_one to run after all page content is loaded
|
||||||
// unless a languge script is loading first, in which case it
|
// unless a languge script is loading first, in which case it
|
||||||
|
|
|
||||||
|
|
@ -1236,10 +1236,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCode(code, type) {
|
function loadCode(code, type) {
|
||||||
|
API.event.emit("code.load", {code, type});
|
||||||
setViewMode(VIEWS.PREVIEW);
|
setViewMode(VIEWS.PREVIEW);
|
||||||
setOpacity(0);
|
setOpacity(0);
|
||||||
|
|
||||||
API.event.emit("code.load", {code, type});
|
|
||||||
KIRI.client.parse({code, type, settings}, progress => {
|
KIRI.client.parse({code, type, settings}, progress => {
|
||||||
API.show.progress(progress, "parsing");
|
API.show.progress(progress, "parsing");
|
||||||
}, (layers, maxSpeed) => {
|
}, (layers, maxSpeed) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue