| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- 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();
- }
|