import i18n from './locales/index'; import { LOCAL_AREA_ID, LOCAL_WD_PASS, LOCAL_WD_PASS_SET_TIME } from "@constants/localkey"; import { decrypt, encrypt, getUrlParamsAsJsonManual, localStorageGet, localStorageSet } from "@utils/helpers"; // import symbol from "@assets/symbol-defs.svg"; // import symbol_m from "@assets/symbol-mobile.svg"; import area from "@db/area"; import tracker from "@utils/adjust"; global.tracker = tracker; global.enterRechargeType = 0; // 进入充值界面的状态 global.adjustId = 0; global.i18n = i18n; // global.symbol=symbol; // global.symbol_m=symbol_m; global.CASH_BASE = 100; global.DOLLAR = "R$"; global.currency = ""; global.dispatch = null; global.curGoods = null; global.curPayUrl = null; global.isNewUser = false; /// 返回忽略弹窗 global.ignorePopup = false; global.newUserPrompted = false; ///免费提现额度 global.freeTxTotal = 40; global.bindPhoneCallback = null; global.msgBox = null; global.msgBoxShow = (params) => { if (global.msgBox) global.msgBox.show(params); }; global.msgBoxHide = () => { if (global.msgBox) global.msgBox.hide(); }; global.authLockPath = null; global.device = "mobile"; global.width = 100; global.height = 100; global.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); //游客id 指纹 global.BFP = null; //指纹Fingerprint2 global.FF = null; //wd pass global.getWDPass = () => { let pass = localStorageGet(LOCAL_WD_PASS, ""); if (pass != null && pass !== "") { pass = decrypt(pass); let lsettime = localStorageGet(LOCAL_WD_PASS_SET_TIME, ""); if (lsettime != null) { lsettime = Number(lsettime); let now = Date.now(); let during = now - lsettime; //10m let deadline = 10 * 60 * 1000; if (during < deadline) return pass; else { localStorageSet(LOCAL_WD_PASS, ""); localStorageSet(LOCAL_WD_PASS_SET_TIME, ""); } } } return ""; }; global.setWDPass = (value) => { if (value == null) return; if (value !== "") { value = encrypt(value); } localStorageSet(LOCAL_WD_PASS, value); localStorageSet(LOCAL_WD_PASS_SET_TIME, Date.now()); }; global.showDropCoins = () => { if (global.dropCoins) global.dropCoins.show(); }; global.hideDropCoins = () => { if (global.dropCoins) global.dropCoins.hide(); }; global.showMailNew = () => { if (global.mailNew) global.mailNew.show(); }; global.hideMailNew = () => { if (global.mailNew) global.mailNew.hide(); }; global.showInstallBox = () => { if (global.installBox) global.installBox.show(); }; global.hideInstallBox = () => { if (global.installBox) global.installBox.hide(); }; global.showBindPhone = (callback) => { global.bindPhoneCallback = callback; if (global.bindPhone) { global.bindPhone.show(); // adjust 打开绑定手机 global.tracker.trackEvent("enter_bind_phone"); global.tracker.trackEvent("enter_bind_phone_count"); } }; global.hideBindPhone = () => { if (global.bindPhone) global.bindPhone.hide(); }; global.showNewUserPrompt = () => { if (global.newUserPrompt) { global.newUserPrompt.show(); // adjust 打开注册弹窗 global.tracker.trackEvent("enter_register_panel"); } }; global.hideNewUserPrompt = () => { if (global.newUserPrompt) global.newUserPrompt.hide(); }; global.showNewUserBonus = () => { if (global.newUserBonus) { global.newUserBonus.show(); // adjust 打开进入游戏引导 global.tracker.trackEvent("enter_game"); } }; global.hideNewUserBonus = () => { if (global.newUserBonus) global.newUserBonus.hide(); }; global.showBindPrompt = () => { if (global.bindPrompt) global.bindPrompt.show(); }; global.hideBindPrompt = () => { if (global.bindPrompt) global.bindPrompt.hide(); }; global.showGameWithdrawTips = (type = 1) => { ///1.距离提现还差x 2.提现未解锁 3.可提现 if (global.gameWithdrawTips) global.gameWithdrawTips.show(type); }; global.hideGameWithdrawTips = () => { if (global.gameWithdrawTips) global.gameWithdrawTips.hide(); }; global.showWithdrawLimit = () => { if (global.withdrawLimit) { global.withdrawLimit.show(); // adjust 打开进入游戏引导 global.tracker.trackEvent("enter_deposit_panel"); global.tracker.trackEvent("enter_deposit_panel_count"); } }; global.hideWithdrawLimit = () => { if (global.withdrawLimit) global.withdrawLimit.hide(); }; global.showFirstCashoutTips = () => { if (global.firstCashoutTips) global.firstCashoutTips.show(); }; global.hideFirstCashoutTips = () => { if (global.firstCashoutTips) global.firstCashoutTips.hide(); }; global.showProtectReward = () => { if (global.protectReward) global.protectReward.show(); }; global.hideProtectReward = () => { if (global.protectReward) global.protectReward.hide(); }; global.showLoadingCircular = (showMask = false) => { if (global.loadingCircular) global.loadingCircular.show(showMask); }; global.hideLoadingCircular = () => { if (global.loadingCircular) global.loadingCircular.hide(); }; global.showFirstPay = () => { if (global.firstPay) { global.firstPay.show(); // adjust 曝光首充礼包 global.tracker.trackEvent("enter_first_pay"); global.tracker.trackEvent("enter_first_pay_count"); } }; global.hideFirstPay = () => { if (global.firstPay) global.firstPay.hide(); }; global.showFirstDepositTips = () => { if (global.firstDepositTips) global.firstDepositTips.show(); }; global.hideFirstDepositTips = () => { if (global.firstDepositTips) global.firstDepositTips.hide(); }; global.showMusicSettings = () => { if (global.musicSettings) global.musicSettings.show(); }; global.hideMusicSettings = () => { if (global.musicSettings) global.musicSettings.hide(); }; global.showCheckIn = () => { if (global.checkIn) global.checkIn.show(); }; global.hideCheckIn = () => { if (global.checkIn) global.checkIn.hide(); }; global.showAreaSelect = (allowClose = true) => { if (global.areaSelect) global.areaSelect.show(allowClose); }; global.hideAreaSelect = () => { if (global.areaSelect) global.areaSelect.hide(); }; global.showHolidaysGift = () => { if (global.holidaysGift) global.holidaysGift.show(); }; global.hideHolidaysGift = () => { if (global.holidaysGift) global.holidaysGift.hide(); }; global.showHolidaysAct = () => { if (global.holidaysAct) global.holidaysAct.show(); }; global.hideHolidaysAct = () => { if (global.holidaysAct) global.holidaysAct.hide(); }; global.showCommonTextTip = (textArr) => { if (global.commonTextTip) global.commonTextTip.show(textArr); }; global.hideCommonTextTip = () => { if (global.commonTextTip) global.commonTextTip.hide(); }; global.checkDomainArea = () => { let areaID = 0; let host = window.location.host; for (let i = 0; i < area.length; i++) { let item = area[i]; if (item) { let code = item.code; if (host.startsWith(code)) { areaID = item.id; break; } } } return areaID; }; global.getLocalAreaID = () => { //let areaID = Number(localStorageGet(LOCAL_AREA_ID, 0)); let areaID = Number(localStorageGet(LOCAL_AREA_ID, 1)); if (areaID === 0) { let dAreaID = global.checkDomainArea(); if (dAreaID !== 0) { localStorageSet(LOCAL_AREA_ID, dAreaID + ""); areaID = dAreaID; } } return areaID; }; global.setLocalAreaID = (value) => { localStorageSet(LOCAL_AREA_ID, value + ""); window.location.reload(); }; global.getLocalAreaItem = () => { let areaID = global.getLocalAreaID(); for (let i = 0; i < area.length; i++) { let item = area[i]; if (item) { if (item.id === areaID) { return item; } } } return null; }; global.getLocalAreaAlCode = () => { let code = 'en-US'; let item = global.getLocalAreaItem(); if (item) { code = item.alcode; } return code; }; global.showSaveAccount = (info) => { if (global.saveAccount) global.saveAccount.show(info); }; global.hideSaveAccount = () => { if (global.saveAccount) global.saveAccount.hide(); }; global.showBonusPack = () => { if (global.bonusPack) global.bonusPack.show(); }; global.hideBonusPack = () => { if (global.bonusPack) global.bonusPack.hide(); }; //初始化urlvars global.checkUrlvars = () => { let urlvars = localStorageGet("urlvars", ""); if (urlvars == null || urlvars === "") { let json = getUrlParamsAsJsonManual(); if (json != null) { urlvars = JSON.stringify(json); localStorageSet("urlvars", urlvars); } } else { let json = getUrlParamsAsJsonManual(); if (json != null) { let orijson = JSON.parse(urlvars); orijson = Object.assign({}, orijson, json); urlvars = JSON.stringify(orijson); localStorageSet("urlvars", urlvars); } } return urlvars; }; global.getUrlvars = () => { return localStorageGet("urlvars", ""); }; global.showDownBox = () => { if (global.downloadBox) global.downloadBox.show(); }; global.hideDownBox = () => { if (global.downloadBox) global.downloadBox.hide(); }; global.showShortcutGuide = () => { if (global.shortcutGuide) global.shortcutGuide.show(); }; global.hideShortcutGuide = () => { if (global.shortcutGuide) global.shortcutGuide.hide(); }; global.updateGameScore = (score) => { if (global.onUpdateGameScore) global.onUpdateGameScore(score); }; global.onGameBack = () => { global.authLockPath = null; global.onUpdateGameScore = null; }; global.openRecommandGame = () => { }; global.showExclusiveGift = () => { if (global.exclusiveGift) global.exclusiveGift.show(); }; global.hideExclusiveGift = () => { if (global.exclusiveGift) global.exclusiveGift.hide(); }; global.shwoComebackWithdraw = () => { if (global.comebackWithdraw) global.comebackWithdraw.show(); }; global.hideComebackWithdraw = () => { if (global.comebackWithdraw) global.comebackWithdraw.hide(); }; global.showRecallGift = () => { if (global.recallGift) global.recallGift.show(); }; global.hideRecallGift = () => { if (global.recallGift) global.recallGift.hide(); }; global.showSidebar = () => { if (global.homeSidebar) global.homeSidebar.show(); }; //wd pass var popupFlow = []; global.addPopupFlow = (func) => { popupFlow.push(func); }; global.clearPopupFlow = () => { popupFlow = []; }; global.isEmptyPopups = () => { return popupFlow.length === 0; }; global.openNextPopup = async () => { while (popupFlow.length > 0) { await Promise.resolve(); const popup = popupFlow.shift(); if (!!popup && popup()) { return; } } }; global.showSecurityScan=()=>{ if (global.securityScan) global.securityScan.show(); }; global.hideSecurityScan = () => { if (global.securityScan) global.securityScan.hide(); } global.showQuickInstall=()=>{ if (global.quickInstall) global.quickInstall.show(); } global.hideQuickInstall = () => { if (global.quickInstall) global.quickInstall.hide(); }