123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- !(function (window) {
- var env = {};
- window.env = env;
- checkPlatform(env);
- // var isCN = checkIsChinese();
- // var isRU = checkIsRU();
- // initTitle(isCN);
- // initSplash(isCN, isRU);
- 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';
- if (window.__wxjs_environment === 'miniprogram') {
- document.title = ' ';
- }
- }
- function initSplash(isCN, isRU) {
- var splash = document.getElementsByClassName('splash')[0];
- if (!splash) return;
- if (isCN) {
- splash.classList.add('splash_cn');
- return;
- }
- if (isRU) {
- splash.classList.add('splash_ru');
- return;
- }
- splash.classList.add('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();
- return lang === 'zh';
- }
- // 监听storage 关闭当前标签页
- window.addEventListener('storage', function (event) {
- if (event.key === 'closeOtherTabs' && event.newValue === 'true') {
- window.close();
- }
- });
- // 关闭其他标签页
- window.closeOtherTabs = function () {
- localStorage.setItem('closeOtherTabs', 'true');
- setTimeout(function () {
- localStorage.setItem('closeOtherTabs', 'false');
- }, 100);
- };
- // define for fis_lib_media_rt
- window.getIframe = function (id) {
- return document.getElementById(id);
- };
- })(window);
|