!(function (window) { var env = {}; window.env = env; checkPlatform(env); var isCN = checkIsChinese(); initTitle(isCN); initSplash(isCN); function hideLoading() { var url = window.location.href; if (url.indexOf("?") > -1) { console.log('hide splash'); var splash = document.getElementsByClassName("splash")[0]; setTimeout(function () { document.body.style.backgroundColor = "white"; splash.style.display = "none"; splash.style.zIndex = 0; }); console.log('no hideLoading'); var loading = document.getElementsByClassName("full-screen-center")[0]; setTimeout(function () { loading.style.zIndex = 1003; }); return; } console.log('hideLoading'); var loading = document.getElementsByClassName("full-screen-center")[0]; setTimeout(function () { loading.style.zIndex = 0; }); } hideLoading(); function initTitle(isCN) { document.title = isCN ? "杏聆荟" : "Flyinsono"; } function initSplash(isCN) { var splash = document.getElementsByClassName('splash')[0]; if (!splash) return; splash.classList.add(isCN ? 'splash_cn' : 'splash_en'); } function checkPlatform(target) { // injectWinTest(); var shell = window["FisShellApi"]; if (shell) { target.platform = 'shell'; shell.getPlatformName().then(function (res) { target.platform = res; }); } else { target.platform = 'Web'; } } /// inject `FisShellApi` for debug function injectWinTest() { window["FisShellApi"] = { writeLog: async (text) => { console.log(text); }, getPlatformName: async () => "Win", setTitle: async (title) => { console.log(`Set title - ${title}`); }, }; } function checkIsChinese() { var lang = navigator.language.split('-')[0].toLocaleLowerCase(); // var storeLocale = localStorage['flutter.store_app_locale']; // if (storeLocale != null && storeLocale.length) { // try { // var arr = JSON.parse(storeLocale); // if (arr && arr.length === 2) { // lang = arr[0].toLocaleLowerCase(); // } // } catch (error) { } // } return lang === 'zh'; } })(window);