You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
568_Calc/js/loading.js

43 lines
1.4 KiB

// const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
document.onreadystatechange=function () {
if (document.readyState=="complete"){
loadingFade();
}
}
function startLoading() {
const position = document.getElementById('loading');
var loadingBackground=document.getElementById('Calc-loading_bg');
position.style.display = 'block';
loadingBackground.style.opacity=1;
setTimeout(() => loadingFade(), 30000)
}
function loadingFade() {
var opacity=1;
const position = document.getElementById('loading');
var loadingBackground=document.getElementById('Calc-loading_bg');
var time=setInterval(function () {
if (opacity<=0){
clearInterval(time);
position.style.display = 'none';
try{
translate.listener.start();
translate.language.setLocal('chinese_simplified');
translate.setAutoDiscriminateLocalLanguage();
translate.language.setUrlParamControl();
translate.ignore.class.push('notTranslate');
}
catch(e){console.log(e);}
translate.setUseVersion2();
translate.nomenclature.append('chinese_simplified','english',`
568_Calc=568_Calc
`);
translate.execute();
}
loadingBackground.style.opacity=opacity;
opacity-=0.4;
},100);
}