// ==UserScript== // @name 🍀广西公需课|广西专业技术人员继续教育信息管理系统|自动看课换课+自动答题(免费版)|脚本使用说明:http://doc.zhanyc.cn/pages/gxgxk/ // @namespace free // @version 1.0 // @description 当前是免费版本,可免费使用1倍速视频自动播放、限量自动看课换课、每日限量自动答题。如需秒过视频、极速答题、自动答题交卷、全自动无人值守等高级功能需升级VIP版本解锁 // @include *://*116.252.25.150:8081/* // @include *://*116.252.25.150/* // @include *://*.gx12333.net/* // @include *://*.gxzf.gov.cn/* // @include *://*gx12333.net* // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @run-at document-end // @require https://scriptcat.org/lib/8488/jquery-2.2.4.min.js/jquery-2.2.4.min.js.js?sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB // @connect m.zhanyc.cn // @antifeature payment // @license Creative Commons // ==/UserScript== (function () { let $jq = $; unsafeWindow.$jq = $; let docUrl = "http://doc.zhanyc.cn/pages/gxgxk/"; let apiBase = "https://m.zhanyc.cn/api"; let siteName = "广西公需课"; // 额度计算配置,避免在代码中直接写明限制数量 let quotaConf = { v: "20261122", k: 0x2F1E, m: [3, 5, 7, 11, 13, 17] }; let pageState = { lastUrl: "", videoTimer: null, waitTime: 0, lastVideoTime: null, stuckCount: 0, jumping: false, videoCounted: false, listClicking: false, examRunning: false, examFinished: false, answeredCount: 0, dailyRemaining: null, answerLimitReached: false, unansweredStop: false }; let gxTool = { async init() { console.log("%c 免费版脚本启动", "background:rgb(0,0,0);color:#fff"); gxTool.showGuidePanel(); gxTool.registerMenu(); gxTool.watchUrl(); gxTool.runByUrl(location.href); }, // 监听地址变化,切换页面时重新执行对应逻辑 watchUrl() { pageState.lastUrl = location.href; setInterval(() => { if (pageState.lastUrl !== location.href) { pageState.lastUrl = location.href; gxTool.runByUrl(location.href); } }, 500); }, runByUrl(url) { clearInterval(pageState.videoTimer); pageState.videoTimer = null; pageState.waitTime = 0; let cur = (url || location.href).toLowerCase(); if (cur.indexOf("/study/watch") != -1) { gxTool.handleVideoPage(); } else if (cur.indexOf("/study/study/class/detail") != -1) { gxTool.handleCourseList(); } else if (cur.indexOf("/study/exam/examsuccess") != -1) { gxTool.handleExamSuccess(); } else if (cur.indexOf("/study/exam/exam") != -1) { gxTool.handleExamPage(); } else if (cur.indexOf("/exam/detail") != -1) { gxTool.handleExamDetail(); } else if (cur.indexOf("/recommendtopic/detail") != -1) { gxTool.saveGM("gxFreeListUrl", location.href); gxTool.updateGuideTip("已记录当前课程列表地址"); } else { gxTool.updateGuideTip("当前页面已就绪"); } }, // ---------------------- 视频学习 ---------------------- handleVideoPage() { if (pageState.videoTimer != null) return; gxTool.validateVideoAccess(() => { gxTool.startVideoLoop(); }); }, // 视频额度校验(分层调用) validateVideoAccess(callback) { let current = gxTool.getDoneVideoCount(); let limit = gxTool.videoQuota(); gxTool.checkVideoLimitStatus(current, limit, callback); }, checkVideoLimitStatus(current, limit, callback) { let status = gxTool.calcLimitStatus(current, limit); if (status.allowed) { gxTool.updateGuideTip(`已学习 ${current}/${limit} 个视频`); callback(); } else { gxTool.handleLimitExceeded(status); } }, calcLimitStatus(current, limit) { let diff = limit - current; return { allowed: diff > 0, remaining: Math.max(0, diff), current: current, total: limit }; }, handleLimitExceeded(status) { let msgData = gxTool.buildLimitMsg(status); gxTool.displayLimitWarning(msgData); }, buildLimitMsg(status) { return { title: gxTool.formatLimitTitle(status), content: gxTool.formatLimitContent(status) }; }, formatLimitTitle(status) { let titles = ["免费额度已用完", "试用次数已耗尽", "体验次数已达上限"]; return titles[status.total % titles.length]; }, formatLimitContent(status) { let templates = [ "免费版本可自动学习前{total}个视频,当前免费额度已用完。VIP版本可秒过视频、极速答题并自动交卷,升级后继续使用。", "当前免费版本支持{total}个视频自动学习,您的额度已用完。升级VIP可秒过视频、不限答题并自动交卷。", "体验次数{total}次已用完,VIP版本可秒过视频、极速答题,自动答题并交卷。" ]; let idx = (status.total + status.remaining) % templates.length; return templates[idx].replace("{total}", status.total); }, displayLimitWarning(msgData) { gxTool.updateGuideTip(msgData.title); gxTool.showVipUpgradeBox(msgData.title, msgData.content); }, startVideoLoop() { pageState.lastVideoTime = null; pageState.stuckCount = 0; pageState.videoCounted = false; pageState.jumping = false; pageState.videoTimer = setInterval(() => { gxTool.runVideoLoop(); }, 2000); }, async runVideoLoop() { try { if (pageState.waitTime > 0) { pageState.waitTime -= 2; return; } let video = $("video")[0]; if (!video) { return; } if ($(".play.xg-icon-play:visible").length > 0) { $(".play.xg-icon-play:visible").parent().click(); return; } if ($("xg-start.xgplayer-start:visible").length > 0) { $("xg-start.xgplayer-start:visible").click(); return; } // 免费版本固定1倍速,不提供加速 video.volume = 0; if (video.playbackRate != 1) video.playbackRate = 1; let cur = video.currentTime || 0; let total = video.duration || 0; $("title").text(`进度:${cur.toFixed(0)}/${total.toFixed(0)}`); gxTool.updateGuideTip(`视频播放中(1倍速) 进度:${cur.toFixed(0)}/${total.toFixed(0)}`); // 卡死检测 if (pageState.lastVideoTime == cur) { pageState.stuckCount += 2; if (pageState.stuckCount >= 60 && !pageState.jumping) { pageState.jumping = true; pageState.waitTime = 20; gxTool.notify("视频进度长时间未变化,准备返回课程列表", 5000); clearInterval(pageState.videoTimer); pageState.videoTimer = null; gxTool.backToList(true).then((moved) => { pageState.jumping = false; if (!moved) gxTool.startVideoLoop(); }); return; } } else { pageState.lastVideoTime = cur; pageState.stuckCount = 0; } // 结束检测 if (total > 0 && cur + 5 >= total) { pageState.waitTime = 15; gxTool.notify("视频即将结束,等待下一步操作(VIP版本可秒过视频)", 5000); gxTool.onVideoFinish(); clearInterval(pageState.videoTimer); pageState.videoTimer = null; return; } if (video.paused) { gxTool.playVideo(video); } } catch (e) { console.error("视频循环异常", e); } }, playVideo(video) { try { video.volume = 0; setTimeout(() => { video.play(); }, 200); } catch (e) { console.error(e); } }, // 视频学习完成处理(分层调用) onVideoFinish() { if (pageState.videoCounted) return; pageState.videoCounted = true; gxTool.processVideoCompletion(); }, processVideoCompletion() { let data = gxTool.incrementVideoCount(); gxTool.displayVideoProgress(data); gxTool.checkPostVideoAction(data); }, incrementVideoCount() { let current = gxTool.getDoneVideoCount() + 1; gxTool.saveDoneVideoCount(current); return { current: current, max: gxTool.videoQuota() }; }, displayVideoProgress(data) { let msg = gxTool.buildProgressMsg(data); gxTool.updateGuideTip(`已学习 ${data.current}/${data.max} 个视频`); gxTool.notify(msg, 5000); }, buildProgressMsg(data) { let formats = [ "当前已学习 {current}/{max} 个视频", "已完成 {current}/{max} 个视频学习", "学习进度 {current}/{max}" ]; let idx = (data.current + data.max) % formats.length; return formats[idx].replace("{current}", data.current).replace("{max}", data.max); }, checkPostVideoAction(data) { let action = gxTool.determineNextAction(data); gxTool.executeNextAction(action); }, determineNextAction(data) { if (data.current >= data.max) { return { type: "showVip", delay: 1000 }; } return { type: "goList", delay: 3000 }; }, executeNextAction(action) { setTimeout(() => { if (action.type === "showVip") { gxTool.triggerVipUpgradePrompt(); } else { gxTool.backToList(true); } }, action.delay); }, triggerVipUpgradePrompt() { let promptData = gxTool.buildVipPromptData(); gxTool.displayLimitWarning(promptData); }, buildVipPromptData() { let max = gxTool.videoQuota(); let titles = ["免费额度已用完", "试用次数已耗尽", "体验次数已达上限"]; let contents = [ "免费脚本可自动学习前{max}个视频,目前免费额度已经用完。VIP版本可秒过视频、极速答题并自动交卷,请升级后继续使用。", "当前免费版本支持{max}个视频自动学习,您的额度已用完。升级VIP后可秒过视频、极速答题并自动答题交卷。" ]; let titleIdx = max % titles.length; let contentIdx = (max + 1) % contents.length; return { title: titles[titleIdx], content: contents[contentIdx].replace("{max}", max) }; }, async backToList(ask) { let url = gxTool.getGM("gxFreeListUrl", ""); if (!url) { gxTool.notify("未记录课程列表地址,请手动返回课程列表页面", 5000); return false; } if (ask) { let ok = await gxTool.askNextStep("准备前往课程列表页面,继续学习下一个视频", 5000); if (!ok) { gxTool.updateGuideTip("已取消自动换课"); return false; } } top.location.href = url; return true; }, // ---------------------- 课程列表 ---------------------- async handleCourseList() { gxTool.saveGM("gxFreeListUrl", location.href); try { await gxTool.waitFor(() => $(".lesson-list-item").length > 0, 500, 60); } catch (e) { return; } await gxTool.sleep(500); let done = gxTool.getDoneVideoCount(); let max = gxTool.videoQuota(); gxTool.updateGuideTip(`已学习 ${done}/${max} 个视频`); let status = gxTool.calcLimitStatus(done, max); if (!status.allowed) { gxTool.handleLimitExceeded(status); return; } if (pageState.listClicking) return; let $target = null; $(".lesson-list-item").each((i, el) => { if ($(el).find("button").text().indexOf("已通过") != -1) { return true; } $target = $(el); return false; }); if (!$target) { gxTool.updateGuideTip("视频已全部学完,请手动进入考试"); gxTool.notify("视频已全部学完,请手动进入考试页面,脚本会自动答题(VIP版本可极速答题并自动交卷)", 6000); return; } pageState.listClicking = true; let ok = await gxTool.askNextStep("3秒后打开下一个视频开始自动学习", 3000); if (!ok) { pageState.listClicking = false; gxTool.updateGuideTip("已取消自动换课"); return; } gxTool.notify("正在打开下一个视频", 3000); $target.find(".lesson-button button").click(); }, // ---------------------- 考试相关 ---------------------- async handleExamDetail() { try { await gxTool.waitFor(() => gxTool.findElByText($("button"), "进入考试") != null, 500, 30); } catch (e) { return; } let ok = await gxTool.askNextStep("3秒后进入考试", 3000); if (!ok) return; let $btn = gxTool.findElByText($("button"), "进入考试"); if ($btn) $btn.click(); }, async handleExamSuccess() { try { await gxTool.waitFor(() => gxTool.findElByText($("button"), "返回") != null, 500, 20); } catch (e) { return; } await gxTool.sleep(1000); let $btn = gxTool.findElByText($("button"), "返回"); if ($btn) $btn.click(); }, handleExamPage() { if (pageState.examRunning || pageState.examFinished) return; pageState.examRunning = true; gxTool.autoAnswerFlow().catch((e) => { console.error("自动答题异常", e); }).finally(() => { pageState.examRunning = false; }); }, async autoAnswerFlow() { try { await gxTool.waitFor(() => $(".question_title div").text().trim() != "", 500, 30); } catch (e) { gxTool.updateGuideTip("未检测到考试题目"); return; } let quota = gxTool.answerQuota(); gxTool.updateGuideTip("检测到考试页面,准备自动答题"); let ok = await gxTool.askNextStep(`免费版本每日可自动答题${quota}题,如需极速答题、自动答题交卷请升级VIP版本;3秒后开始自动答题`, 3000); if (!ok) { gxTool.updateGuideTip("已取消自动答题"); return; } pageState.answeredCount = 0; pageState.answerLimitReached = false; await gxTool.answerPaperLoop(quota); pageState.examFinished = true; }, async answerPaperLoop(quota) { let guard = 0; let stopReason = ""; while (guard++ < 300) { let title = $(".question_title div").text().trim(); if (!title) { await gxTool.sleep(500); if (guard > 60) break; continue; } let qa = gxTool.collectQuestionData(title); let result = null; try { result = await gxTool.queryFreeAnswer([qa]); } catch (e) { gxTool.notify("查题失败:" + ((e && e.message) || "网络异常"), 5000); stopReason = "error"; break; } let resList = (result && result.list) || (Array.isArray(result) ? result : []); let indexArr = resList[0] || []; pageState.unansweredStop = indexArr.length == 0; if (indexArr.length > 0) { await gxTool.applyAnswer(indexArr); pageState.answeredCount++; gxTool.updateGuideTip(`正在自动答题 已答${pageState.answeredCount}/${quota}题`); gxTool.notify("正在答题", 2000); let $submit = gxTool.findElByText($("button"), "提交答案"); if ($submit) { await gxTool.sleep(200); $submit.click(); } } else { gxTool.notify("未查询到该题答案,请手动作答", 4000); } if (gxTool.judgeAnswerRemaining(result)) { stopReason = "limit"; break; } if (pageState.answeredCount >= quota) { pageState.answerLimitReached = true; gxTool.updateGuideTip(`今日免费答题${quota}题已用完`); gxTool.showAnswerLimitBox(); stopReason = "limit"; break; } let advanced = await gxTool.goNextQuestion(title); if (!advanced) { stopReason = pageState.unansweredStop ? "noAnswer" : "done"; break; } await gxTool.sleep(300); } if (pageState.answerLimitReached) return; if (stopReason == "noAnswer") { gxTool.updateGuideTip("遇到未收录题目,脚本已暂停"); gxTool.notify("遇到未查询到答案的题目,请手动作答后手动交卷", 0); return; } if (stopReason == "error") { gxTool.updateGuideTip("查题异常,请手动检查答题结果"); return; } gxTool.finishAnswerTip(); }, collectQuestionData(title) { let optTxtList = []; $(".question_answer_list label").each((i, el) => { let txt = $(el).text().trim(); txt = txt.replace(/^\w *(\.|、)/, "").trim(); optTxtList.push(txt); }); return { title: title, optTxtList: optTxtList }; }, // 清理当前题目已选中的选项,再按答案索引点击 async applyAnswer(indexArr) { let $labels = $(".question_answer_list label"); let $checked = []; $labels.each((i, el) => { if ($(el).is(".is-checked") || $(el).find(".is-checked").length > 0 || $(el).find("input").is(":checked")) { $checked.push($(el)); } }); for (let i = 0; i < $checked.length; i++) { $checked[i].click(); await gxTool.sleep(100); } for (let i = 0; i < indexArr.length; i++) { let $el = $labels.eq(indexArr[i]); if (!$el.length) continue; if ($el.is(".is-checked") || $el.find(".is-checked").length > 0 || $el.find("input").is(":checked")) continue; $el[0].click(); await gxTool.sleep(100); } }, // 切换到下一题,返回是否切换成功 async goNextQuestion(oldTitle) { await gxTool.sleep(1200); let title = $(".question_title div").text().trim(); if (!title) return false; if (title != oldTitle) return true; let $next = gxTool.findElByText($("button"), "下一题"); if (!$next) return false; if ($next.is(".is-disabled") || $next.is(":disabled")) return false; $next[0].click(); try { await gxTool.waitFor(() => $(".question_title div").text().trim() != oldTitle, 400, 10); } catch (e) { return false; } return true; }, finishAnswerTip() { let msg = pageState.answeredCount > 0 ? `自动答题已完成(本次作答${pageState.answeredCount}题),请手动交卷。VIP版本可极速答题并自动答题交卷` : "自动答题已结束,请手动检查并交卷。VIP版本可极速答题并自动答题交卷"; gxTool.updateGuideTip("答题已完成,请手动交卷"); gxTool.notify(msg, 0); }, // 判断今日免费答题剩余数量 judgeAnswerRemaining(result) { if (!result) return false; let remaining = Number(result.remaining); if (isNaN(remaining)) return false; let limit = Number(result.limit); if (isNaN(limit)) limit = gxTool.answerQuota(); pageState.dailyRemaining = remaining; gxTool.updateGuideTip(`已答${pageState.answeredCount}题 · 今日剩余免费答题:${remaining}/${limit}题`); if (remaining <= 0) { pageState.answerLimitReached = true; gxTool.showAnswerLimitBox(); return true; } return false; }, // ---------------------- 题库接口 ---------------------- requestApi(path, data) { return new Promise((resolve, reject) => { let header = { "Content-Type": "application/json" }; let token = gxTool.getGM("token", ""); if (token) header["X-Access-Token"] = token; GM_xmlhttpRequest({ method: "post", url: apiBase + path, data: JSON.stringify(data), headers: header, responseType: "json", onload: function (res) { let body = res.response; try { if (typeof body == "string") body = JSON.parse(body); } catch (e) { } if (!body || body.code != 200) { return reject(body || { message: "请求失败" }); } resolve(body.result); }, onerror: function (err) { reject(err); } }); }); }, // 免费查题接口,服务端限制每日答题数量 queryFreeAnswer(qaArr) { let list = qaArr.map((item) => { let title = (item.title + "").trim(); if (title.length > 499) title = title.substring(0, 499); return { title: title, optTxtList: (item.optTxtList || []).map((a) => (a + "").trim()) }; }); return gxTool.requestApi("/business/common/queryHashAnswer", { source: siteName, list: list }); }, // ---------------------- 额度计算 ---------------------- quotaSeed() { return quotaConf; }, digitSum(str) { let sum = 0; for (let i = 0; i < str.length; i++) { sum += parseInt(str.charAt(i)) || 0; } return sum; }, // 视频免费额度(加密计算,修改配置会导致结果变化) videoQuota() { let cfg = gxTool.quotaSeed(); let base = gxTool.digitSum(cfg.v) % (cfg.m.length + 7); let table = [7, 5, 6, 3, 9, 8, 4]; let check = (cfg.k ^ 0x2F1E) === 0 ? 0 : -1; return table[base] + check; }, // 每日免费答题额度 answerQuota() { let cfg = gxTool.quotaSeed(); return gxTool.digitSum(cfg.v) + (0x2 << 1); }, getDoneVideoCount() { let val = Number(GM_getValue("gxFreeDoneVideos", 0)); if (isNaN(val) || val < 0) return 0; return val; }, saveDoneVideoCount(val) { GM_setValue("gxFreeDoneVideos", val); }, // ---------------------- 悬浮面板 ---------------------- showGuidePanel() { if ($("#gxFreePanel").length > 0) return; let $panel = $(`
免费版本提示 ×
免费功能:1倍速自动看课换课、每日限量自动答题
VIP功能:秒过视频 | 极速答题 | 自动答题并交卷 | 全自动无人值守
如需使用全功能版本,请通过下方地址安装VIP版本激活后可使用
脚本已就绪
点击查看使用说明
👉点击升级VIP版本
`); $("body").append($panel); $("#gxFreeClose").on("click", function () { $("#gxFreePanel").remove(); }); $("#gxFreeDocBtn").on("click", function () { gxTool.openDoc(); }); gxTool.initPanelDrag(".gx-free-title", "#gxFreePanel"); }, initPanelDrag(handleSelector, boxSelector) { let $handle = $(handleSelector); let $box = $(boxSelector); let isDragging = false; let startX, startY, initialLeft, initialTop; $handle.on("mousedown", function (e) { if ($(e.target).is("#gxFreeClose")) return; isDragging = true; startX = e.clientX; startY = e.clientY; let rect = $box[0].getBoundingClientRect(); $box.css({ top: rect.top + "px", bottom: "auto" }); initialLeft = rect.left; initialTop = rect.top; $box.css("transition", "none"); e.preventDefault(); }); $(document).on("mousemove", function (e) { if (!isDragging) return; let deltaX = e.clientX - startX; let deltaY = e.clientY - startY; $box.css({ left: (initialLeft + deltaX) + "px", top: (initialTop + deltaY) + "px" }); }); $(document).on("mouseup", function () { if (isDragging) { isDragging = false; } }); }, updateGuideTip(msg) { let $status = $("#gxFreeStatus"); if ($status.length > 0) $status.text(msg); }, notify(msg, time) { if (time == null) time = 3000; $(".gx-free-toast").remove(); let closeHtml = time > 0 ? "" : `×`; let $toast = $(`
${msg}${closeHtml}
`); $("body").append($toast); if (time > 0) { setTimeout(() => { $toast.remove(); }, time); } else { $toast.find(".gx-toast-close").on("click", function () { $toast.remove(); }); } console.log("%c " + msg, "background:rgb(0,255,0);color:#000"); }, // 可取消的下一步提示,超时自动执行 askNextStep(msg, time) { if (time == null) time = 3000; return new Promise((resolve) => { $("#gxFreeAsk").remove(); let sec = Math.max(1, Math.ceil(time / 1000)); let $box = $(`
🔔 脚本提示
${msg}
取消执行 立即执行(${sec}秒)
`); $("body").append($box); let finished = false; let timer = null; let finish = (val) => { if (finished) return; finished = true; clearInterval(timer); $("#gxFreeAsk").remove(); resolve(val); }; let remain = sec; timer = setInterval(() => { remain--; if (remain <= 0) { finish(true); return; } $box.find(".gx-ask-ok").text(`立即执行(${remain}秒)`); }, 1000); $box.find(".gx-ask-cancel").on("click", function () { finish(false); }); $box.find(".gx-ask-ok").on("click", function () { finish(true); }); }); }, showAnswerLimitBox() { if ($("#gxAnswerLimitBox").length > 0) return; let $box = $(`
🔔 免费答题数量提醒 ×
今天免费答题数量已经达到上限,如需极速答题、自动答题交卷请升级VIP版本,或者改日继续使用。
升级VIP版本 我知道了
`); $("body").append($box); $box.find(".gx-limit-close, .gx-limit-close-x").on("click", function () { $box.remove(); }); }, showVipUpgradeBox(title, content) { if ($("#gxVipBox").length > 0) return; let $box = $(`
🔔 ${title} ×
${content}
立即升级VIP版本
VIP特权: 免费维护 | 不限制电脑 | 秒过视频 | 极速答题 | 自动答题交卷
`); $("body").append($box); $box.find(".gx-vip-close").on("click", function () { $box.remove(); }); }, // ---------------------- 菜单与通用方法 ---------------------- registerMenu() { GM_registerMenuCommand("免费版使用说明", gxTool.openDoc); GM_registerMenuCommand("显示免费版面板", gxTool.showGuidePanel); GM_registerMenuCommand("继续考试答题", gxTool.restartExamAnswer); GM_registerMenuCommand("联系脚本客服", gxTool.linkAuthor); }, restartExamAnswer() { if (pageState.examRunning) { gxTool.notify("答题进行中,请稍候", 3000); return; } if ($(".question_title div").text().trim() == "") { gxTool.notify("当前页面未检测到考试题目", 4000); return; } pageState.examFinished = false; gxTool.handleExamPage(); }, openDoc() { window.open(docUrl); }, linkAuthor() { window.open("http://doc.zhanyc.cn/contact-me/"); }, getGM(key, def) { return GM_getValue(key, def); }, saveGM(key, val) { return GM_setValue(key, val); }, findElByText(query, text, visible) { if (visible == null) visible = true; text = text.trim(); let $el = null; $(query).each((i, el) => { if (visible && !$(el).is(":visible")) { return true; } if ($(el).text().trim() == text) { $el = $(el); return false; } }); return $el; }, sleep(ms) { return new Promise((resolve) => { setTimeout(() => { resolve(); }, ms); }); }, waitFor(fun, interval, timeout) { if (interval == null) interval = 1000; if (timeout == null) timeout = 30; return new Promise((resolve, reject) => { let left = timeout * 1000; try { if (fun()) return resolve(); } catch (e) { console.error(e); } let timer = setInterval(() => { try { if (timeout != -1) { left -= interval; if (left < 0) { clearInterval(timer); return reject(); } } if (fun()) { clearInterval(timer); return resolve(); } } catch (e) { console.error(e); } }, interval); }); } }; setTimeout(() => { if (typeof (zfk) == 'undefined' && !unsafeWindow.zfk) { gxTool.init(); } else { console.log('skip init'); } }, 3000); if (!unsafeWindow.gxTool) unsafeWindow.gxTool = gxTool; })();