start grid

This commit is contained in:
2023-04-02 23:54:41 +08:00
parent 4e230ed7e7
commit c44aaf5177
8 changed files with 649 additions and 25 deletions

View File

@ -45,8 +45,7 @@ function getStorageKey(lgid) {
return `res_${lgid}`;
}
async function doRefreshLgres(template) {
template ??= '';
async function doRefreshLgres(template = '') {
const lgid = getCurrentLgId();
const r = await get(`language/${lgid}${template}`);
const dict = await r.json();
@ -81,7 +80,6 @@ function getLanguage(lgres, key, defaultValue) {
}
function applyLanguage(dom, result) {
dom ??= document.body;
for (let text of dom.querySelectorAll('[data-lgid]')) {
const key = text.dataset.lgid;
if (text.tagName === 'INPUT') {
@ -100,8 +98,7 @@ function applyLanguage(dom, result) {
}
}
async function init(dom, options) {
options ??= {};
async function init(dom = document.body, options = {}) {
const lgid = getCurrentLgId();
let lgres = localStorage.getItem(getStorageKey(lgid));
let result;