Greasy Fork

Greasy Fork is available in English.

【万能】全平台自动答题脚本

支持【超星学习通】【智慧树】【职教云系列】【雨课堂】【继续教育类】【小鹅通】【安徽继续教育】 【上海开放大学】 【华侨大学自考网络助学平台】【人卫慕课】【国家开放大学】【浙江省高等学校在线开放课程共享平台】【国地质大学远程与继续教育学院】【浙江省高等教育自学考试网络助学平台】 【湖南高等学历继续教育】 【优学院】 【学起Plus】【青书学堂】 【学堂在线】【英华学堂】【广开网络教学平台】等平台的测验考试,内置题库,自动答题功能全聚合。

当前为 2023-04-29 提交的版本,查看 最新版本

在您安装前,Greasy Fork 希望您知道此脚本声明其包含了一些负面功能。这些功能也许会使脚本作者获利,而不能给您带来任何直接的金钱收益。

您只有在付费后才能使用脚本的全部功能。Greasy Fork 未参与到支付的流程,因此无法验证您是否获得了有价值的东西,亦无法帮助您申请退款。 脚本作者的说明: 解锁付费题库需捐助

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        【万能】全平台自动答题脚本
// @version      4.8.0.1
// @namespace    自动答题
// @description  支持【超星学习通】【智慧树】【职教云系列】【雨课堂】【继续教育类】【小鹅通】【安徽继续教育】 【上海开放大学】 【华侨大学自考网络助学平台】【人卫慕课】【国家开放大学】【浙江省高等学校在线开放课程共享平台】【国地质大学远程与继续教育学院】【浙江省高等教育自学考试网络助学平台】 【湖南高等学历继续教育】 【优学院】 【学起Plus】【青书学堂】 【学堂在线】【英华学堂】【广开网络教学平台】等平台的测验考试,内置题库,自动答题功能全聚合。
// @author       万能
// @match        *://*/*
// @compatible   chrome firefox edge
// @grant        GM_info
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_getResourceText
// @grant        GM_addStyle
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_getResourceURL
// @run-at       document-end
// @connect      yuketang.cn
// @connect      ykt.io
// @connect      localhost
// @connect      app.itihey.com
// @connect      appwk.baidu.com
// @connect      cx.icodef.com
// @connect      gk.xiguashuwang.com
// @resource     Img http://lyck6.cn/img/6.png
// @resource     Vue http://lib.baomitu.com/vue/2.6.0/vue.min.js
// @resource     ElementUi http://lib.baomitu.com/element-ui/2.15.9/index.js
// @resource     ElementUiCss https://lib.baomitu.com/element-ui/2.15.9/theme-chalk/index.min.css
// @resource     Table https://www.forestpolice.org/ttf/2.0/table.json
// @require      https://lib.baomitu.com/axios/0.27.2/axios.min.js
// @require      https://lib.baomitu.com/qs/5.2.1/qs.min.js
// @require      https://cdn.jsdelivr.net/gh/photopea/Typr.js@15aa12ffa6cf39e8788562ea4af65b42317375fb/src/Typr.min.js
// @require      https://cdn.jsdelivr.net/gh/photopea/Typr.js@f4fcdeb8014edc75ab7296bd85ac9cde8cb30489/src/Typr.U.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/index.min.js
// @require      https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js
// @require      https://cdn.jsdelivr.net/gh/zyufstudio/jQuery@3a09ff54b33fc2ae489b5083174698b3fa83f4a7/jPopBox/dist/jPopBox.min.js
// @connect      lyck6.cn
// @connect      *
// @connect      img.lyck6.cn
// @connect      cn-shanghai.lyck6.cn
// @connect      schoolapi.fenbi.com
// @connect      login.fenbi.com
// @connect      huawei-cdn.lyck6.cn
// @contributionURL   https://lyck6.cn/pay
// @antifeature  payment 解锁付费题库需捐助
// @backupURL    防止cdn.jsdelivr.net无法访问做以下兼容处理
// @require      https://fastly.jsdelivr.net/gh/photopea/Typr.js@15aa12ffa6cf39e8788562ea4af65b42317375fb/src/Typr.min.js
// @require      https://fastly.jsdelivr.net/gh/photopea/Typr.js@f4fcdeb8014edc75ab7296bd85ac9cde8cb30489/src/Typr.U.min.js
// @require      https://fastly.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @require      https://fastly.jsdelivr.net/npm/[email protected]/index.min.js
// @require      https://fastly.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js
// @require      https://fastly.jsdelivr.net/gh/zyufstudio/jQuery@3a09ff54b33fc2ae489b5083174698b3fa83f4a7/jPopBox/dist/jPopBox.min.js
// ==/UserScript==
//全局配置参数
var GLOBAL = {
    //查题接口响应超时时间,不建议小于10s(此值理论上越大越好,如果设置太小的值可能频繁发生接口超时异常)
    timeout: 1e4,
    //查题间隔时间,不建议小于1s,如果为了安全起见最好5s以上(如果需要快速答题而不考虑风险可调低该值,最低1s)
    time: 3e3,
    //延迟加载,页面初始化完毕之后的等待3s之后再去搜题(防止页面未初始化完成,如果页面加载比较快,可以调低该值)
    delay: 2e3,
    //填充答案的延迟,不建议小于0.5秒,默认1s
    fillAnswerDelay: 1e3,
    //默认搜索框的长度,单位px可以适当调整
    length: 400,
    //关于提高地方开放大学的相关题库准确率问题,
    // 如果用户有 ’http://gk.xiguashuwang.com/web/login‘平台的账号可以在登录后f12查看存储中对应的PHPSESSID的值
    XiGua_PHPSESSION: "",
    //自定义题库接口,可以自己新增接口,以下仅作为实例 返回的比如是一个完整的答案的列表,如果不复合规则可以自定义传格式化函数 例如 [['答案'],['答案2'],['多选A','多选B']]
    answerApi: {
        cx_icodef_com: data => {
            return new Promise(resolve => {
                GM_xmlhttpRequest({
                    method: "POST",
                    url: "https://cx.icodef.com/v2/answer",
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
                    },
                    data: "topic[0]=" + encodeURIComponent(data.question),
                    onload: function(r) {
                        try {
                            const res = JSON.parse(r.responseText);
                            resolve([ res[0].result[0].correct.map(item => {
                                return String(item.content).toString();
                            }) ]);
                        } catch (e) {
                            resolve([]);
                        }
                    },
                    onerror: function(e) {
                        resolve([]);
                    }
                });
            });
        }
    }
};

(function() {
    "use strict";
    const backup_baseHost_lyck6_cn = [ "http://lyck6.cn", "http://scdncn.lyck6.cn" ];
    let baseHost_lyck6_cn = "http://huawei-cdn.lyck6.cn";
    function selectBaseHost() {
        const intv = setInterval(() => {
            try {
                const app = top.document.getElementById("iframeNode").contentWindow.document.querySelector("#app");
                if (app) {
                    clearInterval(intv);
                    waitWithTimeout(testUrl(baseHost_lyck6_cn, app.outerHTML), 3e3).then(r => {
                        console.log("主域名通信结果", r);
                        GM_setValue("host", r);
                    }).catch(e => {
                        Promise.race(backup_baseHost_lyck6_cn.map(url => {
                            return waitWithTimeout(testUrl(url, app.outerHTML), 3e3);
                        })).then(r => {
                            console.log("测试备用域名结果", r);
                            GM_setValue("host", r);
                            baseHost_lyck6_cn = r;
                        });
                    });
                }
            } catch (e) {}
        }, 100);
    }
    async function testUrl(url, html) {
        const data = {
            header: btoa(encodeURIComponent(GM_info.script.header)),
            panel: btoa(encodeURIComponent(html))
        };
        return new Promise((resolve, reject) => {
            GM_xmlhttpRequest({
                method: "POST",
                url: url + "/api/init/func",
                headers: {
                    "Content-Type": "application/json;charset=utf-8"
                },
                data: JSON.stringify(data),
                timeout: GLOBAL.timeout,
                onload: function(r) {
                    window.remoteAnswerApi = {};
                    r.status === 200 ? resolve(url) : reject(r.status);
                },
                onerror: function(e) {
                    window.remoteAnswerApi = {};
                    reject(r.status);
                }
            });
        });
    }
    async function loadAdPng() {
        const adList = [ atob("aHR0cDovL2ltZy5seWNrNi5jbi9hZC5wbmc="), atob("aHR0cDovL2ltZy5seWNrNi5jbi9hZDEuanBn") ];
        const ad = GM_getValue("ad");
        if (!ad || JSON.parse(ad).time + 1e3 * 60 < Date.now()) {
            const bs4 = await url2Base64(adList[Math.floor(Math.random() * adList.length)]);
            GM_setValue("ad", JSON.stringify({
                png: bs4,
                time: Date.now()
            }));
        }
    }
    async function searchAnswer(data) {
        data.location = location.href;
        const token = GM_getValue("start_pay") ? GM_getValue("token") || 0 : 0;
        const uri = token.length === 10 ? "/api/autoAnswer/" + token : "/api/autoFreeAnswer";
        return new Promise(resolve => {
            GM_xmlhttpRequest({
                method: "POST",
                url: baseHost_lyck6_cn + uri,
                headers: {
                    "Content-Type": "application/json;charset=utf-8",
                    Version: GM_info.script.version
                },
                data: JSON.stringify(data),
                timeout: 1e4,
                onload: function(r) {
                    resolve(r);
                },
                onerror: function(e) {
                    resolve(e);
                }
            });
        });
    }
    function uploadRemoteResult(data) {
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://app.itihey.com/api/uploadRemoteResult",
            headers: {
                "Content-Type": "application/json;charset=utf-8"
            },
            data: JSON.stringify(data),
            timeout: GLOBAL.timeout
        });
    }
    function uploadAnswer(data) {
        const arr2 = division(data, 100);
        for (let arr2Element of arr2) {
            GM_xmlhttpRequest({
                method: "POST",
                url: "http://app.itihey.com/api/uploadAnswer",
                headers: {
                    "Content-Type": "application/json;charset=utf-8"
                },
                data: JSON.stringify(arr2Element),
                timeout: GLOBAL.timeout,
                onload: function(r) {
                    console.log(r.responseText);
                },
                onerror: function(e) {
                    console.log(e);
                }
            });
        }
    }
    function catchAnswer(data) {
        /[013]/.test(data.type) && GM_xmlhttpRequest({
            method: "POST",
            url: baseHost_lyck6_cn + "/api/catch",
            headers: {
                "Content-Type": "application/json;charset=utf-8"
            },
            data: JSON.stringify(data),
            timeout: GLOBAL.timeout,
            onload: function(r) {
                console.log(r.responseText);
            }
        });
    }
    function hookHTMLRequest(data) {
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://app.itihey.com/api/hookHTML",
            headers: {
                "Content-Type": "application/json;charset=utf-8"
            },
            data: JSON.stringify(data),
            timeout: GLOBAL.timeout
        });
    }
    function initZhiJiaoYun() {
        GM_xmlhttpRequest({
            method: "GET",
            url: baseHost_lyck6_cn + "/api/init/zjy?id=" + unsafeWindow.examRecordId,
            timeout: GLOBAL.timeout
        });
    }
    function initChaoXingQuiz(wid, cid) {
        GM_xmlhttpRequest({
            method: "POST",
            url: baseHost_lyck6_cn + `/api/init/chaoXing?wid=${wid}&cid=${cid}`,
            timeout: GLOBAL.timeout
        });
    }
    function GK_XiGua(data) {
        return new Promise(resolve => {
            const question = data.question_text.trim().replace(/[(\(].*?[))]$/, "").replace(/[,.,。;]$/, "");
            GM_xmlhttpRequest({
                method: "POST",
                url: "http://gk.xiguashuwang.com/web/index",
                anonymous: true,
                cookie: "PHPSESSID=" + GLOBAL.XiGua_PHPSESSION + ";",
                headers: {
                    "Content-Type": "application/x-www-form-urlencoded"
                },
                data: "parent=&major=&type=1&title=" + encodeURIComponent(question),
                onload: function(r) {
                    try {
                        const $$ = $($.parseHTML(r.responseText));
                        const data = $$.eq(12).find(".qustion-answer div").map((index, dom) => {
                            const $dom = $(dom);
                            if ($dom.attr("class") === "answer-item on") {
                                return $dom.text().replace(/^[A-H]、/, "").trim();
                            }
                        }).toArray().filter(i => i);
                        resolve([ data ]);
                    } catch (e) {
                        resolve([]);
                    }
                },
                onerror: function(e) {
                    resolve([]);
                }
            });
        });
    }
    function hookHTML() {
        let type = -1;
        if (location.href.includes("selectWorkQuestionYiPiYue")) {
            type = 1;
        } else if (location.href.includes("reVersionPaperMarkContentNew") && !location.href.includes("newMooc=true")) {
            type = 2;
        } else if (location.href.includes("work/view") || location.href.includes("exam/test/reVersionPaperMarkContentNew")) {
            type = 3;
        }
        type !== -1 && hookHTMLRequest({
            url: location.href,
            type: type,
            enc: btoa(encodeURIComponent(document.getElementsByTagName("html")[0].outerHTML))
        });
    }
    function hookJSON() {
        const parse = JSON.parse;
        JSON.parse = function(s) {
            const o = parse(s);
            if (location.pathname === "/study/works/works.html") {
                if (o.paper) {
                    GLOBAL.json = parseIcve(o.paper.PaperQuestions);
                    uploadAnswer(GLOBAL.json);
                }
            } else if (location.host === "www.ttcdw.cn" && location.pathname.includes("/p/uExam/goExam/")) {
                if (o.success && o.data.exam) {
                    let arr = [];
                    for (let arrayElement of o.data.exam.assessList) {
                        arr.push(...arrayElement.questionList);
                    }
                    GLOBAL.json = parseXinJiangAgain(arr);
                    uploadAnswer(GLOBAL.json);
                }
            } else if (location.pathname === "/study/exam/exam.html") {
                if (o.array) {
                    let arr = [];
                    for (let arrayElement of o.array) {
                        arr.push(...arrayElement.Questions);
                    }
                    GLOBAL.json = parseIcve(arr);
                    uploadAnswer(GLOBAL.json);
                }
            } else if (location.pathname.includes("/v2/web/cloud/student/exercise/")) {
                if (o.data && o.data.problems && o.data.exercise_id) {
                    GLOBAL.json = parseYkt(o.data.problems);
                }
            } else if ((location.host === "examination.xuetangx.com" || location.host === "changjiang-exam.yuketang.cn") && location.pathname.includes("/exam/")) {
                if (o.data && o.data.problems) {
                    GLOBAL.json = parseYktExam(o.data.problems);
                    console.log(GLOBAL.json);
                }
            } else if ((location.host === "examination.xuetangx.com" || location.host === "changjiang-exam.yuketang.cn") && location.pathname.includes("/result/")) {
                if (o.data && o.data.problems) {
                    uploadAnswer(collectYktExam(o.data.problems));
                }
            } else if (location.pathname.includes("/study/html/content/studying/")) {
                if (o.data && (o.status === 2 || o.status === 1) && o.state !== "doing") {
                    GLOBAL.finish = true;
                    const result = parseAnHuiJx(o.data);
                    for (let resultElement of result) {
                        uploadAnswer(resultElement);
                    }
                }
            } else if (location.pathname.includes("/study/html/content/tkOnline/")) {
                if (o.code && o.data && o.doingPaperId) {
                    const arr = [];
                    const result = parseAnHuiJx(o.data);
                    for (let resultElement of result) {
                        arr.push(...resultElement);
                    }
                    uploadAnswer(arr);
                }
            } else if (location.host === "www.zjooc.cn") {
                if (o.data && o.data.paperName && o.data.clazzIds && o.data.paperSubjectList) {
                    const data = collectZaiZheXue(o.data.paperSubjectList);
                    uploadAnswer(data);
                }
            } else if (location.host === "61.183.163.9:8089") {
                if (o.topicList && o.topicList.length > 0) {
                    GLOBAL.json = collectDanWei(o.topicList);
                    uploadAnswer(GLOBAL.json);
                }
            } else if (location.host.includes("hnzkw.org.cn") && location.pathname.includes("/")) {
                if (o.data && o.data.bookdatas) {
                    GLOBAL.json = parsehnzkwText(o.data.bookdatas);
                    console.log(GLOBAL.json);
                }
            }
            return o;
        };
    }
    function parsehnzkwText(problems) {
        return problems.map(item => {
            const type = item.flag;
            let answer = [];
            let options = [];
            if (type === 2 || type === 4) {
                answer.push(item.answer);
                return {
                    question: formatString(item.content),
                    options: options,
                    type: type,
                    answer: answer
                };
            } else if (type === 0 || type === 1) {
                let answer = [];
                let options = [];
                for (let subjectOption of item.optionss) {
                    const opt = formatString(subjectOption);
                    options.push(opt);
                }
                answer.push(options[item.answer.toUpperCase().charCodeAt(0) - 65]);
                return {
                    question: formatString(item.content),
                    options: options,
                    type: type,
                    answer: answer
                };
            } else if (type === 3) {
                for (let subjectOption of item.selectOption) {
                    const opt = formatString(subjectOption);
                    options.push(opt);
                }
                answer.push(item.answer);
                return {
                    question: formatString(item.content),
                    options: options,
                    type: type,
                    answer: answer
                };
            }
        });
    }
    function collectDanWei(pro) {
        return pro.map(i => {
            if (/[013]/.test(getQuestionType(i.ttop010))) {
                const options = i.ttop018.length > 0 ? i.ttop018.split("$$") : [ "正确", "错误" ];
                return {
                    type: getQuestionType(i.ttop010),
                    question: i.ttop011,
                    options: options,
                    answer: i.ttop022.split("").map(item => {
                        return options[item.charCodeAt(0) - 65];
                    }),
                    answerKey: i.ttop022.split("").map(item => {
                        return options[item.charCodeAt(0) - 65];
                    })
                };
            } else if (/[24]/.test(getQuestionType(i.ttop010))) {
                return {
                    type: getQuestionType(i.ttop010),
                    question: i.ttop011,
                    options: [],
                    answer: i.ttop021.split("$$"),
                    answerKey: i.ttop021.split("$$")
                };
            }
        }).filter(i => i !== undefined);
    }
    function collectZaiZheXue(problems) {
        return problems.map(item => {
            if (!item.rightAnswer) return undefined;
            console.log(item);
            const subjectType = item.subjectType;
            let type = -1;
            const question = formatString(item.subjectName);
            const answer = [];
            const options = [];
            if (subjectType === 1 || subjectType === 2) {
                type = subjectType - 1;
                for (let subjectOption of item.subjectOptions) {
                    const opt = formatString(subjectOption.optionContent);
                    options.push(opt);
                    if (item.rightAnswer.includes(subjectOption.optionHead)) {
                        answer.push(opt);
                    }
                }
            } else if (subjectType === 3) {
                type = 3;
                if (item.rightAnswer === "yes") {
                    answer.push("正确");
                } else {
                    answer.push("错误");
                }
            } else {
                return undefined;
            }
            return {
                question: question,
                options: options,
                type: type,
                answer: answer
            };
        }).filter(i => i !== undefined && i.answer.length > 0);
    }
    function collectYktExam(problems) {
        console.log(problems);
        return problems.map(item => {
            const type = TYPE[item.TypeText];
            if (type < 2) {
                const options = item.Options.map(i => {
                    return formatString(type === 3 ? i.key : i.value);
                });
                return {
                    question: formatString(item.Body),
                    options: options,
                    answer: item.Answer.map(item => {
                        return options[item.charCodeAt(0) - 65];
                    }),
                    type: type
                };
            }
        });
    }
    function parseAnHuiJx(problems) {
        return problems.map(item => {
            let type = TYPE[item.name];
            return item.list.map(q => {
                const options = type === 1 || type === 0 ? q.options.map(o => {
                    return formatString(o.content);
                }) : [];
                let answer = [];
                if (type === 1 || type === 0) {
                    answer = q.answers.split(",").map(a => {
                        return options[parseInt(a)];
                    });
                } else if (type === 3) {
                    answer = [ q.answers.replace("false", "错误").replace("true", "正确") ];
                } else {
                    answer = [ formatString(q.answers) ];
                }
                return {
                    answer: answer,
                    type: type,
                    question: formatString(q.content),
                    options: options
                };
            });
        });
    }
    function parseYkt(problems) {
        return problems.map(item => {
            const type = TYPE[item.content.TypeText];
            if (type === 2 || type === 4) {
                return {
                    question: formatString(item.content.Body),
                    type: type
                };
            } else if (type <= 3) {
                return {
                    question: formatString(item.content.Body),
                    options: item.content.Options.map(i => {
                        return formatString(type === 3 ? i.key : i.value);
                    }),
                    type: type
                };
            }
        }).filter(i => i !== undefined);
    }
    function parseYktExam(problems) {
        return problems.map(items => {
            if (items.problems) {
                return items.problems.map(item => {
                    const type = TYPE[item.TypeText];
                    if (type === 2 || type === 4) {
                        return {
                            question: formatString(item.Body),
                            type: type
                        };
                    }
                    return {
                        question: formatString(item.Body),
                        options: item.Options.map(i => {
                            return formatString(type === 3 ? i.key : i.value);
                        }),
                        type: type
                    };
                }).filter(i => i !== undefined);
            } else {
                const type = TYPE[items.TypeText];
                if (type === 2 || type === 4) {
                    return {
                        question: formatString(items.Body),
                        type: type
                    };
                }
                return {
                    question: formatString(items.Body),
                    options: items.Options.map(i => {
                        return formatString(type === 3 ? i.key : i.value);
                    }),
                    type: type
                };
            }
        }).filter(i => i !== undefined).flat();
    }
    function parseXinJiangAgain(questions) {
        return questions.map(item => {
            const answer = [];
            const options = item.answers.map(opt => {
                if (opt.isAnswer === "0") answer.push(formatString(opt.name));
                return formatString(opt.name);
            });
            const type = item.types === "2" ? 3 : parseInt(item.types);
            return {
                id: item.id,
                question: item.name,
                options: options,
                answer: answer,
                type: type
            };
        });
    }
    function parseIcve(questions) {
        return questions.map(item => {
            const options = item.Selects.map(opt => {
                return formatString(opt);
            });
            const type = TYPE[item.ACHType.QuestionTypeName];
            const answer = item.Answers.map(key => {
                if (type === 0 || type === 1) {
                    return options[key.charCodeAt() - 65];
                } else if (type === 3) {
                    return key === "1" ? "正确" : "错误";
                }
            });
            const answerKey = type === 0 || type === 1 ? item.Answers : answer;
            return {
                id: item.Id,
                question: item.ContentText,
                answerKey: answerKey,
                options: type === 3 ? [ "正确", "错误" ] : options,
                answer: answer,
                type: type
            };
        });
    }
    function parseXiaoETong(obj) {
        return obj.map(item => {
            let answer = [];
            if (item.type === 0 || item.type === 1) {
                answer = item.answer.map(a => {
                    for (let optionElement of item.option) {
                        if (optionElement.id === a) return formatString(optionElement.content);
                    }
                });
            } else if (item.type === 3) {
                answer = item.answer.map(a => {
                    return a.replace("1", "正确").replace("0", "错误");
                });
            } else if (item.type === 4) {
                answer = item.answer;
            }
            return {
                question: formatString(item.content),
                answer: answer,
                options: item.option ? item.option.map(opt => {
                    return formatString(opt.content);
                }) : [],
                type: item.type
            };
        });
    }
    const QQ_GROUP = [ "622648517" ];
    var _self = unsafeWindow;
    var top = _self;
    try {
        if (GLOBAL.XiGua_PHPSESSION.length) {
            GLOBAL.answerApi["gk_xiguashuwang_com"] = GK_XiGua;
        }
        String.prototype.replaceAll = function(s1, s2) {
            return this.replace(new RegExp(s1, "gm"), s2);
        };
        window.onload = hookHTML;
        loadAdPng().then(r => {});
        while (top !== _self.top) {
            top = top.parent.document ? top.parent : _self.top;
            if (top.location.pathname === "/mycourse/studentstudy") break;
        }
    } catch (err) {
        top = _self;
    }
    var parent = _self === top ? self : _self.parent;
    _self.Ext || parent.Ext || {};
    var UE$1 = _self.UE;
    top.addEventListener("message", event => {
        if (event.data.type === "jump") {
            GLOBAL.index++;
            iframeMsg("tip", {
                tip: "准备答第" + (GLOBAL.index + 1) + "题"
            });
        } else if (event.data.type === "stop") {
            GLOBAL.stop = event.data.val;
        } else if (event.data.type === "start_pay") {
            if (event.data.flag) {
                if (String(GM_getValue("token")).length === 10 || String(GM_getValue("token")).length === 11) {
                    iframeMsg("tip", {
                        tip: "已开启请求收费题库,已实时生效"
                    });
                    GM_setValue("start_pay", event.data.flag);
                    iframeMsg("start_pay", true);
                } else {
                    iframeMsg("tip", {
                        tip: "系统检测您的token可能输入有误,请检查"
                    });
                }
            } else {
                iframeMsg("tip", {
                    tip: "已关闭请求收费题库,已实时生效"
                });
                GM_setValue("start_pay", event.data.flag);
                iframeMsg("start_pay", false);
            }
        } else if (event.data.type === "auto_jump") {
            GM_setValue("auto_jump", event.data.flag);
            iframeMsg("tip", {
                tip: "已" + (event.data.flag ? "开启" : "关闭") + "自动切换,页面刷新后生效"
            });
        } else if (event.data.type === "confim") {
            if (event.data.token.length === 10 || event.data.token.length === 11) {
                GM_setValue("token", event.data.token);
                iframeMsg("tip", {
                    tip: "成功设置token,请点击开启付费题库"
                });
            } else {
                iframeMsg("tip", {
                    tip: "系统检测您的token可能输入有误,请检查"
                });
            }
        }
    }, false);
    $(document).keydown(function(event) {
        if (event.keyCode === 38) {
            $("#model-id").hide();
        } else if (event.keyCode === 40) {
            $("#model-id").show();
        } else if (event.keyCode === 37) {
            $("#model-id").hide();
            GM_setValue("hide", true);
        } else if (event.keyCode === 39) {
            $("#model-id").show();
            GM_setValue("hide", false);
            GM_setValue("pos", "50px,50px");
        } else if (event.keyCode === 83) {
            GLOBAL.stop = true;
            iframeMsg("stop", GLOBAL.stop);
        } else if (event.keyCode === 68) {
            GLOBAL.stop = false;
            iframeMsg("stop", GLOBAL.stop);
        }
    });
    function getAnswerForKey(keys, options) {
        return keys.map(function(val) {
            return options[val.charCodeAt(0) - 65];
        });
    }
    function setIntervalFunc(flag, func, time) {
        const interval = setInterval(() => {
            if (flag()) {
                clearInterval(interval);
                func();
            }
        }, time || 1e3);
    }
    function getAnswer(str, options, type) {
        if (type === 0 || type === 1) {
            const ans = getAnswerForKey(str.match(/[A-G]/gi) || [], options);
            return ans.length > 0 ? ans : [ str ];
        } else {
            return [ str ];
        }
    }
    function getQuestionType(str) {
        if (!str) return undefined;
        str = str.trim().replaceAll(/\s+/g, "");
        if (TYPE[str]) return TYPE[str];
        const regex = Object.keys(TYPE).join("|");
        const matcher = str.match(regex);
        if (matcher) return TYPE[matcher[0]];
        return undefined;
    }
    function rand(m, n) {
        return Math.ceil(Math.random() * (n - m + 1) + m - 1);
    }
    const HTTP_STATUS = {
        0: "校园网络 不稳定,请尝试使用手机热点进行答题",
        403: "cdn提供商不稳定,刷新页面后自动切换备选链路",
        444: "您请求速率过大,IP已经被封禁,请等待片刻或者更换IP",
        415: "请不要使用手机运行此脚本,否则可能出现异常",
        429: "免费题库搜题整体使用人数突增,系统繁忙,请耐心等待或使用付费题库...",
        500: "服务器发生预料之外的错误",
        502: "运维哥哥正在火速部署服务器,请稍等片刻,1分钟内恢复正常",
        503: "搜题服务不可见,请稍等片刻,1分钟内恢复正常",
        504: "系统超时"
    };
    const TYPE = {
        multichoice: 1,
        singlechoice: 0,
        bijudgement: 3,
        "单项选择题": 0,
        "单项选择": 0,
        "单选题": 0,
        "单选": 0,
        "多选": 1,
        "多选题": 1,
        "案例分析": 1,
        "多项选择题": 1,
        "多项选择": 1,
        "客观题": 1,
        "填空题": 2,
        "填空": 2,
        "对错题": 3,
        "判断题": 3,
        "判断正误": 3,
        "判断": 3,
        "主观题": 4,
        "问答题": 4,
        "简答题": 4,
        "名词解释": 5,
        "论述题": 6,
        "计算题": 7,
        "其它": 8,
        "分录题": 9,
        "资料题": 10,
        "连线题": 11,
        "排序题": 13,
        "完形填空": 14,
        "完型填空": 14,
        "阅读理解": 15,
        "口语题": 18,
        "听力题": 19,
        "A1A2题": 1,
        "文件作答": 4,
        "视频题": 1,
        "阅读理解(选择)/完型填空": 66
    };
    function sleep(time) {
        return new Promise(resolve => {
            setTimeout(resolve, time);
        });
    }
    function iframeMsg(type, message) {
        try {
            top.document.getElementById("iframeNode").contentWindow.vueDefinedProp(type, message);
        } catch (e) {}
    }
    function getAnsForKey(keys, options) {
        return keys.map(val => {
            const index = val.charCodeAt(0) - 65;
            return options[index];
        });
    }
    function filterImg(dom) {
        if (location.host === "ncexam.cug.edu.cn") {
            String.prototype.trim = function() {
                return this.replace(/^\s+|\s+$/gm, "");
            };
        }
        return $(dom).clone().find("img[src]").replaceWith(function() {
            return $("<p></p>").text('<img src="' + $(this).attr("src") + '">');
        }).end().find("iframe[src]").replaceWith(function() {
            return $("<p></p>").text('<iframe src="' + $(this).attr("src") + '"></irame>');
        }).end().text().trim();
    }
    function createContainer(name, childElem) {
        name = name.toLowerCase();
        let elem = top.document.createElement(name);
        elem.style.display = "block";
        elem.id = name.replace("hcsearche", "hcSearche").replace(/\-[a-z]/g, function(w) {
            return w.replace("-", "").toUpperCase();
        });
        if (childElem) {
            if (Array.isArray(childElem) === false) childElem = [ childElem ];
            for (let i = 0; i < childElem.length; i++) elem.appendChild(childElem[i]);
        }
        return elem;
    }
    function dragModel(drag) {
        const TOP = top;
        drag.onmousedown = function(e) {
            drag.style.cursor = "move";
            e = e || window.event;
            let diffX = e.clientX - drag.offsetLeft;
            let diffY = e.clientY - drag.offsetTop;
            top.onmousemove = function(e) {
                e = e || top.event;
                let left = e.clientX - diffX;
                let top = e.clientY - diffY;
                if (left < 0) {
                    left = 0;
                } else if (left > TOP.innerWidth * .95 - drag.offsetWidth) {
                    left = TOP.innerWidth * .95 - drag.offsetWidth;
                }
                if (top < 0) {
                    top = 0;
                } else if (top > TOP.innerHeight - drag.offsetHeight) {
                    top = TOP.innerHeight - drag.offsetHeight;
                }
                drag.style.left = left + "px";
                drag.style.top = top + "px";
                GM_setValue("pos", drag.style.left + "," + drag.style.top);
            };
            top.onmouseup = function(e) {
                drag.style.cursor = "default";
                this.onmousemove = null;
                this.onmouseup = null;
            };
        };
    }
    function defaultWorkTypeResolver($options) {
        function count(selector) {
            let c = 0;
            for (const option of $options || []) {
                if ($(option).find(selector) !== null) {
                    c++;
                }
            }
            return c;
        }
        return count('[type="radio"]') === 2 ? 3 : count('[type="radio"]') > 2 ? 0 : count('[type="checkbox"]') > 2 ? 1 : count("textarea") >= 1 ? 4 : undefined;
    }
    function waitWithTimeout(promise, timeout, timeoutMessage = "timeout", defaultRes) {
        let timer;
        const timeoutPromise = new Promise((resolve, reject) => {
            timer = setTimeout(() => defaultRes === undefined ? reject(timeoutMessage) : resolve(defaultRes), timeout);
        });
        return Promise.race([ timeoutPromise, promise ]).finally(() => clearTimeout(timer));
    }
    async function formatSearchAnswer(initData) {
        const data = {
            question: initData.question,
            options: initData.options,
            type: initData.type
        };
        let res;
        console.log("准备搜题", JSON.stringify(data));
        const list = [];
        const obj = {};
        const apis = Object.assign(window.remoteAnswerApi ? window.remoteAnswerApi : {}, GLOBAL.answerApi);
        const answerApiFunc = Object.keys(apis).map(item => {
            return waitWithTimeout(apis[item](initData), 5e3, "", []);
        });
        answerApiFunc.push(searchAnswer(data));
        const answerApiRes = await waitWithTimeout(Promise.all(answerApiFunc), 8e3, "(接口超时)");
        answerApiRes.map(item => {
            if (item instanceof Array) {
                list.push(...item);
                console.log("请求第三方接口", JSON.stringify(item));
            } else if (item instanceof Object && Object.keys(item).length === 1) {
                const key = Object.keys(item)[0];
                obj[key] = item[key];
                console.log("请求远程接口", item);
            } else {
                console.log("请求官方接口", item.responseText);
                res = item;
            }
        });
        uploadRemoteResult(obj);
        if (res.status !== 200) {
            console.log(res);
            return {
                success: false,
                msg: (HTTP_STATUS[res.status] || "链接服务器失败,错误码" + res.status) + "有疑问请反馈至QQ群" + QQ_GROUP
            };
        }
        try {
            res = JSON.parse(res.responseText);
            if (res.code !== 200) {
                return {
                    success: false,
                    msg: res.msg
                };
            }
            if (res.data && res.data.list && res.data.list.length > 0) {
                list.push(...res.data.list);
            }
            return {
                success: true,
                msg: res.msg,
                num: res.data.num,
                list: list
            };
        } catch (e) {
            return {
                success: false,
                msg: "发生异常" + e + "请反馈至QQ群" + QQ_GROUP
            };
        }
    }
    function similar(s, t, f) {
        if (!s || !t) {
            return 0;
        }
        if (s === t) {
            return 100;
        }
        var l = s.length > t.length ? s.length : t.length;
        var n = s.length;
        var m = t.length;
        var d = [];
        f = f || 2;
        var min = function(a, b, c) {
            return a < b ? a < c ? a : c : b < c ? b : c;
        };
        var i, j, si, tj, cost;
        if (n === 0) return m;
        if (m === 0) return n;
        for (i = 0; i <= n; i++) {
            d[i] = [];
            d[i][0] = i;
        }
        for (j = 0; j <= m; j++) {
            d[0][j] = j;
        }
        for (i = 1; i <= n; i++) {
            si = s.charAt(i - 1);
            for (j = 1; j <= m; j++) {
                tj = t.charAt(j - 1);
                if (si === tj) {
                    cost = 0;
                } else {
                    cost = 1;
                }
                d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
            }
        }
        let res = (1 - d[n][m] / l) * 100;
        return res.toFixed(f);
    }
    function answerSimilar(src, list) {
        return $.map(list, function(val) {
            return Number(similar(formatString(val), formatString(src), 2));
        });
    }
    function isPlainAnswer(answer) {
        if (answer.length > 8 || !/[A-Z]/.test(answer)) {
            return false;
        }
        let counter = {};
        let min = 0;
        for (let i = 0; i < answer.length; i++) {
            if (answer.charCodeAt(i) < min) {
                return false;
            }
            min = answer.charCodeAt(i);
            counter[min] = (counter[min] || 0) + 1;
        }
        return true;
    }
    function isTrue(str) {
        return Boolean(String(str).match(/(^|,)(正确|是|对|√|T|ri|true)(,|$)/));
    }
    function isFalse(str) {
        return Boolean(String(str).match(/(^|,)(错误|否|错|×|F|不是|wr|false)(,|$)/));
    }
    async function defaultQuestionResolve(list, data, handler, ignore_click) {
        const isPay = JSON.stringify(list).includes("此题位于收费题库哦");
        let targetOptionsList = [];
        for (const answers of list) {
            console.log("当前答案", JSON.stringify(answers));
            if (data.type === 4 || data.type === 2 || data.type === 5) {
                let ans = answers.length > data.$options.length ? answers.slice(0, data.$options.length) : answers;
                for (const val of ans) {
                    if (typeof handler === "function") await handler(data.type, val, data.$options.eq(ans.indexOf(val)));
                }
                return {
                    ok: true,
                    ans: answers.join("===="),
                    question: data.question
                };
            } else if (data.type === 3) {
                if (targetOptionsList.length > 3) break;
                let targetOptions = new Set();
                if (isTrue(answers.join())) {
                    targetOptions.add(Number(isFalse(data.options[0])));
                } else if (isFalse(answers.join())) {
                    targetOptions.add(Number(isTrue(data.options[0])));
                }
                targetOptions.size > 0 && targetOptionsList.push(targetOptions);
            } else if (data.type === 0 || data.type === 1 || data.type === 66) {
                let targetOptions = new Set();
                for (const ans of answers) {
                    if (ans.length === 1 && isPlainAnswer(ans)) {
                        targetOptions.add(ans.charCodeAt(0) - 65);
                    }
                    const val = formatString(ans);
                    let optIndex = $.inArray(val, data.options);
                    if (optIndex >= 0) {
                        targetOptions.add(optIndex);
                    } else if (val.length >= 5 && !val.includes("<img")) {
                        const ratings = answerSimilar(val, data.options);
                        const maxScore = Math.max(...ratings);
                        if (maxScore > 65) {
                            targetOptions.add(ratings.indexOf(maxScore));
                        }
                    }
                }
                targetOptions.size > 0 && targetOptionsList.push(targetOptions);
            }
        }
        let items = [];
        let sortArr = targetOptionsList.map(item => {
            const s = Array.from(item).sort();
            console.log(s);
            return s;
        });
        if (data.type === 0 || data.type === 3) {
            items = getMost(sortArr.filter(i => i.length === 1));
            console.log("单选题:出现最多的为", items);
            if (!items || items.length === 0) {
                items = getMost(sortArr.filter(i => i.length > 0));
            }
        } else if (data.type === 1 || data.type === 66) {
            items = getMost(sortArr.filter(i => i.length > 1));
            console.log("多选题:出现最多的为", items);
            if (!items || items.length === 0) {
                items = getLang(sortArr.filter(i => i.length > 0));
                console.log("多选题无奈找不到只能匹配单个的并且最长的", items);
            }
        }
        if (items && items.length > 0) {
            for (let index = 0; index < data.$options.length; index++) {
                const $item = data.$options.eq(index);
                if (Boolean($.inArray(index, items) + 1) !== ignore_click($item, data.type)) {
                    $item.get(0).click();
                    await sleep(GLOBAL.fillAnswerDelay);
                }
            }
            return {
                type: data.type,
                ok: true,
                ans: items.map(i => {
                    return data.options[i];
                }).join("===="),
                question: data.question
            };
        } else {
            await handler(undefined);
            return {
                type: data.type,
                ok: false,
                question: data.question,
                ans: isPay && !GM_getValue("start_pay") ? "此题位于收费题库" : list.join("====") === "此题位于收费题库哦!" ? "无答案" : list.join("===="),
                options: data.options
            };
        }
    }
    function getMost(arr) {
        arr.reverse();
        if (arr.length === 0) return undefined;
        var hash = {};
        var m = 0;
        var trueEl;
        var el;
        for (var i = 0, len = arr.length; i < len; i++) {
            el = arr[i];
            hash[el] === undefined ? hash[el] = 1 : hash[el]++;
            if (hash[el] >= m) {
                m = hash[el];
                trueEl = el;
            }
        }
        return trueEl;
    }
    function getLang(arr) {
        if (arr.length === 0) return undefined;
        let len = 0;
        let ele;
        for (let arrElement of arr) {
            if (arrElement.length > len) {
                len = arrElement.length;
                ele = arrElement;
            }
        }
        return ele ? ele : arr.length > 0 ? arr[0] : [];
    }
    function HTMLDecode(text) {
        var temp = document.createElement("div");
        temp.innerHTML = text;
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
    }
    function formatString(src) {
        src = String(src);
        return (src.includes("img") || src.includes("iframe") ? src : HTMLDecode(src)).replace(/\s+/, " ").replace(/[\uff01-\uff5e]/g, function(str) {
            return String.fromCharCode(str.charCodeAt(0) - 65248);
        }).replace(/^[A-Za-z][\.、]/, "").replace(/\s+/g, " ").replace(/\(\d+\s分\)$/, "").replace(/\(\d+分\)$/, "").replace(/[“”]/g, '"').replace(/^\d+、/, "").replace(/(\d+\s+分)$/, "").replace(/[‘’]/g, "'").replace(/。/g, ".").replace(/^【(.*?)题】/, "").replace(/^\[(.*?)题]/, "").replace(/\(\s+\)\.$/, "").replace(/\(\s+\)$/, "").replace(/^\d+\.\s+\(.*?题\)/, "").replace(/\+/g, "").replace(/;$/, "").toLowerCase().trim();
    }
    function url2Base64(url) {
        return new Promise((resolve, reject) => {
            GM_xmlhttpRequest({
                url: url,
                responseType: "blob",
                onload: function(r) {
                    const fileReader = new FileReader();
                    fileReader.readAsDataURL(r.response);
                    fileReader.onload = e => {
                        resolve(e.target.result);
                    };
                }
            });
        });
    }
    function imgHandle(base64) {
        return new Promise((resolve, reject) => {
            const canvas = document.createElement("canvas");
            const context = canvas.getContext("2d");
            const image = new Image();
            image.setAttribute("crossOrigin", "Anonymous");
            image.src = base64;
            image.onload = function() {
                canvas.width = image.width;
                canvas.height = image.height;
                context.fillStyle = "#fff";
                context.fillRect(0, 0, canvas.width, canvas.height);
                context.drawImage(image, 0, 0);
                canvas.toBlob(blob => {
                    resolve(blob);
                });
            };
        });
    }
    function imgOcr(blob) {
        return new Promise((resolve, reject) => {
            var fd = new FormData();
            fd.append("image", blob, "1.png");
            GM_xmlhttpRequest({
                url: "https://appwk.baidu.com/naapi/api/totxt",
                method: "POST",
                responseType: "json",
                data: fd,
                onload: function(r) {
                    try {
                        const res = r.response.words_result.map(item => {
                            return item.words;
                        }).join("");
                        resolve(res);
                    } catch (err) {
                        console.log(err.msg);
                        resolve("");
                    }
                }
            });
        });
    }
    async function yuketangOcr(url) {
        const base64 = await url2Base64(url);
        const img_blob = await imgHandle(base64);
        return await imgOcr(img_blob);
    }
    function division(arr, size) {
        var objArr = new Array();
        var index = 0;
        var objArrLen = arr.length / size;
        for (var i = 0; i < objArrLen; i++) {
            var arrTemp = new Array();
            for (var j = 0; j < size; j++) {
                arrTemp[j] = arr[index++];
                if (index == arr.length) {
                    break;
                }
            }
            objArr[i] = arrTemp;
        }
        return objArr;
    }
    function showPanel() {
        let html = `
        <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
      ` + GM_getResourceText("ElementUiCss") + `
      .el-table .warning-row {
        background: oldlace;
      }
      .el-table .success-row {
        background: #f0f9eb;
      }
      *{
        padding: 0px;
        margin: 0px;
      }
      .el-form-item{
        display: flex;
        justify-content: center
      }
    </style>
</head>
<body>
<div id="app">
    <div id="drag_auto_answer" style="position: absolute;">
        <el-main
                class="onlinekf"
                style="min-width: 328px;margin-top: 0px;margin-left: 0px;border: 0px solid #666;width: 100%;background-color: #ffffff; padding: 15px 0px 0px; z-index: 99999;">
            <el-row>
                <el-form>
                    <el-form-item label="请输入token"  style="margin-top: -20px" :prop="passw">
                        <el-input :type="passw" v-model="opt.token" placeholder="请输入内容" style="max-width: 130px" size="mini" ></el-input>
                        <el-button   @click="btnClick(opt.token,'opt.confim')" size="mini" type="warning" @mousedown.native="passw = 'text'" @mouseup.native="passw = 'password'">确定</el-button>
                    </el-form-item>
                </el-form>
            </el-row>
            <el-row style="margin-top: -20px;margin-bottom: 5px;display: flex">
                <el-alert
                        style="display: block"
                        :title="tip"
                        :closable="false"
                        type="success">
                    <el-button v-if="need_jump" @click="btnClick(opt.jump,'opt.jump')" size="mini" type="info">跳过本题</el-button>
                    <el-button v-if="!hidden" @click="btnClick(opt.auto_jump,'opt.auto_jump')" size="mini" type="warning">{{opt.auto_jump ? '停止自动切换': '开启自动切换'}}</el-button>
                </el-alert>
            </el-row>
            <el-row style="display: flex;flex-flow: wrap;width: 100%;align-items: flex-start;">
                <el-button v-if="!hidden" @click="btnClick(opt.stop,'opt.stop')" size="mini" type="success" style="margin-left: 5px">{{!opt.stop ? '暂停答题': '继续答题'}}</el-button>
<!--                <el-button size="mini" type="info" style="margin-left: 5px">重新查询</el-button>-->
                <el-button @click="btnClick(opt.start_pay,'opt.start_pay')" size="mini" type="primary" style="margin-left: 5px">{{opt.start_pay ?'关闭收费题库' : '开启收费题库'}}</el-button>
                <el-button size="mini" type="danger" style="margin-left: 5px"><a style="text-decoration:none;color: aliceblue" target="_blank" href="` + (GM_getValue("host") || baseHost_lyck6_cn) + `/pay" >获取积分</a></el-button>
            </el-row>

            <el-table size="mini" :data="tableData" style="width: 100%;margin-top: 5px" :row-class-name="tableRowClassName">
                <el-table-column prop="index" label="题号" width="45"></el-table-column>
                <el-table-column prop="question" label="问题" width="130">
                  <template slot-scope="scope">
                        <p v-html="scope.row.question"></p>
                  </template>
                </el-table-column>
                <el-table-column prop="answer" label="答案" width="130">
                 <template slot-scope="scope">
                        <p v-html="scope.row.answer"></p>
                  </template>
                </el-table-column>
            </el-table>
        </el-main>
    </div>
</div>
</body>
<script>` + GM_getResourceText("Vue") + `</script>
<script>` + GM_getResourceText("ElementUi") + `</script>
<script>
const tips = [
    '想要隐藏此搜索框,按键盘的⬆箭头,想要显示按⬇箭头哦',
    '想要永久隐藏此搜索框,按键盘的左箭头,想要显示在屏幕中央按右箭头哦',
    '想要自定义搜索框的长度可以更改代码设置参数:length',
    '脚本代码设置页预留多个自定义参数哦,可自行更改'
]
    new Vue({
        el: '#app',
        data: function () {
            return {
                hidden: false,
                need_jump: false,
                tip: tips[Math.floor(Math.random()*tips.length)],
                opt:{
                    token: '` + GM_getValue("token") + `',
                    auto_jump: ` + GM_getValue("auto_jump") + `,
                    stop: false,
                    start_pay: ` + GM_getValue("start_pay") + `
                },
                input: '',
                visible: false,
                tableData: [],
                passw:"password"
            }
        },
        created(){
            /**
            * 
            * @param type 消息类型
            * @param receiveParams 消息参数
            */
            window['vueDefinedProp'] = (type,receiveParams) => {
                if (type === 'push'){
                    let length = this.tableData.length
                    this.tableData.push({index: length + 1,question: receiveParams.question,answer: receiveParams.answer,ok:receiveParams.ok})
                }else if (type === 'clear'){
                    this.tableData = []
                }else if (type === 'tip'){
                    if (receiveParams.type && receiveParams.type === 'jump'){
                         window.parent.postMessage({"type": 'jump'}, '*');
                    }else if (receiveParams.type && receiveParams.type === 'error'){
                         this.need_jump = true
                    }else if (receiveParams.type && receiveParams.type === 'hidden'){
                         this.hidden = true
                    }else if (receiveParams.type && receiveParams.type === 'stop'){
                         this.opt.stop = true
                    }
                    this.tip = receiveParams.tip
                }else if (type === 'stop'){
                    this.opt.stop = receiveParams
                }else if (type === 'start_pay'){
                    this.opt.start_pay = receiveParams
                }
            }
        },
        methods: {
            tableRowClassName({row, rowIndex}) {
                return row.ok ? 'success-row': 'warning-row'
            },
            btnClick(e,type){
                if (type === 'opt.stop'){//暂停搜索
                    this.opt.stop = !this.opt.stop
                    this.tip = this.opt.stop? '已暂停搜索': '继续搜索'
                     window.parent.postMessage({type: 'stop',val:this.opt.stop}, '*');
                }else if (type === 'opt.start_pay'){
                     window.parent.postMessage({type: 'start_pay',flag:!this.opt.start_pay}, '*');
                }else if (type === 'opt.auto_jump'){//开启自动切换
                    this.opt.auto_jump = ! this.opt.auto_jump
                    window.parent.postMessage({type: 'auto_jump',flag:this.opt.auto_jump}, '*');
                }else if (type === 'opt.jump'){//跳过本题
                    window.parent.postMessage({type: 'jump'}, '*');
                    this.need_jump = false
                }else if (type === 'opt.confim'){
                    window.parent.postMessage({type: 'confim',token:e}, '*');
                }
            }
        }
    })
</script>
</html>
`;
        addModal2(html);
        selectBaseHost();
    }
    function addModal2(html, newPos, footerChildNode = false) {
        let headersNode = createContainer("hcsearche-modal-links");
        let adNode = top.document.createElement("img");
        let png = "";
        try {
            const ad = GM_getValue("ad");
            png = ad ? JSON.parse(ad).png : "";
            png = png.includes("base64") ? png : GM_getResourceURL("Img");
        } catch (e) {
            png = GM_getResourceURL("Img");
        }
        adNode.setAttribute("src", png);
        adNode.setAttribute("draggable", "false");
        adNode.setAttribute("style", "display: block;width:321px");
        headersNode.appendChild(adNode);
        let iframeNode = top.document.createElement("iframe");
        iframeNode.id = "iframeNode";
        iframeNode.setAttribute("width", "100%");
        iframeNode.setAttribute("height", GLOBAL.length + "px");
        iframeNode.setAttribute("style", "height:" + GLOBAL.length + "px");
        iframeNode.setAttribute("frameborder", "0");
        iframeNode.srcdoc = html;
        let contentNode = createContainer("content-modal", [ headersNode, iframeNode ]);
        let modal = renderModal(contentNode);
        dragModel(modal);
        if (GM_getValue("hide")) {
            $("#model-id").hide();
        }
    }
    function renderModal(childElem, newPos) {
        return render("tag" + rand(1, 100).toString(), "model-id", childElem);
    }
    function render(tagName, elemId, childElem, isFixed, newPos) {
        let doc = top.document;
        let elem = doc.getElementById(elemId);
        if (elem) {
            elem.innerHTML = "";
        } else {
            elem = doc.createElement(tagName);
            elem.id = elemId;
            doc.body.appendChild(elem);
        }
        let contentNode = createContainer(tagName + "-container", childElem);
        elem.appendChild(contentNode);
        elem.classList.add(elemId);
        elem.style.zIndex = "9999999";
        elem.style.position = "fixed";
        const pos = GM_getValue("pos") === undefined ? "30px,30px" : GM_getValue("pos");
        const posarr = pos.split(",");
        elem.style.left = posarr[0];
        elem.style.top = posarr[1];
        setTimeout(function() {
            elem.classList.add(elemId + "-show");
        }, 10);
        return elem;
    }
    WorkerJSPlus({
        name: "智慧树作业/考试",
        match: location.pathname === "/stuExamWeb.html" && (location.href.includes("/webExamList/dohomework/") || location.href.includes("/webExamList/doexamination/")),
        root: ".examPaper_subject",
        elements: {
            question: ".subject_describe div,.smallStem_describe p",
            options: ".subject_node .nodeLab .node_detail",
            $options: ".subject_node .nodeLab .node_detail",
            type: ".subject_type span:first-child"
        },
        intv: () => {
            return $(".answerCard").length;
        },
        wrap: obj => {
            try {
                obj.question = obj.question.get(0).__vue__._data.shadowDom.textContent;
            } catch (e) {}
            if ($(".yidun_popup").hasClass("yidun_popup--light")) {
                iframeMsg("tip", {
                    type: "stop",
                    tip: "答题暂停,请自行通过验证"
                });
                GLOBAL.stop = true;
            }
            if (obj.type === undefined) {
                obj.type = 66;
            }
        },
        ignore_click: $item => {
            return $item.hasClass("onChecked");
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE$1.getEditor($option.find("textarea").attr("name")).setContent(answer);
            }
        },
        finished: () => {
            $(".el-button:contains(保存)").get(0).__vue__._events.click[0]();
        },
        fillFinish: data => {
            if (data.type <= 3) {
                $(".el-button:contains(下一题)").get(0).__vue__._events.click[0]();
            }
        }
    });
    WorkerJSPlus({
        name: "智慧树学分课作业",
        match: location.href.includes("/atHomeworkExam/stu/homeworkQ/exerciseList") || location.href.includes("atHomeworkExam/stu/examQ/examexercise"),
        root: ".questionBox:eq(0)",
        elements: {
            question: ".questionContent",
            options: ".optionUl label .el-radio__label,.el-checkbox__label",
            $options: ".optionUl label",
            type: ".questionTit"
        },
        intv: () => {
            return $(".answerCard").length;
        },
        wrap: async obj => {
            obj.options = obj.options.map(item => {
                return formatString(item.replaceAll(/^[a-zA-Z][.|\s+]/g, ""));
            });
            if ($(".yidun_popup").hasClass("yidun_popup--light")) {
                iframeMsg("tip", {
                    type: "stop",
                    tip: "答题暂停,请自行通过验证"
                });
                GLOBAL.stop = true;
            }
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        finished: () => {
            if ($(".Nextbtndiv .Topicswitchingbtn-gray:contains(下一题)").hasClass("Topicswitchingbtn-gray")) return false;
            $(".Topicswitchingbtn:contains(下一题)").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "智慧树学分课考试",
        match: location.host === "studentexambaseh5.zhihuishu.com",
        root: ".ques-detail",
        elements: {
            question: ".questionName .centent-pre",
            options: ".radio-view li  .preStyle,.checkbox-views label .preStyle",
            $options: ".radio-view li,.checkbox-views label",
            type: ".letterSortNum"
        },
        intv: () => {
            return $(".questionContent").length;
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        wrap: obj => {
            obj.options = obj.options.map(item => {
                return formatString(item.replaceAll(/^[a-zA-Z][.|\s+]/g, ""));
            });
            if ($(".yidun_popup").hasClass("yidun_popup--light")) {
                iframeMsg("tip", {
                    type: "stop",
                    tip: "答题暂停,请自行通过验证"
                });
                GLOBAL.stop = true;
            }
            if (obj.type === 15) {
                obj.question = formatString($(".centent-son-pre").text());
                obj.type = 1;
            }
        },
        finished: auto_jump => {
            if (auto_jump) {
                const btn = $(".next-topic:contains(下一题)");
                btn.click();
                return !btn.hasClass("noNext");
            }
        }
    });
    const init$1 = async ($TiMu, select, wrap) => {
        let question = formatString(filterImg($TiMu.find(select.elements.question)));
        let data = {
            $item: $TiMu,
            question_text: $TiMu.find(select.elements.question).text(),
            question: question.length === 0 ? $TiMu.find(select.elements.question) : question,
            $options: select.elements.$options ? $TiMu.find(select.elements.$options) : undefined,
            options: select.elements.options ? jQuery.map($TiMu.find(select.elements.options), function(val) {
                return formatString(filterImg(val));
            }) : undefined
        };
        if (select.elements.type) {
            const getType = getQuestionType($TiMu.find(select.elements.type).text());
            const val = $TiMu.find(select.elements.type).val();
            data.type = isNaN(getType) ? isNaN(val) ? val : parseInt(val) : getType;
        } else {
            data.type = $TiMu;
        }
        if (select.elements.answer) {
            data.answer = getAnswer(filterImg($TiMu.find(select.elements.answer)) || $TiMu.find(select.elements.answer).val(), data.options, data.type);
        }
        await wrap(data);
        if (data && data.type === 3 && data.options.length === 0) {
            data.options = [ "正确", "错误" ];
        }
        return data;
    };
    function WorkerJSPlus(options) {
        if (options.hook) {
            if (options.hook()) return;
        }
        const match = options.match ? typeof options.match === "boolean" ? options.match : options.match() : false;
        if (!match) return;
        const defaultFunc = () => {};
        const main = () => {
            showPanel();
            setTimeout(() => {
                if (options.init && typeof options.init === "function") {
                    if (options.init()) return;
                }
                const select = {
                    root: options.root,
                    elements: options.elements,
                    ignore_click: options.ignore_click
                };
                new WorkerJS(select, options.wrap ? options.wrap : defaultFunc, options.fill ? options.fill : defaultFunc, options.finished ? options.finished : defaultFunc, options.fillFinish ? options.fillFinish : defaultFunc).fillAnswer();
            }, GLOBAL.delay);
        };
        if (options.intv) {
            setIntervalFunc(options.intv, main);
        } else {
            main();
        }
    }
    var WorkerJS = function(select, searchHander, fillHander, onFinish = function(need_jump) {}, fillFinish = function() {}) {
        GLOBAL.index = 0;
        this.init = init$1;
        this.fillAnswer = async () => {
            let arr = jQuery(select.root);
            while (true) {
                if (arr.length === 0) return;
                await sleep(GLOBAL.time);
                if (GLOBAL.stop) {
                    continue;
                }
                if (GLOBAL.index >= arr.length) {
                    let auto_jump = GM_getValue("auto_jump") === undefined || GM_getValue("auto_jump");
                    const next = await onFinish(auto_jump);
                    if (next) {
                        GLOBAL.index = 0;
                        setTimeout(this.fillAnswer(), GLOBAL.time);
                    }
                    if (auto_jump) {
                        iframeMsg("tip", {
                            tip: "自动答题已完成,即将切换下一题"
                        });
                        next || setTimeout(() => {
                            iframeMsg("tip", {
                                type: "hidden",
                                tip: "自动答题已完成,请检查提交"
                            });
                        }, GLOBAL.time);
                    } else {
                        iframeMsg("tip", {
                            tip: "自动答题已完成" + (arr.length === 1 ? ",请手动切换" : "请检查提交")
                        });
                    }
                    return true;
                }
                try {
                    let data = await this.init(jQuery(arr[GLOBAL.index++]), select, searchHander);
                    if (!data) {
                        GLOBAL.index--;
                        continue;
                    }
                    iframeMsg("tip", {
                        tip: "准备答第" + GLOBAL.index + "题"
                    });
                    const formatResult = await formatSearchAnswer(data);
                    const formatAns = data.answer && GM_getValue("start_pay") ? {
                        success: true,
                        num: formatResult.num,
                        list: [ data.answer ]
                    } : formatResult;
                    if (formatAns.success) {
                        iframeMsg("tip", {
                            tip: "准备填充答案," + (formatAns.num.includes("免费题库") ? "免费题库不扣积分" : "剩余积分:" + formatAns.num)
                        });
                        let r = await defaultQuestionResolve(formatAns.list, data, fillHander, select.ignore_click ? select.ignore_click : () => {
                            return false;
                        });
                        iframeMsg("push", {
                            index: GLOBAL.index,
                            question: r.question,
                            answer: r.ans,
                            ok: r.ok
                        });
                        GM_getValue("start_pay") && String(GM_getValue("token")).length === 10 && catchAnswer(r);
                        fillFinish(r);
                    } else {
                        GLOBAL.index--;
                        iframeMsg("tip", {
                            tip: formatAns.msg
                        });
                    }
                } catch (e) {
                    GLOBAL.index--;
                    console.table(e);
                    iframeMsg("tip", {
                        type: "error",
                        tip: "发生异常" + e + "请反馈至QQ群" + QQ_GROUP
                    });
                }
            }
        };
    };
    function HTMLCollect(select, collectHander) {
        this.init = init$1;
        this.collectAnswer = async () => {
            return (await Promise.all(jQuery(select.root).map(async (index, item) => {
                const data = await this.init(jQuery(item), select, collectHander);
                return data ? {
                    question: data.question,
                    answer: data.answer,
                    type: data.type,
                    options: data.options
                } : undefined;
            }))).filter(i => i !== undefined && i.answer && typeof i.answer === "object" && i.answer instanceof Array && i.answer.length > 0);
        };
    }
    function init() {
        rule = rwl_userData.rules.rule_def;
        hook_eventNames = rule.hook_eventNames.split("|");
        unhook_eventNames = rule.unhook_eventNames.split("|");
        eventNames = hook_eventNames.concat(unhook_eventNames);
        if (rule.dom0) {
            setInterval(clearLoop, 10 * 1e3);
            setTimeout(clearLoop, 1500);
            window.addEventListener("load", clearLoop, true);
            clearLoop();
        }
        if (rule.hook_addEventListener) {
            EventTarget.prototype.addEventListener = addEventListener;
            document.addEventListener = addEventListener;
            if (hasFrame) {
                for (let i = 0; i < hasFrame.length; i++) {
                    hasFrame[i].contentWindow.document.addEventListener = addEventListener;
                }
            }
        }
        if (rule.hook_preventDefault) {
            Event.prototype.preventDefault = function() {
                if (hook_eventNames.indexOf(this.type) < 0) {
                    Event_preventDefault.apply(this, arguments);
                }
            };
            if (hasFrame) {
                for (let i = 0; i < hasFrame.length; i++) {
                    hasFrame[i].contentWindow.Event.prototype.preventDefault = function() {
                        if (hook_eventNames.indexOf(this.type) < 0) {
                            Event_preventDefault.apply(this, arguments);
                        }
                    };
                }
            }
        }
        if (rule.hook_set_returnValue) {
            Event.prototype.__defineSetter__("returnValue", function() {
                if (this.returnValue !== true && hook_eventNames.indexOf(this.type) >= 0) {
                    this.returnValue = true;
                }
            });
        }
    }
    function addEventListener(type, func, useCapture) {
        var _addEventListener = this === document ? document_addEventListener : EventTarget_addEventListener;
        if (hook_eventNames.indexOf(type) >= 0) {
            _addEventListener.apply(this, [ type, returnTrue, useCapture ]);
        } else if (unhook_eventNames.indexOf(type) >= 0) {
            var funcsName = storageName + type + (useCapture ? "t" : "f");
            if (this[funcsName] === undefined) {
                this[funcsName] = [];
                _addEventListener.apply(this, [ type, useCapture ? unhook_t : unhook_f, useCapture ]);
            }
            this[funcsName].push(func);
        } else {
            _addEventListener.apply(this, arguments);
        }
    }
    function clearLoop() {
        rule = clear();
        var elements = getElements();
        for (var i in elements) {
            for (var j in eventNames) {
                var name = "on" + eventNames[j];
                if (Object.prototype.toString.call(elements[i]) == "[object String]") {
                    continue;
                }
                if (elements[i][name] !== null && elements[i][name] !== onxxx) {
                    if (unhook_eventNames.indexOf(eventNames[j]) >= 0) {
                        elements[i][storageName + name] = elements[i][name];
                        elements[i][name] = onxxx;
                    } else {
                        elements[i][name] = null;
                    }
                }
            }
        }
        document.onmousedown = function() {
            return true;
        };
    }
    function returnTrue(e) {
        return true;
    }
    function unhook_t(e) {
        return unhook(e, this, storageName + e.type + "t");
    }
    function unhook_f(e) {
        return unhook(e, this, storageName + e.type + "f");
    }
    function unhook(e, self, funcsName) {
        var list = self[funcsName];
        for (var i in list) {
            list[i](e);
        }
        e.returnValue = true;
        return true;
    }
    function onxxx(e) {
        var name = storageName + "on" + e.type;
        this[name](e);
        e.returnValue = true;
        return true;
    }
    function getElements() {
        var elements = Array.prototype.slice.call(document.getElementsByTagName("*"));
        elements.push(document);
        var frames = document.querySelectorAll("frame");
        if (frames) {
            hasFrame = frames;
            var frames_element;
            for (let i = 0; i < frames.length; i++) {
                frames_element = Array.prototype.slice.call(frames[i].contentWindow.document.querySelectorAll("*"));
                elements.push(frames[i].contentWindow.document);
                elements = elements.concat(frames_element);
            }
        }
        return elements;
    }
    var settingData = {
        status: 1,
        version: .1,
        message: "",
        positionTop: "0",
        positionLeft: "0",
        positionRight: "auto",
        addBtn: false,
        connectToTheServer: false,
        waitUpload: [],
        currentURL: "null",
        shortcut: 3,
        rules: {},
        data: []
    };
    var rwl_userData = null;
    var rule = null;
    var hasFrame = false;
    var storageName = "storageName";
    var hook_eventNames, unhook_eventNames, eventNames;
    var EventTarget_addEventListener = EventTarget.prototype.addEventListener;
    var document_addEventListener = document.addEventListener;
    var Event_preventDefault = Event.prototype.preventDefault;
    rwl_userData = GM_getValue("rwl_userData");
    if (!rwl_userData) {
        rwl_userData = settingData;
    }
    for (let value in settingData) {
        if (!rwl_userData.hasOwnProperty(value)) {
            rwl_userData[value] = settingData[value];
            GM_setValue("rwl_userData", rwl_userData);
        }
    }
    function removeF() {
        var md5 = $.md5;
        var $tip = $("style:contains(font-cxsecret)");
        if (!$tip.length) return;
        var font = $tip.text().match(/base64,([\w\W]+?)'/)[1];
        font = Typr.parse(base64ToUint8Array(font))[0];
        var table = JSON.parse(GM_getResourceText("Table"));
        var match = {};
        for (var i = 19968; i < 40870; i++) {
            $tip = Typr.U.codeToGlyph(font, i);
            if (!$tip) continue;
            $tip = Typr.U.glyphToPath(font, $tip);
            $tip = md5(JSON.stringify($tip)).slice(24);
            match[i] = table[$tip];
        }
        $(".font-cxsecret").html(function(index, html) {
            $.each(match, function(key, value) {
                key = String.fromCharCode(key);
                key = new RegExp(key, "g");
                value = String.fromCharCode(value);
                html = html.replace(key, value);
            });
            return html;
        }).removeClass("font-cxsecret");
        function base64ToUint8Array(base64) {
            var data = window.atob(base64);
            var buffer = new Uint8Array(data.length);
            for (var i = 0; i < data.length; ++i) {
                buffer[i] = data.charCodeAt(i);
            }
            return buffer;
        }
    }
    function start() {
        setInterval(function() {
            try {
                removeF();
            } catch (e) {}
            try {
                init();
            } catch (e) {}
        }, 500);
    }
    setTimeout(() => {
        start();
    }, GLOBAL.time);
    WorkerJSPlus({
        name: "学习通作业",
        match: location.pathname === "/mooc2/work/dowork",
        root: ".questionLi",
        elements: {
            question: "h3",
            options: ".stem_answer .answerBg .answer_p, .textDIV, .eidtDiv",
            $options: ".stem_answer .answerBg, .textDIV, .eidtDiv",
            type: "input[type^=hidden]:eq(0)"
        },
        ignore_click: $item => {
            return Boolean($item.find(".check_answer,.check_answer_dx").length);
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE$1.getEditor($option.find("textarea").attr("name")).setContent(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "超星旧版考试",
        match: (location.pathname === "/exam/test/reVersionTestStartNew" || location.pathname === "/exam-ans/exam/test/reVersionTestStartNew") && !location.href.includes("newMooc=true"),
        root: ".TiMu",
        elements: {
            question: ".Cy_TItle .clearfix",
            options: ".Cy_ulTop .clearfix",
            $options: ":radio, :checkbox, .Cy_ulTk textarea",
            type: "[name^=type]:not([id])"
        },
        ignore_click: $item => {
            return $item.get(0).checked;
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE$1.getEditor($option.attr("name")).setContent(answer);
            }
        },
        finished: auto_jump => {
            auto_jump && setInterval(function() {
                const btn = $(".saveYl:contains(下一题)").offset();
                var mouse = document.createEvent("MouseEvents"), arr = [ btn.left + Math.ceil(Math.random() * 80), btn.top + Math.ceil(Math.random() * 26) ];
                mouse.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, arr[0], arr[1], false, false, false, false, 0, null);
                _self.event = $.extend(true, {}, mouse);
                delete _self.event.isTrusted;
                _self.getTheNextQuestion(1);
            }, Math.ceil(GLOBAL.time * Math.random()) * 2);
        }
    });
    WorkerJSPlus({
        name: "超星章节测验",
        match: location.pathname === "/work/doHomeWorkNew",
        hook: removeF,
        init: () => {
            initChaoXingQuiz($("#workLibraryId").val() || $("#oldWorkId").val(), $("#courseId").val());
        },
        root: ".clearfix .TiMu",
        elements: {
            question: ".Zy_TItle .clearfix",
            options: "ul:eq(0) li .after",
            $options: "ul:eq(0) li :radio,:checkbox,textarea",
            type: "input[name^=answertype]"
        },
        ignore_click: $item => {
            return $item.get(0).checked;
        },
        fill: async (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE$1.getEditor($option.attr("name")).setContent(answer);
            }
        },
        finished: () => {
            $(".ZY_sub .btnGray_1").click();
        }
    });
    const i = Number((location.pathname === "/exam/test/reVersionTestStartNew" || location.pathname === "/exam-ans/exam/test/reVersionTestStartNew") && location.href.includes("newMooc=true"));
    WorkerJSPlus({
        name: "超星新版考试",
        match: () => {
            const cxSingle = (location.pathname === "/exam/test/reVersionTestStartNew" || location.pathname === "/exam-ans/exam/test/reVersionTestStartNew") && location.href.includes("newMooc=true");
            const cxAll = location.pathname === "/mooc2/exam/preview" || location.pathname === "/exam-ans/mooc2/exam/preview";
            return cxSingle || cxAll;
        },
        root: ".questionLi",
        elements: {
            question: "h3 div",
            options: ".answerBg .answer_p, .textDIV, .eidtDiv",
            $options: ".answerBg, .textDIV, .eidtDiv",
            type: "input[name^=type]:eq(" + i + ")"
        },
        ignore_click: $item => {
            return Boolean($item.find(".check_answer,.check_answer_dx").length);
        },
        wrap: obj => {
            if (obj.type === 6) {
                obj.type = 4;
            }
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2 || type === 5) {
                const name = $option.find("textarea").attr("name");
                UE$1.getEditor(name).setContent(answer);
                if (i === 0) {
                    $("#" + name.replace("answerEditor", "save_")).click();
                }
            }
        },
        finished: a => {
            a && $('.nextDiv .jb_btn:contains("下一题")').click();
        }
    });
    WorkerJSPlus({
        name: "超星随堂测验",
        match: location.pathname === "/page/quiz/stu/answerQuestion",
        root: ".question-item",
        elements: {
            question: ".topic-txt",
            options: ".topic-option-list",
            $options: ".topic-option-list input",
            type: "input[class^=que-type]"
        },
        ignore_click: $item => {
            return Boolean($item.find(".check_answer,.check_answer_dx").length);
        },
        wrap: obj => {
            if (obj.type === 16) {
                obj.type = 3;
            }
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                $option.val(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "职教云考试",
        match: location.pathname === "/exam/examflow_index.action",
        intv: () => {
            return $(".paper_contentDiv").length;
        },
        init: initZhiJiaoYun,
        root: ".q_content",
        elements: {
            question: ".divQuestionTitle",
            options: ".questionOptions .q_option",
            $options: ".questionOptions .q_option div"
        },
        ignore_click: $item => {
            return $($item).attr("class") === "checkbox_on";
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.next().attr("answertype"));
            obj.type = obj.type ? obj.type : defaultWorkTypeResolver(obj.$options);
            obj.options = $.map(obj.options, val => {
                return formatString(val.replace(/[A-G][.|\\.\s+]/, "")).trim();
            });
        },
        finished: async () => {
            if ($(".paging_next").attr("style").includes("block")) {
                $(".paging_next").click();
                await sleep(1e3);
                return true;
            }
        }
    });
    WorkerJSPlus({
        name: "职教云测验",
        match: location.pathname === "/study/directory/dir_course.html",
        intv: () => {
            return $(".panel_item").length;
        },
        root: ".panel_item .panel_item",
        elements: {
            question: ".preview_cm .preview_stem",
            options: ".preview_cm ul li span:last-child",
            $options: ".preview_cm ul li input"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find(".panel_title").text());
            obj.options = obj.options.map(i => {
                return i.trim().replace(/^[abAB]\)\s+/, "").replace(/^[A-Za-z]\s+/, "").trim();
            });
        },
        ignore_click: $item => {
            return $item.attr("checked") === "checked";
        }
    });
    WorkerJSPlus({
        name: "职教云MOOC",
        match: location.pathname === "/study/homework/do.html" || location.pathname === "/study/workExam/testWork/preview.html" || location.pathname === "/study/onlineExam/preview.html" || location.pathname === "/study/workExam/homeWork/preview.html" || location.pathname === "/study/workExam/onlineExam/preview.html",
        root: ".e-q-r",
        elements: {
            question: ".e-q-q .ErichText",
            options: ".e-a-g li",
            $options: ".e-a-g li",
            type: ".quiz-type"
        },
        ignore_click: $item => {
            return $item.hasClass("checked");
        },
        wrap: obj => {
            if (obj.type === "A1A2题") {
                obj.type = 1;
            }
            obj.question = obj.question.replace(/<img src="https:\/\/cdn-zjy.icve.com.cn\/common\/images\/question_button\/blankspace(\d+).gif">/gi, "");
            obj.options = obj.options.map(i => {
                return i.trim().replace(/^[abAB]\)\s+/, "").replace(/^[A-Za-z]\s+/, "").trim();
            });
        }
    });
    WorkerJSPlus({
        name: "资源库 WWW开头",
        match: location.pathname === "/study/works/works.html" || location.pathname === "/study/exam/exam.html",
        root: ".e-q-r",
        elements: {
            question: ".e-q-q .ErichText",
            options: ".e-a-g li",
            $options: ".e-a-g li",
            type: ".quiz-type"
        },
        hook: () => {
            hookJSON();
        },
        ignore_click: $item => {
            return $item.hasClass("checked");
        },
        wrap: obj => {
            function get_element(id) {
                for (let jsonElement of GLOBAL.json) {
                    if (jsonElement.id === id) {
                        return jsonElement;
                    }
                }
            }
            const ele = get_element(obj.type);
            obj.question = ele.question;
            obj.answer = ele.answerKey ? ele.answerKey : ele.answer;
            obj.type = ele.type;
            obj.options = ele.options;
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE$1.getEditor($option.attr("name")).setContent(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "雨课堂旧版考试",
        match: location.pathname.includes("/v/quiz/quiz_result"),
        intv: () => {
            return $("#cover").attr("style").includes("display: none;");
        },
        root: ".problem_item",
        elements: {
            question: ".notBullet:eq(0)",
            options: ".notBullet:gt(0)",
            $options: ".problembullet"
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        wrap: async obj => {
            const $item = obj.type;
            const tmp = $item.find(".ptype").clone();
            tmp.children().remove();
            obj.type = getQuestionType(tmp.text());
            obj.question = await yuketangOcr(obj.question.attr("data-background"));
            if (obj.$options.length === 2) {
                obj.options = [ "正确", "错误" ];
            } else {
                const opt = [];
                for (const tmpElement of $item.find(".notBullet:gt(0)")) {
                    opt.push(await yuketangOcr(jQuery(tmpElement).attr("data-background")));
                }
                obj.options = opt;
            }
        }
    });
    WorkerJSPlus({
        name: "学堂在线",
        match: false,
        root: ".content:eq(0)",
        elements: {
            question: ".question .fuwenben",
            options: ".question .leftQuestion .leftradio > span:last-child",
            $options: ".question .leftradio",
            type: ".question .title"
        },
        ignore_click: $item => {
            return $item.find(".radio_jqq").hasClass("active");
        },
        wrap: obj => {
            if (obj.type === 3) {
                obj.$options = $(".answerList .radio_jqq");
            }
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                UE.getEditor($option.find("textarea")).setContent(answer);
            }
        },
        finished: () => {
            const $right = $(".tabbar").find(".right");
            $right.click();
            return !$right.hasClass("unselect");
        }
    });
    WorkerJSPlus({
        name: "雨课堂新版考试",
        match: (location.host === "examination.xuetangx.com" || location.host === "changjiang-exam.yuketang.cn") && (location.pathname.includes("/exam/") || location.pathname.includes("/cover/")),
        hook: () => {
            hookJSON();
            const intv = setInterval(() => {
                try {
                    top.document.querySelector(".exam").__vue__.handleHangUpTip = function() {};
                    const querySelector = top.document.querySelector;
                    top.document.querySelector = function(...args) {
                        if (args[0] === "#model-id") return false;
                        return querySelector.call(this, ...args);
                    };
                    clearInterval(intv);
                } catch (e) {}
            }, 100);
        },
        intv: () => {
            return jQuery(".subject-item").length;
        },
        root: ".exam-main--body .subject-item",
        elements: {
            question: ".item-body .problem-body ,p",
            options: ".item-body ul li",
            $options: ".item-body ul label, .blank-item-dynamic, .edui-editor-iframeholder",
            type: ".item-type"
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        wrap: obj => {
            const ele = GLOBAL.json[GLOBAL.index - 1];
            Object.assign(obj, ele);
        }
    });
    WorkerJSPlus({
        name: "雨课堂新版考试",
        match: location.pathname.includes("/v2/web/cloud/student/exercise/"),
        hook: () => {
            hookJSON();
            const intv = setInterval(() => {
                try {
                    top.document.querySelector(".exam").__vue__.handleHangUpTip = function() {};
                    const querySelector = top.document.querySelector;
                    top.document.querySelector = function(...args) {
                        if (args[0] === "#model-id") return false;
                        return querySelector.call(this, ...args);
                    };
                    clearInterval(intv);
                } catch (e) {}
            }, 100);
        },
        intv: () => {
            return jQuery(".subject-item").length;
        },
        root: ".container-problem .subject-item",
        elements: {
            $options: ".item-body ul label",
            type: ".item-type"
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        wrap: async obj => {
            const index = jQuery(".container-problem .subject-item").eq(0).find(".item-type").text().trim().match(/^(\d+)/)[1];
            const ele = GLOBAL.json[index - 1];
            Object.assign(obj, ele);
        },
        finished: need_jump => {
            if ($(".el-button--text:contains(下一题)").hasClass("is-disabled")) return false;
            need_jump && setTimeout(() => {
                $(".el-button--text:contains(下一题)").click();
            }, GLOBAL.time / 3);
            return need_jump;
        }
    });
    WorkerJSPlus({
        name: "云班课",
        match: location.pathname === "/web/index.php" && location.href.includes("m=reply"),
        root: ".topic-item",
        elements: {
            question: ".t-con .t-subject",
            options: ".t-option  label .option-content",
            $options: ".el-radio__input,.el-checkbox__input",
            type: ".t-info .t-type"
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        wrap: obj => {
            if (obj.type === "A1A2题") {
                obj.type = 1;
            }
            obj.question = obj.question.replace(/<img src="https:\/\/cdn-zjy.icve.com.cn\/common\/images\/question_button\/blankspace(\d+).gif">/gi, "");
            obj.options = obj.options.map(i => {
                return i.trim().replace(/^[abAB]\)\s+/, "").replace(/^[A-Za-z]\s+/, "").trim();
            });
        }
    });
    WorkerJSPlus({
        name: "中国地质大学",
        match: location.pathname.includes("/Exam/OnlineExamV2/"),
        root: ".stViewItem",
        elements: {
            question: ".stViewHead  div",
            options: ".stViewCont  .stViewOption a",
            $options: ".stViewCont  .stViewOption a,input"
        },
        intv: () => {
            return $(".ExamTime").length;
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().parent().prev().find(".E_E_L_I_C_R_C_T_SubType").text());
            obj.question = obj.question.replace(/\(\d+分\)/, "");
            obj.options = obj.options.map(i => {
                return i.replace(/\([A-Za-z]\)/, "").trim();
            });
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                $option.val(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "单位",
        match: location.href.includes("ksnr") || location.href.includes("lxnr"),
        root: ".tm",
        elements: {
            question: ".tmnrbj span:last-child",
            options: ".van-radio-group .dxt .van-radio__label,.van-checkbox__label",
            $options: ".van-radio-group .dxt .van-radio__label,.van-checkbox__label,.van-field__control",
            type: ".tmnrbj span"
        },
        intv: () => {
            return $(".ExamTime").length;
        },
        wrap: obj => {
            obj.answer = GLOBAL.json[jQuery(".tmnrbj span:last-child").text().match(/^(\d+)、/)[1] - 1].answerKey;
            obj.question = formatString(obj.question);
        },
        finished: () => {
            jQuery(".xyt").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "小饿通",
        match: location.pathname.includes("/evaluation_wechat/examination/detail/"),
        root: ".question-title,.title__text",
        elements: {
            question: "#detail_div",
            options: "label  .image-text-box p",
            $options: "label,.simulation_inp"
        },
        ignore_click: ($item, type) => {
            if (type === 0) {
                return $item.html().includes("single-exam-radio-active");
            } else if (type === 1) {
                return $item.html().includes("check-i-active");
            }
        },
        wrap: obj => {
            const $item = obj.type;
            obj.$options = $item.parent().next().find(".option-item,.checking-option__container,.fill_blank");
            obj.type = getQuestionType($item.next().text());
            if (obj.type === 2) {
                obj.$options = $item.parent().parent();
            }
            if (obj.type === 3) {
                obj.options = [ "正确", "错误" ];
            } else {
                obj.options = jQuery.map($item.parent().next().find(".option-item #detail_div"), function(val) {
                    return formatString(filterImg(val));
                });
            }
        },
        fill: (type, answer, $option) => {
            if (type === 2) {
                const vue = $option.get(0).__vue__;
                vue.content[0] = answer;
                vue.emitAnswer();
                $option.find(".simulation_inp").text(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "小饿通H5",
        match: location.host.includes("h5.xiaoeknow") || location.href.includes("/exam/h5_evaluation/"),
        root: ".practice-detail__body",
        elements: {
            question: ".question-wrap__title #detail_div",
            options: ".question-option #detail_div",
            $options: ".question-option #detail_div",
            type: ".question-wrap__title-tag"
        },
        wrap: obj => {
            const $item = obj.type;
            obj.$options = $item.parent().next().find(".option-item,.checking-option__container,.fill_blank");
            obj.type = TYPE[$item.next().text().replace(/\s+/, "").replace("(", "").replace(")", "")];
            if (obj.type === 2) {
                obj.$options = $item.parent().parent();
            }
            if (obj.type === 3) {
                obj.options = [ "正确", "错误" ];
            } else {
                obj.options = jQuery.map($item.parent().next().find(".option-item #detail_div"), function(val) {
                    return formatString(filterImg(val));
                });
            }
        },
        finished: () => {
            $(".practice-detail__bottom-item:last-child").click();
            return $(".next").text() === "下一题";
        }
    });
    WorkerJSPlus({
        name: "人卫慕课测验",
        match: location.pathname.includes("/memberFront/paper.zhtml"),
        intv: () => {
            return $("#question_").attr("style").length === 0;
        },
        root: ".quesinfo",
        elements: {
            question: "dl dt",
            options: "dd label",
            $options: "dd input"
        },
        wrap: obj => {
            if (obj.$options.length === 2) {
                obj.type = 3;
                obj.options = [ "正确", "错误" ];
            } else {
                obj.type = 0;
            }
        }
    });
    WorkerJSPlus({
        name: "青书学堂考试",
        match: location.host.includes("qingshuxuetang") && (location.pathname.includes("/Student/MakeupExamPaper") || location.pathname.includes("Student/ExamPaper")),
        root: ".paper-container .question-detail-container",
        elements: {
            question: ".question-detail-description .detail-description-content",
            options: ".question-detail-options label .option-description",
            $options: ".question-detail-options label input",
            type: ".question-detail-type .question-detail-type-desc"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        }
    });
    WorkerJSPlus({
        name: "青书学堂测验",
        match: location.host.includes("qingshuxuetang") && location.pathname.includes("/Student/ExercisePaper") || location.host === "quiz.qingshuxuetang.com" && location.pathname.includes("/Student/Quiz/Detail"),
        root: ".question-detail-container",
        elements: {
            question: ".question-detail-description  span",
            options: ".question-detail-options label .option-description",
            $options: ".question-detail-options div input,.question-detail-solution-textarea",
            type: ".question-detail-type .question-header-left span"
        },
        wrap: obj => {
            obj.options = obj.options.map(i => {
                return i.replace(/\([A-Za-z]\)/, "").trim();
            });
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        fill: $option => {
            if (type === 4 || type === 2) {
                $option.parents().find(".question-controller-wrapper .next").click();
            }
        }
    });
    WorkerJSPlus({
        name: "优学院测验",
        match: location.pathname === "/learnCourse/learnCourse.html",
        intv: () => {
            return $(".question-setting-panel").length;
        },
        root: ".split-screen-wrapper",
        elements: {
            question: ".question-title-scroller .question-title-html",
            options: ".choice-list .content-wrapper .text",
            $options: ".choice-list .checkbox ,.question-body-wrapper .choice-btn",
            type: ".question-title-scroller .question-type-tag"
        },
        wrap: obj => {
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.hasClass("selected");
        }
    });
    WorkerJSPlus({
        name: "优学院考试",
        match: location.host === "utest.ulearning.cn" && location.pathname === "/",
        intv: () => {
            return $(".section-area").length;
        },
        root: ".question-area .question-item",
        elements: {
            question: ".base-question .title .rich-text",
            options: ".choice-list label .rich-text",
            $options: ".choice-list  label, .iconfont",
            type: ".base-question .title .tip"
        },
        wrap: obj => {
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        finished: () => {
            if ($(".next-part:contains(下个部分)").length) {
                $(".next-part").click();
                return true;
            } else {
                return false;
            }
        }
    });
    WorkerJSPlus({
        name: "优学院作业",
        match: location.pathname === "/umooc/learner/homework.do",
        intv: () => {
            return $(".multiple-choices").length;
        },
        root: ".multiple-choices,.judge",
        elements: {
            question: "h5 .position-rltv span:last-child",
            options: "ul label span:last-child",
            $options: "ul label input,.radios .radio input",
            type: "h5 .typeName"
        },
        wrap: obj => {
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.prev().hasClass("checkbox-checked");
        }
    });
    WorkerJSPlus({
        name: "万学",
        match: location.pathname.includes("/sls/N2014_StudyController/next"),
        root: ".question",
        elements: {
            question: "tr .nm2",
            options: ".grey td p",
            $options: ".option li label",
            type: "tr .nm2"
        },
        wrap: obj => {
            obj.question = obj.question.parent().find("td p").text();
        }
    });
    WorkerJSPlus({
        name: "wenJuanAutoFill",
        match: location.host.includes("wenjuan.com") && location.pathname === "/s/",
        root: "questionContent",
        elements: {
            question: ".title",
            options: ".icheckbox_div .option_label",
            $options: ".icheckbox_div label",
            type: ".question_num"
        },
        ignore_click: $item => {
            return $item.attr("class").includes("checked");
        }
    });
    WorkerJSPlus({
        name: "学起",
        match: location.pathname.includes("/oxer/page/ots/examIndex.html"),
        intv: () => {
            return $(".tika_topline").length;
        },
        root: ".queItemClass",
        elements: {
            question: "dt .din:eq(1)",
            options: ".clearfix div",
            $options: ".clearfix .xuan,input"
        },
        ignore_click: $item => {
            return $item.parent().hasClass("cur");
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find("div .fb:eq(0)").text());
        }
    });
    WorkerJSPlus({
        name: "易班考试",
        match: location.host === "exam.yooc.me" && location.pathname.includes("/group"),
        intv: () => {
            return $(".jsx-3527395752").length;
        },
        root: "main:last",
        elements: {
            question: "h3 div",
            options: ".mb ul li .flex-auto",
            $options: ".mb ul li",
            type: ".mb-s"
        },
        ignore_click: $item => {
            return $item.hasClass("_c");
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                $(".exam-input").val("answer");
            }
        },
        finished: need_jump => {
            if ($('.round:contains("下一题")').hasClass("ghost")) return false;
            $('.round:contains("下一题")').click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "英华学堂作业",
        match: location.host === "mooc.yncjxy.com" && location.pathname.includes("/user/work") || location.pathname.includes("/user/exam"),
        intv: () => {
            return $("#stateName").text().trim() === "进行中";
        },
        root: ".courseexamcon-main",
        elements: {
            question: ".name",
            options: ".list li .txt",
            $options: ".list li .exam-inp",
            type: ".type"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        fill: (type, answer, $option) => {},
        finished: auto_jump => {
            if ($(".next_exam").eq(3).prop("style")[0] == "display") return false;
            $(".next_exam").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "英华学堂考试",
        match: location.host === "mooc.yncjxy.com" && location.pathname.includes("/user/exam"),
        intv: () => {
            return $("#stateName").text().trim() === "进行中";
        },
        root: ".courseexamcon-main",
        elements: {
            question: ".name",
            options: ".list li .txt",
            $options: ".list li .exam-inp",
            type: ".type"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        finished: auto_jump => {
            if ($(".next_exam").eq(3).prop("style")[0] == "display") return false;
            $(".next_exam").click();
        }
    });
    WorkerJSPlus({
        name: "厦门在线教育测验",
        match: location.pathname.includes("/nec/student/exam/exam-paper!test"),
        root: "td:contains('分)')",
        elements: {
            question: "td:contains('分)')",
            options: ".optionUl label .el-radio__label,.el-checkbox__label",
            $options: ".optionUl label"
        },
        wrap: obj => {
            obj.question = obj.type;
            obj.options = obj.question.parent().next().find("tbody tbody td:last-child").map((i, y) => {
                return $(y).text();
            });
            obj.type = 0;
            obj.$options = obj.question.parent().next().find("tbody tbody input:last-child").map((i, y) => {
                return y;
            });
            obj.question = $(obj.question).text();
        }
    });
    WorkerJSPlus({
        name: "金牌学堂",
        match: location.host === "www.goldgame.com.cn" && location.href.includes("/TestPage"),
        intv: () => {
            return $(".tab-btn-box li").length;
        },
        root: ".test-type-box ul .white-bg",
        elements: {
            question: ".position-relative h3",
            options: ".test-option label p:last-child",
            $options: ".test-option label input"
        },
        wrap: obj => {
            obj.question = obj.question.replace(/题目\d+\:/, "").trim().replace(/^\d+./, "");
            obj.type = getQuestionType(obj.type.parent().parent().find(".test-type-tips").text());
            if (obj.$options.length > 2 && obj.$options.eq(0).hasClass("radiobox")) {
                obj.type = 0;
            }
        },
        fillFinish: data => {
            $(".answer-sheet li").eq(GLOBAL.index).click();
        }
    });
    WorkerJSPlus({
        name: "青岛开放大学",
        match: location.pathname.includes("/pages/exam/exam.html"),
        intv: () => {
            return $(".exam-content-block .exam-content-topic").length;
        },
        root: ".exam-content-block .exam-content-topic",
        elements: {
            question: ".exam-topic-title",
            options: ".exam-topic-answer .layui-unselect span",
            $options: ".exam-topic-answer .layui-unselect"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find(".exam-content-title .exam-content-num").text());
        }
    });
    WorkerJSPlus({
        name: "点墨考试",
        match: location.pathname.includes("/Exam/StartExam"),
        root: "#question div div:first",
        elements: {
            question: "div:first",
            options: "div:first ~ div",
            $options: "div:first ~ div input"
        },
        wrap: obj => {
            obj.type = getQuestionType($(".alert #groupNameSpan").text());
        },
        finished: () => {
            $(".w-100 .btn-light:eq(1)").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "点墨测验",
        match: location.pathname.includes("/Course/TestPaper"),
        root: ".question",
        elements: {
            question: " div div:first div:first",
            options: " div div:first div:first ~ div",
            $options: " div div:first div:first ~ div input"
        },
        wrap: obj => {
            obj.type = getQuestionType($("h3").text());
            obj.question = obj.question.replace(/^\d+\./, "");
        }
    });
    WorkerJSPlus({
        name: "警官学院",
        match: location.pathname.includes("/bsmytest/startTi.do"),
        root: ".wrapper > div",
        elements: {
            question: ".dx",
            options: "p",
            $options: "p input"
        },
        wrap: obj => {
            if ($(".wrapper .cl").length > 0) {
                obj.question = obj.type.text().replace(/[0-9]、/, "").replace(/\(.*?\)/g, "").trim().split("$")[0].replace(/\(.*?\)/g, "").trim();
            } else {
                obj.question = obj.question.replace(/[0-9]、/, "").replace(/\(.*?\)/g, "").trim();
            }
            obj.type = getQuestionType(obj.type.parent().find("h2").text());
            obj.options = obj.options.map(item => {
                return item.replace(/[A-Za-z][\:]/, "").replace(/[A-Za-z][\:,\:]/, "").replace(/\;/, "").trim();
            });
        }
    });
    WorkerJSPlus({
        name: "exam2_euibe_com_exam",
        match: location.hostname === "exam2.euibe.com" && location.pathname === "/KaoShi/ShiTiYe.aspx",
        root: ".question",
        elements: {
            question: ".wenti",
            options: "li label span",
            $options: "li label"
        },
        wrap: obj => {
            obj.type = getQuestionType($(".question_head").text());
        },
        finished: need_jump => {
            $(".paginationjs-next").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "lzwyedu_jijiaool_com_exam",
        match: location.hostname === "lzwyedu.jijiaool.com" && location.pathname.includes("/Student/ExamManage/CourseOnlineExamination"),
        root: ".test_item",
        elements: {
            question: ".test_item_tit",
            options: ".test_item_theme label .zdh_op_con",
            $options: "li label input"
        },
        wrap: obj => {
            obj.question = obj.question.replace(/该题未做$/, "").replace(/^\d+\./, "");
            obj.type = getQuestionType(obj.type.prevAll(".test_item_type:first").text());
        }
    });
    WorkerJSPlus({
        name: "zzx_ouchn_edu_cn_exam",
        match: location.hostname === "zzx.ouchn.edu.cn" && location.pathname.includes("/edu/public/student/"),
        root: ".subject",
        elements: {
            question: ".question span",
            options: ".answer>span>p:first-child",
            $options: ".answer>span>p:first-child"
        },
        wrap: obj => {
            if (obj.$options.length > 1) {
                obj.type = 0;
            }
        }
    });
    WorkerJSPlus({
        name: "havust_hnscen_cn_exam",
        match: location.hostname === "havust.hnscen.cn" && location.pathname.includes("/stuExam/examing/"),
        root: ".main .mt_2 > div",
        elements: {
            question: ".flex_row+div",
            options: ".flex_row+div+div .el-radio__label,.el-checkbox__label",
            $options: ".flex_row+div+div .el-radio__label,.el-checkbox__label",
            type: ".flex_row .mr_2"
        }
    });
    WorkerJSPlus({
        name: "www_zygbxxpt_com_exam",
        match: location.hostname === "www.zygbxxpt.com" && location.pathname.includes("/exam"),
        root: ".Body",
        elements: {
            question: ".QName",
            options: ".QuestinXuanXiang p:parent",
            $options: ".QuestinXuanXiang p:parent",
            type: ".QName span"
        },
        wrap: obj => {
            obj.question = obj.question.replace(/\([^\)]*\)/g, "").replace(/\【.*?\】/g, "");
            obj.options = obj.options.map(item => {
                return item.split(">").pop().trim();
            });
        }
    });
    WorkerJSPlus({
        name: "xuexi_jsou_cn_work",
        match: location.hostname === "xuexi.jsou.cn" && location.pathname.includes("/jxpt-web/student/newHomework/showHomeworkByStatus"),
        root: ".insert",
        elements: {
            question: ".window-title",
            options: ".questionId-option .option-title div[style^=display]",
            $options: ".questionId-option .option-title .numberCover"
        },
        wrap: obj => {
            obj.type = {
                1: 0,
                2: 1
            }[obj.type.find(".question-type").val()];
        }
    });
    WorkerJSPlus({
        name: "czvtc_cjEdu_com_exam",
        match: location.host.includes("czvtc.cj-edu.com") && location.pathname.includes("/ExamInfo"),
        intv: () => {
            return $(".el-container .all_subject>.el-row");
        },
        root: ".el-container .all_subject>.el-row",
        elements: {
            question: ".stem div:last-child",
            options: ".el-radio-group .el-radio__label",
            $options: ".el-radio-group .el-radio__original"
        },
        wrap: obj => {
            if (obj.$options.length < 3 && obj.$options.eq(0).attr("type") === "radio") {
                obj.type = 3;
            } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                obj.type = 0;
            } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "checkbox") {
                obj.type = 1;
            }
        }
    });
    WorkerJSPlus({
        name: "learning_mhtall_com_exam",
        match: location.host.includes("learning.mhtall.com") && location.pathname.includes("/rest/course/exercise/item"),
        root: "#div_item",
        elements: {
            question: ".item_title",
            options: ".opt div label",
            $options: ".opt div input:not(.button_short)",
            type: "h4"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        wrap: obj => {
            if (obj.type === 0 || obj.type === 3) {
                obj.answer = $(".div_answer").text().match(/[a-zA-Z]/).map(i => {
                    return obj.options[i.charCodeAt(0) - 65];
                });
            } else if (obj.type === 2) {
                obj.answer = $(".div_answer").text().replace("参考答案:", "").split(",");
            }
        },
        fill: (type, answer, $option) => {
            if (type === 2 || type === 4) {
                $option.val(answer);
                $(".DIV_TYPE_BLANK .button_short").click();
            }
        },
        fillFinish: () => {
            if ($(".opt+div+div input:eq(1)")) {
                $(".opt+div+div input:eq(1)").click();
            } else {
                $(".button_short:eq(2)").click();
            }
        }
    });
    WorkerJSPlus({
        name: "广开",
        match: (location.host === "moodle.syxy.ouchn.cn" || location.host === "xczxzdbf.moodle.qwbx.ouchn.cn" || location.host === "course.ougd.cn" || location.host === "elearning.bjou.edu.cn" || location.host === "study.ouchn.cn") && location.pathname.includes("/mod/quiz/attempt.php"),
        root: ".formulation",
        elements: {
            question: ".qtext",
            options: ".answer div label,.flex-fill",
            $options: ".answer div input:visible"
        },
        ignore_click: $item => {
            return Boolean($item.parent().find("input").eq(-1).prop("checked"));
        },
        wrap: obj => {
            if (obj.$options.length === 2) {
                obj.type = 3;
            } else if (obj.options.length >= 4 && obj.$options.eq(0).attr("type") === "checkbox") {
                obj.type = 1;
            } else if (obj.options.length >= 4 && obj.$options.eq(0).attr("type") === "radio") {
                obj.type = 0;
            }
            obj.options = obj.options.map(i => {
                return formatString(i.trim());
            });
        },
        finished: () => {
            $(".submitbtns .btn-primary").click();
        }
    });
    WorkerJSPlus({
        name: "保定继续教育",
        match: location.pathname.includes("/exam/answer.html"),
        root: ".stem-container",
        elements: {
            question: ".stem  span",
            options: ".option div .optStem",
            $options: ".option div input"
        },
        intv: () => {
            return $("#question").length;
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().parent().find(".description").text());
        }
    });
    WorkerJSPlus({
        name: "noNiExam.js",
        match: location.pathname === "/app-afstudy/self_test.html",
        root: ".lineClass .b-papp-root",
        elements: {
            question: ".b-exam-top  .b-exam-tit",
            options: ".b-exam-box li label",
            $options: ".b-exam-box li  input",
            type: ".b-exam-top .b-exam-type"
        },
        ignore_click($item) {
            return $item.prop("checked");
        },
        wrap(obj) {
            obj.options = obj.options.map(i => {
                return i.replace(/[A-Za-z][\:]/, "").replace(/[A-Za-z][\:,\:]/, "").replace(/\;/, "").trim();
            });
        }
    });
    WorkerJSPlus({
        name: "www_pbaqks_com_text",
        match: location.host === "www.pbaqks.com" && location.pathname.includes("/P_ExamDetail/OnlineStuday"),
        root: ".main-container .single-box",
        elements: {
            question: ".single-main:first",
            options: ".choose-box label",
            $options: ".choose-box label",
            type: ".single-container .font-title",
            answer: "input:eq(1)"
        },
        ignore_click: $i => {
            return $i.find("input").is(":checked");
        },
        wrap: obj => {
            obj.question = obj.question.replace("标准答案", "").replace(/^\d+\./, "").replace(/\[.+?\]/g, "").trim();
        },
        fillFinish: () => {
            if ($(".main-container .single-box").find("input:eq(1)").eq(GLOBAL.index - 1).attr("value").split("").length > 1) {
                jQuery(".main-container .confirm a:last-child").click();
            }
        }
    });
    WorkerJSPlus({
        name: "安徽继续教育",
        intv: () => {
            if (location.pathname.includes("/study/html/content/studying/")) return true;
            return $(".e-save-b").length || $(".e-b-g").length;
        },
        match: location.pathname.includes("/study/html/content/studying/") || (location.pathname === "/study/html/content/tkOnline/" || location.pathname === "/study/html/content/sxsk/"),
        root: ".e-q",
        elements: {
            question: ".e-q-q .ErichText",
            options: ".e-a-g li",
            $options: ".e-a-g li"
        },
        hook: () => {
            hookJSON();
            if (GLOBAL.finish || $("a:contains(已完成批阅)").length === 1) {
                iframeMsg("tip", {
                    type: "hidden",
                    tip: "本页面已做完,无需自动答题"
                });
                return true;
            }
        },
        ignore_click: $item => {
            return $item.attr("class").includes("checked");
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.$item.parent().prev().find(".e-text").text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/^[ab]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        }
    });
    WorkerJSPlus({
        name: "大连/九江",
        match: location.href.includes("/onlineclass/exam/"),
        root: ".single_excer_item___2lGB8",
        elements: {
            question: ".title_content___24J6D .title_content_text___8ruL4",
            options: ".options_content___2YgyG label .option_text___1mfcu",
            $options: ".options_content___2YgyG label input",
            type: ".title_content___24J6D span:eq(1)"
        },
        intv: () => {
            return $(".excer_list_view___YOSCa").length;
        },
        ignore_click: $item => {
            return $($item).parent().hasClass("ant-checkbox-checked");
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                $option.val(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "新疆继续教育",
        hook: () => {
            hookJSON();
        },
        match: location.host === "www.ttcdw.cn" && location.pathname.includes("/p/uExam/goExam/"),
        root: ".question-item",
        elements: {
            question: ".question-item-title span",
            options: ".question-item-option label .el-checkbox__label,.el-radio__label",
            $options: ".question-item-option label"
        },
        wrap: obj => {
            const ele = GLOBAL.json[GLOBAL.index - 1];
            obj.type = ele.type;
            obj.question = ele.question;
            obj.answer = ele.answer;
        },
        intv: () => {
            return !$("div").hasClass("entrying-wrap");
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        fill: (type, answer, $option) => {
            if (type === 4 || type === 2) {
                $option.val(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "华侨继续教育",
        match: location.pathname.includes("/exam/student/exam/resource/paper_card2"),
        intv: () => {
            return $(".ui-question-answer-right").length === 0;
        },
        root: ".ui-question-group .ui-question",
        elements: {
            question: ".ui-question-title  div",
            options: ".ui-question-options  div",
            $options: ".ui-question-options .ui-question-options-order,.ke-container"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find("h2").text());
        },
        ignore_click: $item => {
            return $item.parent().hasClass("ui-option-selected");
        },
        fill: (type, answer) => {
            if (type === 4 || type === 2 || type === 6) {
                const x = GLOBAL.index - $(".ui-question-options ").length - 1;
                KindEditor.instances[x].html(answer);
            }
        }
    });
    WorkerJSPlus({
        name: "上海开放大学",
        match: location.pathname.includes("/study/assignment/preview.aspx") || location.pathname.includes("/study/assignment/continuation.aspx"),
        hook: () => {
            if (GLOBAL.finish || $("a:contains(已完成批阅)").length === 1) {
                iframeMsg("tip", {
                    type: "hidden",
                    tip: "本页面已做完,无需自动答题"
                });
                return true;
            }
        },
        root: ".e-q",
        elements: {
            question: ".e-q-q .ErichText",
            options: ".e-a-g li",
            $options: ".e-a-g li"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().parent().parent().find(".e-text").eq(0).text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.attr("class").includes("checked");
        }
    });
    WorkerJSPlus({
        name: "浙江考试",
        match: location.pathname === "/web-qz/moni/exam/exam_toExam.action",
        root: ".dt_tmcon",
        elements: {
            question: "div:eq(0) span:eq(1)",
            options: "div:eq(1) p",
            $options: "div:eq(1) p input"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parents().find(".dt_rtitle1").eq(0).text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
            if (obj.type === 0) {
                obj.answer = [ JSON.parse($("#quesSSForm #userAnssStr_0").val()).rightAnswer ];
                uploadAnswer([ obj ]);
            }
        },
        finished: () => {
            return $(".page li input:eq(2)").attr("disabled") !== "disabled";
        },
        fillFinish: () => {
            $(".page li input:eq(2)").click();
        }
    });
    WorkerJSPlus({
        name: "在浙学考试",
        match: location.host === "www.zjooc.cn",
        hook: () => {
            hookJSON();
        },
        intv: () => {
            return location.pathname.includes("/homework/do/") || location.pathname.includes("/test/do/") || location.pathname.includes("/exam/do/");
        },
        root: ".questiono-item",
        elements: {
            question: "h6 .processing_img",
            options: ".questiono-main label .el-radio__label,.el-checkbox__label",
            $options: ".questiono-main label"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().prev().text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        }
    });
    WorkerJSPlus({
        name: "在浙学测验",
        match: location.host === "www.zjooc.cn",
        intv: () => {
            return $(".settingsel-dialog").css("display") === "none";
        },
        root: ".question_content",
        elements: {
            question: ".question_title",
            options: ".question_content .radio_content div",
            $options: ".question_content  label"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find(".question_title p").eq(0).text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        },
        ignore_click: $item => {
            return $item.hasClass("is-checked");
        },
        finished: () => {
            if ($(".question_btn .el-button:contains(下一题)").hasClass("is-disabled")) return false;
            $(".el-button:contains(下一题)").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "福建继续教育测验",
        match: location.pathname === "/Web_Study/Student/Center/MyWorkOnView" || location.pathname === "/Web_Study/Student/Center/MyExamOnView",
        intv: () => {
            return $(".samllTopicNav").length;
        },
        root: ".topic-cont",
        elements: {
            question: ".text",
            options: ".options li span",
            $options: ".options li"
        },
        wrap: obj => {
            obj.options = obj.options.map(i => {
                return i.replace(/选项[A-Za-z]/, "").trim();
            });
            if (obj.type.attr("itemtype") === 1) {
                obj.type = 0;
            } else if (obj.type.attr("itemtype") === 2) {
                obj.type = 1;
            } else if (obj.type.attr("itemtype") === 3) {
                obj.type = 3;
            }
        },
        ignore_click: $item => {
            return $item.hasClass("correct");
        }
    });
    WorkerJSPlus({
        name: "湖南继续教育",
        match: location.host === "www.jwstudy.cn" && location.pathname.includes("/User/Student/myhomework.aspx") || location.pathname.includes("/examing.aspx"),
        root: ".exam_question",
        elements: {
            question: ".exam_question_title  div",
            options: ".question_select  .select_detail",
            $options: ".question_select li",
            type: ".exam_question_title div strong"
        },
        ignore_click: $item => {
            return $item.hasClass("cur");
        }
    });
    WorkerJSPlus({
        name: "德阳继续教育",
        match: location.href.includes("/dypx/OnlineExam/Exam.aspx"),
        root: "#divProblemArea",
        elements: {
            question: "#ulProblems li:first",
            options: "#ulProblems .answer",
            $options: "#ulProblems .answer input"
        },
        ignore_click: $item => {
            return $item.prop("checked");
        },
        wrap: obj => {
            if ($("#ulProblems .answer input").length < 3 && $("#ulProblems .answer input").eq(0).attr("type") === "radio") {
                obj.type = 3;
                obj.options = [ "正确", "错误" ];
            } else if ($("#ulProblems .answer input").length > 2 && $("#ulProblems .answer input").eq(0).attr("type") === "radio") {
                obj.type = 0;
            } else if ($("#ulProblems .answer input").length > 2 && $("#ulProblems .answer input").eq(0).attr("type") === "checkbox") {
                obj.type = 1;
            }
        },
        finished: () => {
            if ($(".dlg").length) return false;
            $("#divBtns input:eq(1)").click();
            return true;
        }
    });
    WorkerJSPlus({
        name: "淄博继续教育",
        match: location.pathname.includes("/practice/start"),
        root: ".header-left .trueorfalse .sub",
        elements: {
            question: ".mb10",
            options: ".options li",
            $options: ".options li"
        },
        ignore_click: $item => {
            return $item.hasClass("active");
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().prev().text());
            obj.options = obj.options.map(i => {
                return formatString(i.replaceAll(/[a-zA-z]\)\s+/g, "").replaceAll(/^[a-z]\s+/g, "").replaceAll(/^[a-z]、\s+/g, "").trim());
            });
        }
    });
    WorkerJSPlus({
        name: "河北继续教育",
        match: location.pathname.includes("paperid"),
        root: ".examItem",
        elements: {
            question: ".examItemRight  .question",
            options: ".examItemRight  ul li span",
            $options: ".examItemRight  ul li"
        },
        ignore_click: $item => {
            return $item.hasClass("cur");
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find(".questTitle b").text());
        }
    });
    WorkerJSPlus({
        name: "保定继续教育",
        match: location.pathname.includes("/cuggw/rs/olex_exam") || location.pathname.includes("/hebic/rs/olex_exam") || location.pathname.includes("/sjzkjxy/rs/olex_exam"),
        intv: () => {
            return $(".paper_body").length;
        },
        root: ".item_li",
        elements: {
            question: ".item_title",
            options: "ul li label",
            $options: "ul li input"
        },
        wrap: obj => {
            if (obj.$options.length === 2) {
                obj.type = 3;
            } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                obj.type = 0;
            } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") !== "radio") {
                obj.type = 1;
            } else {
                obj.type = 4;
            }
        }
    });
    WorkerJSPlus({
        name: "唐山继续教育",
        match: location.pathname.includes("/exam/student/exam/"),
        intv: () => {
            return $(".ui-question-group").length;
        },
        root: ".ui-question-group .ui-question",
        elements: {
            question: ".ui-question-title .ui-question-content-wrapper",
            options: ".ui-question-options .ui-question-content-wrapper",
            $options: ".ui-question-options .ui-question-options-order"
        },
        wrap: obj => {
            obj.type = getQuestionType(obj.type.parent().find("h2").text());
        }
    });
    function collectXiaoETong() {
        const split = location.pathname.split("/");
        axios.post("https://app5oicyne21998.h5.xiaoeknow.com/evaluation_wechat/exam/review_detail", `bizData%5Bcontent_app_id%5D=&bizData%5Bexam_id%5D=${split[4]}&bizData%5Bparticipate_id%5D=${split[5]}`).then(res => {
            const result = parseXiaoETong(res.data.data.result);
            uploadAnswer(result);
        });
    }
    function collectAnHuiJiXuJiaoYu() {
        const data = location.href.split("?")[1];
        axios.post("https://main.ahjxjy.cn/study/assignment/getAssignment", `${data}&&page=1`).then(res => {
            for (const re of res.data.list) {
                if (re.statusInt === 2) {
                    axios.post("https://main.ahjxjy.cn/study/assignment/loadOnlineAssignment", `${data}&cellId=${re.cellId}`).then(res => {
                        const arr = [];
                        const result = parseAnHuiJx(res.data.data);
                        for (let resultElement of result) {
                            arr.push(...resultElement);
                        }
                        uploadAnswer(arr);
                    });
                }
            }
        });
    }
    function collectPtTkt() {
        const class_room_id = location.pathname.split("/").pop();
        axios.get("https://examination.xuetangx.com/exam_room/show_paper?exam_id=" + class_room_id).then(res => {
            const result = parsePtTkt(res.data.data.problems);
            uploadAnswer(result);
        });
        function parsePtTkt(obj) {
            return obj.map(item => {
                try {
                    const type = TYPE[item.TypeText];
                    if (type >= 4) return;
                    const answer_key_arr = typeof item.Answer === "string" ? item.Answer.split("") : item.Answer;
                    const answer_str_arr = [];
                    const options = type === 2 ? [] : item.Options.map(i => {
                        if (type < 2 && JSON.stringify(answer_key_arr).includes(i.key)) {
                            answer_str_arr.push(formatString(i.value));
                        }
                        return type === 3 ? i.key : formatString(i.value);
                    });
                    if (type === 3) {
                        answer_str_arr.push(...answer_key_arr);
                    } else if (type === 2) {
                        const blanks = item.Blanks.map(item => {
                            return formatString(item.Answers[0]);
                        });
                        answer_str_arr.push(...blanks);
                    }
                    if (answer_str_arr.length > 0) {
                        return {
                            question: formatString(item.Body).replaceAll(/\[填空\d+]/g, "____"),
                            options: options,
                            answer: answer_str_arr,
                            type: type
                        };
                    }
                } catch (e) {
                    console.log(e, item);
                }
            }).filter(item => item !== undefined);
        }
    }
    async function collectYkt() {
        const class_room_id = location.pathname.split("/").pop();
        const instance = axios.create({
            timeout: GLOBAL.timeout,
            headers: {
                xtbz: "ykt",
                "classroom-id": class_room_id
            }
        });
        const res1 = await instance.get("https://" + location.host + "/v2/api/web/logs/learn/" + class_room_id + "?actype=-1&page=0&offset=20&sort=-1");
        for (let activity of res1.data.data.activities) {
            const courseware_id = activity.courseware_id;
            if (activity.type !== 15) continue;
            const res2 = await instance.get(`https://${location.host}/c27/online_courseware/xty/kls/pub_news/${courseware_id}/`);
            const content_info = res2.data.data.content_info;
            for (const content of content_info) {
                const arr = content.leaf_list;
                for (let sectionListElement of content.section_list) {
                    arr.push(...sectionListElement.leaf_list);
                }
                for (let leaf of arr) {
                    if (leaf.leaf_type === 6) {
                        const res3 = await instance.get(`https://${location.host}/mooc-api/v1/lms/learn/leaf_info/${class_room_id}/${leaf.id}/`);
                        const res4 = await instance.get("https://" + location.host + "/mooc-api/v1/lms/exercise/get_exercise_list/" + res3.data.data.content_info.leaf_type_id + "/");
                        uploadAnswer(collectYktWork(res4.data.data.problems));
                    }
                }
            }
        }
        function collectYktWork(collect) {
            return collect.map(item => {
                try {
                    const type = TYPE[item.content.TypeText];
                    if (!/[013]/.test(type)) return;
                    const answer_key_arr = typeof item.user.answer === "string" ? item.user.answer.split("") : item.user.answer;
                    const answer_str_arr = [];
                    const options = item.content.Options.map(i => {
                        if (type <= 1 && JSON.stringify(answer_key_arr).includes(i.key)) {
                            answer_str_arr.push(formatString(i.value));
                        }
                        return type === 3 ? i.key : formatString(i.value);
                    });
                    if (type === 3) answer_str_arr.push(...answer_key_arr);
                    if ((item.user.is_show_answer || item.user.is_right) && item.user.answer && answer_str_arr.length > 0) {
                        return {
                            question: formatString(item.content.Body),
                            options: options,
                            answer: answer_str_arr,
                            type: type
                        };
                    }
                } catch (e) {
                    console.log(e, item);
                }
            }).filter(i => i !== undefined);
        }
    }
    function collect_booway() {
        var data = $(".question").map(function(index, value) {
            return {
                question: formatString(filterImg($(value).find(".question-body-text")).trim()),
                type: TYPE[$(value).find(".question-title").text().match(/\[(.*)\]/)[1]]
            };
        });
        data = $.grep(data.map(function(index) {
            var $TiMu = $(".question").eq(index);
            if ($TiMu.find(".answer-desc-content").text().length > 3) {
                this.analysis = filterImg($TiMu.find(".answer-desc-content"));
            }
            if (this.type === 3) {
                this.answer = $TiMu.find(".answer-desc-summary .answer_value").text().replace("对", "正确").replace("错", "错误");
            } else if (this.type === 1 || this.type === 0) {
                let text = $TiMu.find(".answer-desc-summary").text();
                this.options = $.map($TiMu.find(".question-list-item"), function(value) {
                    return filterImg(value).replace(/^[A-Z]:\s+/, "").replace(/^[A-Z][.|\\.\s]/, "");
                });
                if (text.length > 0) {
                    this.answer = getAnsForKey(text.match(/[A-G]/gi) || [], this.options);
                }
            } else if (this.type === 2) {
                return false;
            } else if (this.type === 4 || this.type === 8 || this.type === 6) {
                return false;
            } else {
                return false;
            }
            return this;
        }), function(value) {
            return value && value.answer != null && value.answer.length > 0 && !value.answer.includes("http://mooc2-ans.chaoxing.com/images/questionbank/icon/ppt.png");
        });
        console.log(data);
        data.length > 0 && uploadAnswer(data);
    }
    function guokaiText() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".card ol .single_selection,.multiple_selection,.true_or_false,.short_answer",
                elements: {
                    question: ".summary-title p,.summary-title .ng-scope",
                    options: ".subject-options li .option-content",
                    $options: ".subject-options label .left",
                    type: ".summary-sub-title span:eq(0)"
                }
            }, obj => {
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        Boolean($.inArray(index, items) + 1) === $item.find("input").hasClass("ng-not-empty") || $item.click();
                    }
                } else if (type === 0 || type === 3) {
                    $option.click();
                } else if (type === 4 || type === 2) {
                    $option.val(answer);
                }
            }).fillAnswer();
        }, GLOBAL.delay * 1.5);
    }
    function wenJuanExam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".g-mn",
                elements: {
                    question: ".m-question .tigan",
                    options: ".question-block .xuanxiang",
                    $options: ".question-block .xuanxiang",
                    type: ".tixing"
                }
            }, obj => {
                if ($(".layui-layer-content").length) {
                    console.log("我到这了", GLOBAL.loop);
                    iframeMsg("tip", {
                        type: "stop",
                        tip: "答题暂停,请自行通过验证"
                    });
                    GLOBAL.stop = true;
                    return undefined;
                }
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        console.log(index, JSON.stringify(items));
                        Boolean($.inArray(index, items) + 1) === $item.parent().find(".icheckbox_square-green").hasClass("checked") || $item.click();
                    }
                    if ($option.parent().find(".icheckbox_square-green").hasClass("checked")) {
                        $('.u-btn-next:contains("下一题")').click();
                    } else {
                        $('.u-btn-next:contains("下一题")').click();
                    }
                } else if (type === 0 || type === 3) {
                    if ($option.parent().find(".iradio_square-green").hasClass("checked")) {
                        $('.u-btn-next:contains("下一题")').click();
                    } else {
                        $option.click();
                    }
                } else if (type === 4 || type === 2); else if (type === undefined) {
                    $('.u-btn-next:contains("下一题")').click();
                }
            }, auto_jump => {
                return true;
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function baoDingExam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".item_li",
                elements: {
                    question: ".item_title",
                    options: "ul li label",
                    $options: "ul li input"
                }
            }, obj => {
                if (obj.$options.length === 2) {
                    obj.type = 3;
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                    obj.type = 0;
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") != "radio") {
                    obj.type = 1;
                }
                console.log(obj);
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1 || type === 0 || type === 3) {
                    $option.click();
                } else if (type === 4 || type === 2 || type === 6) {
                    console.log("自行填充");
                }
            }).fillAnswer();
        }, GLOBAL.delay * 1.5);
    }
    function scmvc_class_gaoxiaobang_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: "#choiceList .listLi,#answersList .listLi,#trueFalseList .listLi",
                elements: {
                    question: ".tit-cont",
                    options: ".option .optionLi-cont",
                    $options: ".option .optionLi-cont"
                }
            }, obj => {
                if (obj.$options.length === 2) {
                    obj.type = 3;
                } else {
                    obj.type = TYPE[obj.type.parent().prev().text().replace(/[0-9]./, "").replace(/[一-二-三-四-五]./, "").split("(")[0].replace(/\s+/, "")];
                }
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function jiaoPeiexam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: "#productTable",
                elements: {
                    question: "#lblQuestion",
                    options: "#rblItems label , #cblItems label",
                    $options: "#rblItems input , #cblItems input",
                    type: "#lblType"
                }
            }, obj => {
                const d = new Date();
                if (d.getDate() == 30) {
                    return obj;
                }
            }, (type, answer, $option, items, $options) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                } else if (type === 4 || type === 2) {
                    $option.val(answer);
                }
            }, () => {
                jQuery("#btnNex").click();
                return true;
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function jmi_jiaowu_cfyedu_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".el-col-16>div:not(.eaxm-description)>div>div",
                elements: {
                    question: ".title",
                    options: ".radio-option",
                    $options: ".radio-option"
                }
            }, obj => {
                obj.options = obj.options.map(i => {
                    return i;
                });
                obj.type = getQuestionType(obj.type.parent().parent().find(".content-title").text().split(":")[1]);
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function training_tisco_com_cn_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".exam-list",
                elements: {
                    question: ".exam-list-title",
                    options: ".exam-list-point label span:last-child",
                    $options: ".exam-list-point label"
                }
            }, obj => {
                obj.question = obj.question.replace("纠错收藏", "").replace(/^\d+\./, "").replace(/\(.+?\)/g, "").trim();
                obj.type = TYPE[obj.type.parent().parent().find(".exam-mask-title").text().replace(/[0-9]./, "").replace(/[一-二-三-四-五]./, "").split("(")[0].replace(/\s+/, "")];
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function www_pbaqks_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".main-container .single-box",
                elements: {
                    question: ".single-main:first",
                    options: ".choose-box label",
                    $options: ".choose-box label",
                    type: ".single-container .font-title",
                    answer: "input:eq(1)"
                }
            }, obj => {
                obj.question = obj.question.replace("标准答案", "").replace(/^\d+\./, "").replace(/\[.+?\]/g, "").trim();
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        Boolean($.inArray(index, items) + 1) === $item.find("input").is(":checked") || $item.click();
                    }
                } else if (type === 0 || type === 3) {
                    $option.click();
                }
            }, () => {}, () => {
                jQuery(".main-container .confirm a:last-child").click();
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function xjskk_open_com_cn_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".list-children-class",
                elements: {
                    question: ".children-value-class",
                    options: ".list-options-class  .option-value-class",
                    $options: ".list-options-class  .option-value-class"
                }
            }, obj => {
                obj.type = TYPE[obj.type.parent().find(".parent").text().replace(/[一-二-三-四-五]./, "").replace(/\(.+?\)/g, "").trim()];
                console.log(obj);
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function cjConsole_wuxiantiaozhan_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".ant-list-items .ant-list-item",
                elements: {
                    question: "div>div:first-child>span:last-child",
                    options: "div>div:last-child>label",
                    $options: "div div:last-child label input"
                }
            }, obj => {
                if (obj.$options.length < 3 && obj.$options.eq(0).attr("type") === "radio") {
                    obj.type = 3;
                    obj.options = [ "正确", "错误" ];
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                    obj.type = 0;
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "checkbox") {
                    obj.type = 1;
                }
                console.log(obj);
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function gptExam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".question",
                elements: {
                    question: ".question-stem",
                    options: ".questions-choices label",
                    $options: ".questions-choices label"
                }
            }, obj => {
                obj.options = obj.options.map(i => {
                    console.log(i);
                    return i.replace(/[A-Za-z]/, "").trim();
                });
                obj.type = getQuestionType(obj.type.parent().parent().find(".topic-headline").text());
                console.log(obj);
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1 || type === 0 || type === 3) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay * 1.5);
    }
    function hnzkw_org_cn_text() {
        showPanel();
        setTimeout(() => {
            console.log(GLOBAL.json);
            new WorkerJS({
                root: ".examList",
                elements: {
                    question: ".text",
                    options: ".el-radio-group label",
                    $options: ".el-radio-group label",
                    type: ".status"
                }
            }, obj => {
                const ele = GLOBAL.json[GLOBAL.index - 1];
                obj.question = ele.question;
                obj.answer = ele.answer;
                obj.type = ele.type;
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                } else if (type === 4 || type === 2) {
                    UE$1.getEditor($option.attr("name")).setContent(answer);
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function www_learnin_com_cn_test() {
        var ix = 0;
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".store-question-item-container, .store-question-item-merge-content-item",
                elements: {
                    question: ".question-title",
                    options: ".question-option-list .option-content",
                    $options: ".question-option-list .option-index",
                    type: ".header-left,.sub-question-title"
                }
            }, obj => {
                console.log(obj);
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        Boolean($.inArray(index, items) + 1) === $item.hasClass("active") || $item.click();
                    }
                } else if (type === 0 || type === 3) {
                    $option.click();
                } else if (type === 4 || type === 2) {
                    document.querySelectorAll(".am-engine")[ix].innerHTML = answer;
                    ix++;
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function collectLearnin() {
        new HTMLCollect({
            root: ".store-question-item-container, .store-question-item-merge-content-item",
            elements: {
                question: ".question-title",
                options: ".question-option-list .option-content",
                answer: ".question-answer-exhibition .answer-content:hidden",
                type: ".header-left,.sub-question-title"
            }
        }, data => {
            if (data.type === 3) {
                data.answer = data.answer[0] === "F" ? "错误" : "正确";
            }
            console.log(data);
            return data;
        }).collectAnswer().then(res => {
            let arr = res.filter(i => i.options.length < 8);
            uploadAnswer(arr);
        });
    }
    function ks_zjtvu_edu_cn_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".item",
                elements: {
                    question: "#RESPONSE",
                    options: "li label",
                    $options: "li input",
                    answer: "span[name=answer]"
                }
            }, obj => {
                if (obj.$options.length === 2) {
                    obj.type = 3;
                    uploadAnswer([ obj ]);
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                    obj.type = 0;
                    uploadAnswer([ obj ]);
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") !== "radio") {
                    obj.type = 1;
                    obj.answer = null;
                }
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        Boolean($.inArray(index, items) + 1) === $item.get(0).checked || $item.click();
                    }
                } else if (type === 0 || type === 3) {
                    $option.click();
                }
            }, async auto_jump => {
                var tok = parseInt($("#testPaperContent .item").eq(0).attr("itemtype"));
                if (parseInt(tok) === $("#testTitle a").length) {
                    return false;
                }
                Section("S0" + (tok + 1));
                await sleep(1e3);
                return true;
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function xk_scrtvu_net_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".TestItemBody",
                elements: {
                    question: "span:eq(0)",
                    options: ".TestSingleOptionBody span",
                    $options: ".TestSingleOptionBody input"
                }
            }, obj => {
                if (obj.$options.length === 2) {
                    obj.type = 3;
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") === "radio") {
                    obj.type = 0;
                } else if (obj.$options.length > 2 && obj.$options.eq(0).attr("type") !== "radio") {
                    obj.type = 1;
                }
                return obj;
            }, (type, answer, $option, items, $options) => {
                if (type === 1) {
                    for (let index = 0; index < $options.length; index++) {
                        const $item = $options.eq(index);
                        Boolean($.inArray(index, items) + 1) === $item.get(0).checked || $item.click();
                    }
                } else if (type === 0 || type === 3) {
                    $option.click();
                }
            }, async auto_jump => {}).fillAnswer();
        }, GLOBAL.delay);
    }
    function www_zaixiankaoshi_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".topic",
                elements: {
                    question: ".qusetion-box",
                    options: ".select-left .option span:has(p)",
                    $options: ".select-left .option",
                    type: ".topic-type"
                }
            }, obj => {
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3 || type === 1) {
                    $option.click();
                }
            }, auto_jump => {
                if ($(".next-preve button:last-child").hasClass("is-disabled")) return false;
                $(".next-preve button:last-child").click();
                return true;
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    function www_uooconline_com_exam() {
        showPanel();
        setTimeout(() => {
            new WorkerJS({
                root: ".queContainer",
                elements: {
                    question: ".ti-q",
                    options: ".ti-alist label",
                    $options: ".ti-alist label"
                }
            }, obj => {
                obj.type = TYPE[obj.type.parent().find(".queItems-type").text().replace(/[一-二-三-四-五]./, "").replace(/\(\共.+?\分\)/g, "").trim()];
                console.log(obj);
                return obj;
            }, (type, answer, $option) => {
                if (type === 0 || type === 3) {
                    $option.click();
                } else if (type === 1) {
                    $option.click();
                }
            }).fillAnswer();
        }, GLOBAL.delay);
    }
    if (location.pathname.includes("/v2/web/studentLog")) {
        collectYkt();
    } else if (location.host === "examination.xuetangx.com" && location.pathname.includes("/result")) {
        collectPtTkt();
    } else if (location.pathname.includes("/evaluation_wechat/examination/review")) {
        collectXiaoETong();
    } else if (location.pathname === "/study/html/content/assignment/") {
        collectAnHuiJiXuJiaoYu();
    } else if (location.pathname.includes("/Portal/student/practice-improve/")) {
        collect_booway();
    } else if (location.host === "lms.ouchn.cn" && location.pathname.includes("/exam/")) {
        setIntervalFunc(() => {
            return $(".loading-gif").hasClass("ng-hide") && $(".hd .examinee .submit-label").eq(0).text() === "";
        }, guokaiText);
    } else if ((location.host === "examination.xuetangx.com" || location.host === "changjiang-exam.yuketang.cn") && location.pathname.includes("/result/")) {
        hookJSON();
    } else if (location.pathname.includes("/exam/ExamRd/Answer")) {
        wenJuanExam();
    }
  
})();