123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- !(function (window) {
- var env = {};
- window.env = env;
- checkPlatform(env);
- var isCN = checkIsChinese();
- initTitle(isCN);
- initSplash(isCN);
- 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);
|