diff --git a/README.md b/README.md
index 802bd4e..358d403 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
# 学习达人
-本插件基于原开源插件`学习小熊`的版本,针对新的文章视频阅读规则开发的二次版本。
+## 自用!
## 更新说明
-v1.3.4(2022-06-21):
+v3.0.0(2022-06-23):
- 1.专项答题只答当年题目
+ 1.更新chrome插件manifest v3 请使用支持v3扩展的浏览器版本
+ 2.专项答题现在只做当年题目,往年题目不再答题
+ 3.v2扩展有时间再优化下
+
## 下载
* [最新发布](https://github.com/Huozzzy/Learning-Learner/releases/)
@@ -12,7 +15,7 @@ v1.3.4(2022-06-21):
## 安装方法
* Chrome
- * 下载zip并解压。
+ * 下载crx扩展,修改后缀为zip并解压。
* 在地址栏输入 `chrome://extensions` 并回车,勾选 **开发者模式** -> **加载已解压的扩展程序**, 选择解压的 `Learning-Learner` 文件夹。
@@ -22,7 +25,6 @@ v1.3.4(2022-06-21):
* 如果没有登录,请在打开的小窗口中进行登录。
* 等待打开的小窗口中的程序完成“学习”,期间你可以用这台电脑做其他事情,但不要 `最小化` 或 `关闭` 那个窗口。
- 其余浏览器安装方法,请自行搜索!
## 许可证
![GPLv3](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)
diff --git a/background.js b/background.js
new file mode 100755
index 0000000..bfcd415
--- /dev/null
+++ b/background.js
@@ -0,0 +1,389 @@
+let scoreData = 0;
+let urlMap = {
+ "index": "https://www.xuexi.cn",
+ "points": "https://pc.xuexi.cn/points/my-points.html",
+ "scoreApi": "https://pc-proxy-api.xuexi.cn/api/score/days/listScoreProgress?sence=score&deviceType=2",
+ "channelApi": "https://www.xuexi.cn/lgdata/",
+ "loginUrl": "https://pc.xuexi.cn/points/login.html",
+ "dailyAsk": ["https://pc.xuexi.cn/points/exam-practice.html"],
+ // "weeklyAsk": ["https://pc.xuexi.cn/points/exam-weekly-list.html"],
+ "paperAsk": ["https://pc.xuexi.cn/points/exam-paper-list.html"]
+};
+let channel = {
+ "articleUrl": [
+ "1jpuhp6fn73", // 重要活动
+ "19vhj0omh73", // 重要会议
+ "132gdqo7l73", // 重要讲话
+ "35il6fpn0ohq", // 学习重点
+ "1ap1igfgdn2", // 学习时评
+ "slu9169f72", // 中宣部发布
+ "tuaihmuun2", // 新文发布厅
+ "1oo5atvs172", // 文化广场
+ "1eppcq11fne", // 科技思想研究
+ "152ijthp37e", // 科技前沿
+ "1jscb6pu1n2", // 重要新闻
+ "1ajhkle8l72", // 综合新闻
+ ],
+ "videoUrl": [
+ "2qfjjjrprmdh", // 国防军事新文
+ "525pi8vcj24p", // 红色书信
+ "1novbsbi47k", // 重要活动视频专辑
+ "1742g60067k", // 学习新视界
+ "1koo357ronk", // 学习专题报道
+ "1f8iooppm7l", // 文艺广场
+ "eta8vnluqmd", // 军事科技
+ "16421k8267l", // 强军V视
+ "41gt3rsjd6l8", // 绿色发展
+ ]
+};
+
+// 学习开始
+function startRun() {
+ chrome.storage.local.get(["studyConfig", "paperTitle", "studyWindowId", "studyTabId"], function (result) {
+ if (result.studyWindowId && result.studyTabId) {
+ // 获取积分数据
+ fetch(urlMap.scoreApi)
+ .then((response) => response.json())
+ .then(function (requestData) {
+ if (requestData.hasOwnProperty("code") && parseInt(requestData.code) === 200) {
+ scoreData = requestData.data;
+ // 浏览器扩展图标
+ chrome.action.setBadgeText({"text": scoreData.totalScore.toString()});
+ // 获取请求类型
+ let type;
+ type = getTypeByPoint(scoreData.taskProgress, result.studyConfig, result.paperTitle );
+ if (typeof (type) != "undefined" && type != null) {
+ (async () => {
+ const url = await getUrlByType(type);
+ if (typeof (url) != "undefined" && url != null) {
+ chrome.tabs.sendMessage(result.studyTabId, {
+ "type": "redirect",
+ "url": url
+ });
+ } else {
+ // 定时重新执行
+ setTimeout(startRun, Math.floor(10000 + Math.random() * 30 * 1000));
+ // 获取页面失败
+ noticeMessage(chrome.i18n.getMessage("extChannelApi"), chrome.i18n.getMessage("extUpdate"));
+ }
+ })();
+ } else {
+ setTimeout(stopStudy, Math.floor(5000 + Math.random() * 1000));
+ }
+ } else {
+ // 跳转登录页面
+ chrome.tabs.update(studyTabId, {
+ "active": true,
+ "url": urlMap.loginUrl + "?ref=" + urlMap.points
+ });
+ }
+ })
+ .catch(error => function (error) {
+ console.log(error);
+ // 定时重新执行
+ setTimeout(startRun, Math.floor(10000 + Math.random() * 30 * 1000));
+ });
+ }
+ });
+
+ return true;
+}
+
+// 获取url
+async function getUrlByType(type) {
+ let url;
+
+ if (type == "paper") {
+ url = urlMap.paperAsk;
+ } else if (type == "day") {
+ url = urlMap.dailyAsk;
+ } else {
+ let key;
+ if (type == "article") {
+ key = ArrayRandom(channel.articleUrl);
+ } else {
+ key = ArrayRandom(channel.videoUrl);
+ }
+ try {
+ const response = await fetch(urlMap.channelApi + key + ".json?_st=" + Math.floor(Date.now() / 6e4));
+ const urlData = await response.json();
+
+
+ let urlList = [];
+ let urlTemp;
+ let publishTime;
+ for (key in urlData) {
+ if (!urlData.hasOwnProperty(key)) {
+ continue;
+ }
+ if (urlData[key].hasOwnProperty("url")) {
+ urlTemp = urlData[key].url;
+ // 判断发布时间是否是365天之内,如果没有,判断url规则
+ if (urlData[key].hasOwnProperty("publishTime")) {
+ publishTime = new Date(urlData[key].publishTime);
+ var lastYear = new Date(new Date() - 365 * 86400000);
+ if (publishTime < lastYear) {
+ continue;
+ }
+ } else {
+ if (urlTemp.indexOf("lgpage/detail/index") === -1) {
+ continue;
+ }
+ }
+
+ if (urlList.indexOf(urlTemp) === -1) {
+ urlList.push(urlTemp);
+ }
+ }
+ }
+ if (urlList.length) {
+ url = ArrayRandom(urlList);
+ }
+
+ } catch (error) {
+ console.log(error);
+ }
+ }
+
+ return url;
+}
+
+// 1阅读文章,2试听学习,4专项答题,5每周答题,6每日答题,9登录,1002文章时长,1003视听学习时长
+function getTypeByPoint(score, configs, paperTitle ) {
+ let type;
+ let config = configs.sort(function (a, b) {
+ return a.sort - b.sort;
+ });
+
+ let task = new Array();
+ task['article'] = false;
+ task['video'] = false;
+ task['paper'] = false;
+ // task['week'] = false;
+ task['day'] = false;
+
+
+ for (let key in score) {
+ if (!score.hasOwnProperty(key)) {
+ continue;
+ }
+ if (task['article'] == false && (score[key].sort == 200 )) {
+ if (score[key].currentScore < score[key].dayMaxScore) {
+ task['article'] = true;
+ }
+ }
+ if (task['video'] == false && score[key].sort == 300) {
+ if (score[key].currentScore < score[key].dayMaxScore) {
+ task['video'] = true;
+ }
+ }
+ if (task['video'] == false && score[key].sort == 400) {
+ if (score[key].currentScore < score[key].dayMaxScore) {
+ task['video'] = true;
+ }
+ }
+ if (task['paper'] == false && score[key].sort == 700) {
+ if (paperTitle == 0 && score[key].currentScore <= 0) {
+ task['paper'] = true;
+ }
+ }
+
+ if (task['day'] == false && score[key].sort == 500) {
+ if (score[key].currentScore < score[key].dayMaxScore) {
+ task['day'] = true;
+ }
+ }
+ }
+
+ for (let i = 0; i < config.length; i++) {
+ if (config[i].flag == true && task[config[i].type] == true) {
+ type = config[i].type;
+ break;
+ }
+ }
+ return type;
+}
+
+// 开始学习
+function startStudy() {
+ // 获取数据,判断执行
+ chrome.storage.local.get(["studyWindowId"], function (result) {
+ if (!result.studyWindowId) {
+ chrome.windows.create({
+ "url": urlMap.points,
+ "type": "popup",
+ // "state": "fullscreen"
+ "top": 0,
+ "left": 0,
+ "width": 350,
+ "height": 350
+ }, function (window) {
+ chrome.storage.local.set({
+ "studyWindowId": window.id,
+ "studyTabId": window.tabs[window.tabs.length - 1].id,
+ "paperTitle": 0
+ }, function () {
+ // 静音处理
+ chrome.tabs.update(window.tabs[window.tabs.length - 1].id, { "muted": true });
+ // 开始学习
+ noticeMessage(chrome.i18n.getMessage("extWorking"), chrome.i18n.getMessage("extWarning"));
+ });
+ });
+ } else {
+ // 学习中
+ noticeMessage(chrome.i18n.getMessage("extWorking"), chrome.i18n.getMessage("extLearning"));
+
+ // 设置焦点
+ chrome.windows.update(result.studyWindowId, { "focused": true });
+ }
+ });
+ return true;
+}
+
+// 停止学习,需要关闭
+function stopStudy() {
+ // 获取数据,判断执行
+ chrome.storage.local.get(["studyWindowId"], function (result) {
+ if (result.studyWindowId) {
+ // 关闭窗口
+ chrome.windows.remove(result.studyWindowId, function () {
+ noticeMessage(chrome.i18n.getMessage("extFinish"));
+ });
+ // 重置参数
+ chrome.storage.local.remove(["studyWindowId", "studyTabId"]);
+ chrome.action.setBadgeText({ text: "" });
+ }
+ });
+ return true;
+}
+
+// 通知消息
+function noticeMessage(title, message = "") {
+ chrome.notifications.create({
+ "type": "basic",
+ "iconUrl": "img/Pikachu-128.png",
+ "title": title,
+ "message": message
+ }, function (notificationId) {
+ setTimeout(function () {
+ chrome.notifications.clear(notificationId);
+ }, 3000);
+ });
+}
+
+
+// 数据随机取一条
+function ArrayRandom(array) {
+ var index = Math.floor((Math.random() * array.length));
+ return array[index];
+}
+
+
+// tab移除监听事件
+chrome.tabs.onRemoved.addListener(function (tabId, removeInfo) {
+ // 获取数据,判断执行
+ chrome.storage.local.get(["studyTabId"], function (result) {
+ if (result.studyTabId && tabId == result.studyTabId) {
+ chrome.storage.local.remove(["studyWindowId", "studyTabId"]);
+ chrome.action.setBadgeText({ text: "" });
+ }
+ });
+ return true;
+});
+
+// 窗口移除监听事件
+chrome.windows.onRemoved.addListener(function (windowId) {
+ chrome.storage.local.get(["studyWindowId"], function (result) {
+ if (result.studyWindowId && result.studyWindowId == windowId) {
+ chrome.storage.local.remove(["studyWindowId", "studyTabId"]);
+ chrome.action.setBadgeText({ text: "" });
+ }
+ });
+ return true;
+});
+
+// 后台监听事件消息
+chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
+
+ let requestType = message.type;
+
+ switch (requestType) {
+ // 检测扩展是否运行
+ case "checkRunning":
+ chrome.storage.local.get(["studyWindowId"], function (result) {
+ let runtime = false;
+ if (result.studyWindowId) {
+ runtime = true;
+ }
+ sendResponse({ "runtime": runtime });
+ });
+ break;
+
+ // 检测是否是扩展开启状态
+ case "checkAuth":
+ sendResponse({ "runtime": true });
+ break;
+
+ // 开始学习
+ case "startStudy":
+ startStudy();
+ sendResponse({ "complete": 1 });
+ break;
+
+ // 结束学习
+ case "stopStudy":
+ stopStudy();
+ sendResponse({ "complete": 1 });
+ break;
+
+ // 开始运行
+ case "startRun":
+ startRun();
+ sendResponse({ "complete": 1 });
+ break;
+
+ // 专项答题
+ case "paperTitle":
+ chrome.storage.local.set({ "paperTitle": 1 });
+ startRun();
+ sendResponse({ "complete": 0 });
+ break;
+
+ // 学习完成
+ case "studyComplete":
+ startRun();
+ sendResponse({ "complete": 0 });
+ break;
+
+ // 回答错误
+ case "answerError":
+ noticeMessage(chrome.i18n.getMessage("extName"), chrome.i18n.getMessage("extAnswerError"))
+ sendResponse({ "complete": 0 });
+ break;
+ }
+ return true;
+});
+
+// 插件安装监听事件
+chrome.runtime.onInstalled.addListener(() => {
+
+ chrome.storage.local.clear();
+
+ let studyConfig = [
+ { "type": "day", "order": 1, "title": "每日答题", "time": 0, "flag": true },
+ { "type": "paper", "order": 2, "title": "专项答题", "time": 0, "flag": true },
+ { "type": "article", "order": 3, "title": "文章学习", "time": 60, "flag": true },
+ { "type": "video", "order": 4, "title": "视频学习", "time": 60, "flag": true }
+ ];
+
+ // 设置初始数据
+ chrome.storage.local.set({
+ "studyConfig": studyConfig,
+ "env": "idc"
+ });
+});
+
+//扩展按钮点击事件
+chrome.action.onClicked.addListener(function (tab) {
+ startStudy();
+});
\ No newline at end of file
diff --git a/js/background.js b/js/background.js
deleted file mode 100755
index 001169b..0000000
--- a/js/background.js
+++ /dev/null
@@ -1,530 +0,0 @@
-let scoreTabId = 0, runningTabId = 0, scoreWindowId = 0, runningWindowId = 0, channelUrls = {}, userId = 0,
- usedUrls = {}, chooseLogin = 0, weeklyTitle = 0, paperTitle = 0;
-let windowWidth = 350 ;
-let windowHeight = 350 ;
-let chromeVersion = (/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [0, 0])[1];
-let firefoxVersion = (/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [0, 0])[1];
-let isMobile = !!(/Mobile/.exec(navigator.userAgent));
-let urlMap = {
- "index": "https://www.xuexi.cn",
- "points": "https://pc.xuexi.cn/points/login.html?ref=https%3A%2F%2Fpc.xuexi.cn%2Fpoints%2Fmy-points.html",
- "scoreApi": "https://pc-proxy-api.xuexi.cn/api/score/days/listScoreProgress?sence=score&deviceType=2",
- "channelApi": "https://www.xuexi.cn/lgdata/",
- "dailyAsk": ["https://pc.xuexi.cn/points/exam-practice.html"],
- // "weeklyAsk": ["https://pc.xuexi.cn/points/exam-weekly-list.html"],
- "paperAsk": ["https://pc.xuexi.cn/points/exam-paper-list.html"]
-};
-let channel = {
- 'article': [
- "35il6fpn0ohq|https://www.xuexi.cn/98d5ae483720f701144e4dabf99a4a34/5957f69bffab66811b99940516ec8784.html",
- "1ap1igfgdn2|https://www.xuexi.cn/d05cad69216e688d304bb91ef3aac4c6/9a3668c13f6e303932b5e0e100fc248b.html",
- "slu9169f72|https://www.xuexi.cn/105c2fa2843fa9e6d17440e172115c92/9a3668c13f6e303932b5e0e100fc248b.html",
- "tuaihmuun2|https://www.xuexi.cn/bab787a637b47d3e51166f6a0daeafdb/9a3668c13f6e303932b5e0e100fc248b.html",
- "1oo5atvs172|https://www.xuexi.cn/00f20f4ab7d63a1c259fff55be963558/9a3668c13f6e303932b5e0e100fc248b.html",
- "1gohlpfidnc|https://www.xuexi.cn/4954c7f51c37ef08e9fdf58434a8c1e2/5afa2289c8a14feb189920231dadc643.html",
- "1eppcq11fne|https://www.xuexi.cn/0db3aecacaed782aaab2da53498360ad/5957f69bffab66811b99940516ec8784.html",
- "152ijthp37e|https://www.xuexi.cn/f64099d849c46d8b64b25e3313e1b172/5957f69bffab66811b99940516ec8784.html",
- ],
- 'video': [
- "2qfjjjrprmdh|https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/db086044562a57b441c24f2af1c8e101.html#1oajo2vt47l-5",
- "3m1erqf28h0r|https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/db086044562a57b441c24f2af1c8e101.html#1oajo2vt47l-5",
- "525pi8vcj24p|https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/db086044562a57b441c24f2af1c8e101.html#1oajo2vt47l-5",
- "48cdilh72vp4|https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/db086044562a57b441c24f2af1c8e101.html#1oajo2vt47l-5",
- "1novbsbi47k|https://www.xuexi.cn/a191dbc3067d516c3e2e17e2e08953d6/b87d700beee2c44826a9202c75d18c85.html",
- "1742g60067k|https://www.xuexi.cn/0b99b2eb0a13e4501cbaf82a5c37a853/b87d700beee2c44826a9202c75d18c85.html",
- ]
-};
-
-//检查用户积分数据
-function getPointsData(callback) {
- if (scoreTabId) {
- try {
-
-
- let xhr = new XMLHttpRequest();
- xhr.open("GET", urlMap.scoreApi);
- xhr.setRequestHeader("Pragma", "no-cache");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4 && xhr.status === 200) {
- let res = JSON.parse(xhr.responseText);
- if (res.hasOwnProperty("code") && parseInt(res.code) === 200) {
- if (checkScoreAPI(res)) {
- // if (!isMobile) {
- chrome.browserAction.setBadgeText({ "text": res.data.totalScore.toString() });
- // }
- if (typeof callback === "function") {
- callback(res.data);
- }
- } else {
- notice(chrome.i18n.getMessage("extScoreApi"), chrome.i18n.getMessage("extUpdate"));
- }
- } else {
- if (runningTabId) {
- chrome.tabs.remove(runningTabId);
- }
- if (runningWindowId) {
- closeWindow();
- }
- chrome.tabs.update(scoreTabId, { "active": true, "url": getLoginUrl() });
- }
- }
- };
- xhr.send();
- } catch (error) {
- autoEarnPoints(5 * 1000);
- }
- }
-}
-
-//检查积分接口数据结构
-function checkScoreAPI(res) {
- if (res.hasOwnProperty("data")) {
- if (res.data.hasOwnProperty("taskProgress")) {
- return true;
- }
- }
- return false;
-}
-
-//检查首页内容数据
-function getChannelData(type, callback) {
- shuffle(channel[type]);
- channelArr = channel[type][0].split('|');
-
- // if (!isMobile) {
- chrome.windows.get(runningWindowId, { "populate": true }, function (window) {
- if (typeof window !== "undefined") {
- chrome.tabs.sendMessage(window.tabs[window.tabs.length - 1].id, {
- "method": "redirect",
- "data": channelArr[1]
- });
- }
- });
- // } else {
- // chrome.tabs.sendMessage(runningTabId, {
- // "method": "redirect",
- // "data": channelArr[1]
- // });
- // }
-
- setTimeout(function () {
- let xhr = new XMLHttpRequest();
- xhr.open("GET", urlMap.channelApi + channelArr[0] + ".json?_st=" + Math.floor(Date.now() / 6e4));
- xhr.setRequestHeader("Accept", "application/json");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- if (xhr.status === 200) {
- let res = JSON.parse(xhr.responseText);
- let list = [];
- let pass = [];
- let url;
-
- for (key in res) {
- if (!res.hasOwnProperty(key)) {
- continue;
- }
- if (res[key].hasOwnProperty("url")) {
- url = res[key].url;
- if (type === 'article') {
- if (url.indexOf("e43e220633a65f9b6d8b53712cba9caa") === -1 && url.indexOf("lgpage/detail/index") === -1) {
- continue;
- }
- } else {
- if (url.indexOf("cf94877c29e1c685574e0226618fb1be") === -1 && url.indexOf("7f9f27c65e84e71e1b7189b7132b4710") === -1 && url.indexOf("lgpage/detail/index") === -1) {
- continue;
- }
- }
- if (list.indexOf(url) === -1 && pass.indexOf(url) === -1) {
- if (usedUrls[type].indexOf(url) === -1) {
- list.push(url);
- } else {
- pass.push(url);
- }
- }
- }
- }
- shuffle(list);
- shuffle(pass);
- list.concat(pass);
-
- if (list.length) {
- if (typeof callback === "function") {
- callback(list);
- }
- } else {
- notice(chrome.i18n.getMessage("extChannelApi"), chrome.i18n.getMessage("extUpdate"));
- }
- }
- }
- };
- xhr.send();
- }, 1000 + Math.floor(Math.random() * 3000));
-}
-
-//自动积分
-function autoEarnPoints(timeout) {
- let url;
- let newTime = 0;
- setTimeout(function () {
- getPointsData(function (data) {
- let score = data.taskProgress;
- let type;
-
- for (let key in score) {
- if (!score.hasOwnProperty(key)) {
- continue;
- }
- switch (score[key].sort) {
- case 100:
- case 200:
- if (score[key].currentScore < score[key].dayMaxScore) {
- type = "article";
- newTime = 60 * 1000 + Math.floor(Math.random() * 1 * 1000);
- }
- break;
- case 300:
- case 400:
- if (score[key].currentScore < score[key].dayMaxScore) {
- type = "video";
- newTime = 60 * 1000 + Math.floor(Math.random() * 1 * 1000);
- }
- break;
- case 500:
- if (score[key].currentScore < score[key].dayMaxScore) {
- type = "exam-practice";
- newTime = 20 * 1000 + Math.floor(Math.random() * 1 * 1000);
- }
- break;
- // 2022-5-24 每周答题不再有新题,跳过每周答题积分的检查
- // case 1700:
- // if (weeklyTitle == 0 && score[key].currentScore <= 0) {
- // type = "exam-weekly";
- // newTime = 50 * 1000 + Math.floor(Math.random() * 2 * 1000);
- // }
- // break;
- case 700:
- if (paperTitle == 0 && score[key].currentScore <= 0) {
- type = "exam-paper";
- newTime = 30 * 1000 + Math.floor(Math.random() * 3 * 1000);
- }
- break;
-
- }
- }
-
- if (type && !channelUrls.hasOwnProperty(type)) {
- if (type === 'article') {
- getChannelData("article", function (list) {
- channelUrls["article"] = list;
- });
- }
- if (type === 'video') {
- getChannelData("video", function (list) {
- channelUrls["video"] = list;
- });
- }
- if (type === 'exam-practice') {
- channelUrls["exam-practice"] = urlMap.dailyAsk;
- }
- // if (type === 'exam-weekly') {
- // channelUrls["exam-weekly"] = urlMap.weeklyAsk;
- // }
- if (type === 'exam-paper') {
- channelUrls["exam-paper"] = urlMap.paperAsk;
- }
- }
-
- if (type && channelUrls[type].length) {
- if (type === 'article' || type === 'video') {
- url = channelUrls[type].shift();
- } else {
- url = channelUrls[type][0];
- }
-
- }
-
- // if (!isMobile) {
- if (url && scoreTabId && runningWindowId) {
- chrome.windows.get(runningWindowId, { "populate": true }, function (window) {
- if (typeof window !== "undefined") {
- chrome.tabs.sendMessage(window.tabs[window.tabs.length - 1].id, {
- "method": "redirect",
- "data": url
- });
- autoEarnPoints(newTime);
- }
- });
- } else {
- closeWindow();
- }
- // } else {
- // if (url && scoreTabId && runningTabId) {
- // chrome.tabs.sendMessage(runningTabId, {
- // "method": "redirect",
- // "data": url
- // });
- // autoEarnPoints(newTime);
- // } else {
- // chrome.tabs.remove(runningTabId);
- // chrome.tabs.remove(scoreTabId);
- // }
- // }
- });
- }, timeout);
-}
-
-//获取最后使用的网址
-function getLastTypeUrl(type, index) {
- let urls = [];
- let length = usedUrls[type].length ? usedUrls[type].length - 1 : 0;
- for (let i = length; i >= 0; --i) {
- if (!usedUrls[type].hasOwnProperty(i)) {
- continue;
- }
- urls.push(usedUrls[type][i]);
-
- if (urls.length >= index + 1) {
- break;
- }
- }
- return urls.hasOwnProperty(index) ? urls[index] : undefined;
-}
-
-//打乱数组
-function shuffle(array) {
- for (let i = array.length - 1; i > 0; i--) {
- const j = Math.floor(Math.random() * (i + 1));
- [array[i], array[j]] = [array[j], array[i]];
- }
-}
-
-//通知
-function notice(title, message = "") {
- // if (!isMobile) {
- chrome.notifications.create({
- "type": "basic",
- "iconUrl": "img/Pikachu-128.png",
- "title": title,
- "message": message
- }, function (notificationId) {
- setTimeout(function () {
- chrome.notifications.clear(notificationId);
- }, 5000);
- });
- // } else {
- // alert(title + (message ? "\n" + message : ""));
- // }
-}
-
-//创建窗口
-function createWindow(url, callback) {
- chrome.windows.create({
- "url": url,
- "type": "popup",
- "top": 0,
- "left": 0,
- "width": windowWidth,
- "height": windowHeight
- }, function (window) {
- if (firefoxVersion) {
- chrome.windows.update(window.id, {
- "top": 0,
- "left": 0,
- });
- }
- chrome.tabs.update(window.tabs[window.tabs.length - 1].id, { "muted": true });
- if (typeof callback === "function") {
- callback(window);
- }
- })
-}
-
-//关闭窗口
-function closeWindow(windowId) {
- if (windowId) {
- chrome.windows.get(windowId, function (window) {
- if (window) {
- chrome.windows.remove(windowId);
- }
- });
- } else {
- if (runningWindowId) {
- chrome.windows.remove(runningWindowId);
- }
- if (scoreWindowId) {
- chrome.windows.remove(scoreWindowId);
- }
- notice(chrome.i18n.getMessage("extFinish"));
- }
-}
-
-//获取登录链接
-function getLoginUrl() {
- return "https://pc.xuexi.cn/points/login.html?ref=https%3A%2F%2Fpc.xuexi.cn%2Fpoints%2Fmy-points.html";
-}
-
-//扩展按钮点击事件
-chrome.browserAction.onClicked.addListener(function (tab) {
- if (chromeVersion < 45 && firefoxVersion < (isMobile ? 55 : 48)) {
- notice(chrome.i18n.getMessage("extVersion"));
- } else {
- // if (!isMobile) {
- if (scoreTabId) {
- if (runningWindowId) {
- chrome.windows.update(runningWindowId, { "focused": true, "state": "normal" });
- } else {
- chrome.windows.update(scoreWindowId, { "focused": true, "state": "normal" });
- }
- } else {
- channelUrls = {};
- chooseLogin = 0;
- // weeklyTitle = 0;
- paperTitle = 0;
- createWindow(urlMap.points, function (window) {
- scoreWindowId = window.id;
- scoreTabId = window.tabs[window.tabs.length - 1].id;
- });
- }
- // } else {
- // if (scoreTabId) {
- // if (runningTabId) {
- // chrome.tabs.update(runningTabId, { "active": true });
- // } else {
- // chrome.tabs.update(scoreTabId, { "active": true });
- // }
- // } else {
- // channelUrls = {};
- // chooseLogin = 0;
- // chrome.tabs.create({ "url": urlMap.points }, function (tab) {
- // scoreTabId = tab.id;
- // });
- // }
- // }
- }
-});
-
-//标签页移除事件
-chrome.tabs.onRemoved.addListener(function (tabId, removeInfo) {
- if (tabId === runningTabId) {
- runningTabId = 0;
- } else if (tabId === scoreTabId) {
- scoreTabId = 0;
- }
-});
-
-//窗口移除事件
-// if (!isMobile) {
- chrome.windows.onRemoved.addListener(function (windowId) {
- if (windowId === runningWindowId) {
- runningWindowId = 0;
- } else if (windowId === scoreWindowId) {
- scoreWindowId = 0;
- chrome.browserAction.setBadgeText({ "text": "" });
- }
- });
-// }
-
-//通信事件
-chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
- switch (request.method) {
- case "checkTab":
- if (sender.tab.windowId === runningWindowId || sender.tab.id === runningTabId || sender.tab.id === scoreTabId) {
- sendResponse({
- "runtime": 1
- });
- }
- break;
- case "startRun":
- if (!Object.keys(channelUrls).length) {
- // if (!isMobile) {
- if (!runningWindowId) {
- getPointsData(function (data) {
- if (userId !== data.userId) {
- usedUrls = {
- "article": [],
- "video": []
- }
- }
- userId = data.userId;
- createWindow(urlMap.index, function (window) {
- runningWindowId = window.id;
- notice(chrome.i18n.getMessage("extWorking"), chrome.i18n.getMessage("extWarning"));
- setTimeout(function () {
- channelUrls["exam-practice"] = urlMap.dailyAsk;
- // channelUrls["exam-weekly"] = urlMap.weeklyAsk;
- channelUrls["exam-paper"] = urlMap.paperAsk;
- getChannelData("article", function (list) {
- channelUrls["article"] = list;
- getChannelData("video", function (list) {
- channelUrls["video"] = list;
- autoEarnPoints(1000 + Math.floor(Math.random() * 1000));
- });
- });
- }, 1000 + Math.floor(Math.random() * 1000));
- });
- });
- }
- // } else {
- // if (!runningTabId) {
- // getPointsData(function (data) {
- // if (userId !== data.userId) {
- // usedUrls = {
- // "article": [],
- // "video": []
- // }
- // }
- // userId = data.userId;
- // chrome.tabs.create({ "url": urlMap.index }, function (tab) {
- // runningTabId = tab.id;
- // setTimeout(function () {
- // channelUrls["exam-practice"] = urlMap.dailyAsk;
- // channelUrls["exam-weekly"] = urlMap.weeklyAsk;
- // channelUrls["exam-paper"] = urlMap.paperAsk;
- // getChannelData("article", function (list) {
- // channelUrls["article"] = list;
- // getChannelData("video", function (list) {
- // channelUrls["video"] = list;
- // autoEarnPoints(1000 + Math.floor(Math.random() * 1000));
- // });
- // });
- // }, 1000 + Math.floor(Math.random() * 3000));
- // });
- // });
- // }
- // }
- }
- break;
- case "useUrl":
- if (usedUrls[request.type].indexOf(sender.tab.url) === -1) {
- usedUrls[request.type].push(sender.tab.url);
- }
- break;
- case "chooseLogin":
- chooseLogin = 1;
- sendResponse({
- "chooseLogin": chooseLogin
- });
- break;
- case "checkLogin":
- if (sender.tab.id === scoreTabId) {
- if (!chooseLogin) {
- chrome.tabs.update(scoreTabId, { "url": getLoginUrl() });
- }
- }
- break;
- // case "weeklyTitle":
- // weeklyTitle = 1;
- // sendResponse({
- // "weeklyTitle": weeklyTitle
- // });
- // break;
- case "paperTitle":
- paperTitle = 1;
- sendResponse({
- "paperTitle": paperTitle
- });
- break;
- case "askComplete":
- break;
- }
-});
\ No newline at end of file
diff --git a/js/choose.js b/js/choose.js
deleted file mode 100755
index b659da8..0000000
--- a/js/choose.js
+++ /dev/null
@@ -1,7 +0,0 @@
-window.addEventListener("load", function () {
- document.getElementById("qr").addEventListener("click", function () {
- chrome.runtime.sendMessage({"method": "chooseLogin"}, {}, function (response) {
- window.location.replace("https://pc.xuexi.cn/points/login.html?ref=https%3A%2F%2Fpc.xuexi.cn%2Fpoints%2Fmy-points.html");
- });
- });
-});
diff --git a/js/exampaper.js b/js/exampaper.js
index 3b86dc7..9e749eb 100644
--- a/js/exampaper.js
+++ b/js/exampaper.js
@@ -1,37 +1,95 @@
-chrome.runtime.sendMessage({"method": "checkTab"}, {}, function (response) {
+chrome.runtime.sendMessage({ type: "checkRunning" }, {}, function (response) {
if (response && response.hasOwnProperty("runtime")) {
if (response.runtime) {
- window.onload = function (){
- function getNeedAnswer() {
- var isNextPage = true;
- document.querySelectorAll('.item .right > button').forEach(function (e, b, c) {
- if (isNextPage) {
- let i = e.innerText;
- let year = e.parentNode.parentNode.firstElementChild.lastElementChild.innerText.slice(0, 4);
- if (i != "" && (i == '开始答题' || i == '继续答题')) {
- isNextPage = false;
- if ((new Date().getFullYear() == year)) {
- e.click();
- }
- return;
+ function getNeedAnswer() {
+ var isNextPage = true;
+ document.querySelectorAll('.item .right > button').forEach(function (e, b, c) {
+ if (isNextPage) {
+ let year = e.parentNode.parentNode.firstElementChild.lastElementChild.innerText.slice(0, 4);
+ let i = e.innerText;
+ if (i != "" && (i == '开始答题' || i == '继续答题')) {
+ isNextPage = false;
+ if (year != "" && (new Date().getFullYear() == year)) {
+ e.click();
}
+ // else {
+ // var item = document.getElementsByClassName("ant-pagination-item");
+ // item[item.length - 1].click();
+ // // 设置查询非当年题目
+ // setTimeout(getNeedAnswerHistory, parseInt(Math.random() * 1000 + 2000));
+ // }
+ return;
}
- });
-
- if (isNextPage) {
+ }
+ });
- var li = document.getElementsByClassName("ant-pagination-next")[0];
- if (li.getAttribute("aria-disabled") == "false") {
- document.querySelector('a.ant-pagination-item-link > i.anticon-right').click();
- setTimeout(getNeedAnswer, parseInt(1000));
- } else {
- chrome.runtime.sendMessage({"method": "paperTitle"});
- }
+ if (isNextPage) {
+ var li = document.getElementsByClassName("ant-pagination-next")[0];
+ if (li.getAttribute("aria-disabled") == "false") {
+ document.querySelector('a.ant-pagination-item-link > i.anticon-right').click();
+ setTimeout(getNeedAnswer, parseInt(Math.random() * 2000));
+ } else {
+ chrome.runtime.sendMessage({ type: "paperAskDoes" }, {}, function (res) {
+ if (res.complete) {
+ window.close();
+ }
+ });
}
}
-
- setTimeout(getNeedAnswer, parseInt(1000));
}
+
+ // function getNeedAnswerHistory() {
+ // var isNextPage = true;
+ // Array.from(document.querySelectorAll('.item .right > button')).reverse().forEach(function (e, b, c) {
+ // if (isNextPage) {
+ // let i = e.innerText;
+ // if (i != "" && (i == '开始答题' || i == '继续答题')) {
+ // isNextPage = false;
+ // e.click();
+ // return;
+ // }
+ // }
+ // });
+ //
+ // if (isNextPage) {
+ // var li = document.getElementsByClassName("ant-pagination-prev")[0];
+ // if (li.getAttribute("aria-disabled") == "false") {
+ // document.querySelector('a.ant-pagination-item-link > i.anticon-left').click();
+ // setTimeout(getNeedAnswerHistory, parseInt(Math.random() * 2000));
+ // } else {
+ // chrome.runtime.sendMessage({ type: "paperAskDoes" }, {}, function (res) {
+ // if (res.complete) {
+ // window.close();
+ // }
+ // });
+ // }
+ // }
+ // }
+
+ chrome.storage.local.get(['studyConfig'], function (result) {
+ // let config = result.studySubjectConfig;
+ // let paperConfig = new Object();
+ // for (let i = 0; i < config.length; i++) {
+ // if ("paper" == config[i].type) {
+ // paperConfig = config[i];
+ // break;
+ // }
+ // }
+ //
+ // if (paperConfig.subject == "current") {
+ setTimeout(getNeedAnswer, parseInt(Math.random() * 1000 + 5000));
+ // } else {
+ // // 设置查询非当年题目
+ // setTimeout(function () {
+ // // 点击最后一页
+ // var item = document.getElementsByClassName("ant-pagination-item");
+ // item[item.length - 1].click();
+ //
+ // setTimeout(getNeedAnswerHistory, parseInt(Math.random() * 1000 + 2000));
+ // }, parseInt(Math.random() * 1000 + 5000));
+ // }
+ });
+
}
}
-});
+});
\ No newline at end of file
diff --git a/js/exampractice.js b/js/exampractice.js
index 417188f..e2a276d 100755
--- a/js/exampractice.js
+++ b/js/exampractice.js
@@ -1,206 +1,231 @@
-chrome.runtime.sendMessage({"method": "checkTab"}, {}, function (response) {
+chrome.runtime.sendMessage({ type: "checkRunning" }, {}, function (response) {
if (response && response.hasOwnProperty("runtime")) {
if (response.runtime) {
- window.onload = function () {
- var waitTiming = 10, setTimeoutFunc = null, ManageType = 'auto', isManual = false;
- function getAnswers() {
- var options = 0, optionsArray = [], match_num = {}, max = 0, delay = 0;
- isManual = false;
- if (document.querySelector(".q-header") == null) {
- if (document.querySelector(".ant-btn.action.ant-btn-primary") != null) {
- chrome.runtime.sendMessage({"method": "askComplete"});
- return;
- } else {
- setTimeoutFunc = setTimeout(getAnswers, parseInt(Math.random() * 1000));
- return;
- }
- }
- var questionTitle = document.querySelector(".q-header");
- if (questionTitle == null) {
- return;
- }
- var questionType = questionTitle.innerText.substr(0, 3);
- if (document.querySelector(".q-footer .tips") != null) {
- document.querySelector(".q-footer .tips").click();
+
+ var WaitingTime = 5, setTimeoutFunc = null, ManageType = 'auto', isManual = false;
+
+ function getAnswers() {
+ let answerChoseNum = 0, answerArray = [], match_num = {}, max = 0, timeDelay = 0;
+ isManual = false;
+ // 获取答题标题,单选题、多选题、填空题
+ let questionTitle = $(".q-header");
+ if (!questionTitle.length) {
+ // 如果答题已完成
+ if ($(".ant-btn.action.ant-btn-primary").length) {
+ setTimeout(function () {
+ chrome.runtime.sendMessage({ type: "studyComplete" }, {}, function (res) {
+ if (res.complete) {
+ window.close();
+ }
+ });
+ }, 5000 + Math.floor(Math.random() * 5000));
} else {
- answerSubmit(1);
- return;
+ setTimeoutFunc = setTimeout(getAnswers, parseInt(Math.random() * 2000 + 2000));
+ }
+ return;
+ }
+ // 提交答案
+ if (!$(".q-footer .tips").length) {
+ answerSubmit(1);
+ return;
+ }
+ // 获取答案
+ $(".q-footer .tips").click();
+ $('.line-feed [color=red]').each(function () {
+ let i = $(this).text();
+ if (i != "") {
+ answerArray.push(i);
}
- document.querySelectorAll('.line-feed [color=red]').forEach(function (a, b, c) {
- let i = a.innerText;
- if (i != "") optionsArray.push(i);
+ });
+
+ // 如果答案为空,则找到全部提示内容
+ if (answerArray.length == 0) {
+ $('.line-feed > font').each(function () {
+ let i = $(this).text();
+ if (i != "") {
+ answerArray.push(i);
+ }
});
- if (optionsArray.length == 0) {
- document.querySelectorAll('.line-feed > font').forEach(function (a, b, c) {
- let i = a.innerText;
- if (i != "") optionsArray.push(i);
+ if (answerArray.length == 0) {
+ $('.line-feed').each(function () {
+ let i = $(this).text();
+ if (i != "" && i != "请观看视频") {
+ answerArray.push(i);
+ }
});
+ }
+ }
+
+ // 获取题目
+ let questionType = questionTitle.text().substr(0, 3);
+ switch (questionType) {
+ case "单选题":
+ timeDelay = 1;
+ case "多选题":
+ answerChoseNum = $('.q-answers .chosen').length;
+ if (answerChoseNum <= 0) {
+ $('.q-answer').each(function () {
+ let that = $(this);
+ var answerSelect = that.text().split('. ').slice(-1)[0];
+ var answerIsRight = false;
+ var answerMatches = 0;
+ var isChosen = false;
+ var answerJoinString = answerArray.join('');
- if (optionsArray.length == 0) {
- document.querySelectorAll('.line-feed').forEach(function (a, b, c) {
- let i = a.innerText;
- if (i != "" && i != "请观看视频") {
- optionsArray.push(i);
+ // 转换符号,
+ answerSelect = answerSelect.replace(/\(/g, "(").replace(/\)/g, ")");
+ answerJoinString = answerJoinString.replace(/\(/g, "(").replace(/\)/g, ")");
+
+ isChosen = Boolean(that.attr('class').indexOf("chosen") != -1);
+ answerIsRight = (answerSelect.indexOf(answerJoinString) != -1 || answerJoinString.indexOf(answerSelect) != -1) && answerJoinString != "";
+ if (answerIsRight && questionType == '单选题') {
+ answerIsRight = (answerJoinString.length == answerSelect.length ? true : false);
+ }
+ if (answerIsRight && !isChosen) {
+ that.click();
+ answerChoseNum++;
+ }
+ if (!answerIsRight) {
+ answerMatches += getAnswerMatches(answerJoinString, that.text());
+ match_num[answerMatches] = that;
}
});
+
+ if (answerChoseNum == 0) {
+ for (let i in match_num) {
+ max = Number(max) >= Number(i) ? Number(max) : Number(i);
+ }
+ match_num[max].click();
+ answerChoseNum++;
+ isManual = true;
+ }
+ manualManage();
+ timeDelay = 1000;
}
- }
- switch (questionType) {
- case "单选题":
- delay = 1;
- case "多选题":
- options = document.querySelectorAll('.q-answers .chosen').length;
- if (options <= 0) {
- document.querySelectorAll('.q-answer').forEach(function (a, b, c) {
- var optionChoose = a.innerHTML.split('. ').slice(-1)[0];
- var optionIsRight = false;
- var optionMatches = 0;
- var isChosen = false;
- var optionString = optionsArray.join('');
- optionChoose = optionChoose.replace(/\(/g, "(").replace(/\)/g, ")");
- optionString = optionString.replace(/\(/g, "(").replace(/\)/g, ")");
-
- isChosen = Boolean(a.className.indexOf("chosen") != -1);
- optionIsRight = (optionChoose.indexOf(optionString) != -1 || optionString.indexOf(optionChoose) != -1) && optionString != "";
- if (optionIsRight && questionType == '单选题') {
- optionIsRight = (optionString.length == optionChoose.length ? true : false);
- }
- if (optionIsRight && !isChosen) {
- a.click();
- options++;
- }
- if (!optionIsRight) {
- optionMatches += getoptionMatches(optionString, a.innerHTML);
- match_num[optionMatches] = a
- }
- })
- if (options == 0) {
- for (let i in match_num) {
- max = Number(max) >= Number(i) ? Number(max) : Number(i);
- }
- match_num[max].click();
- options++;
+ break;
+ case "填空题":
+ var inpus = document.querySelectorAll('.q-body input');
+ var inputs_e = document.querySelectorAll('.q-body input[value=""]');
+ answerChoseNum = inpus.length - inputs_e.length;
+ if (inputs_e.length > 0) {
+ var ev = new Event('input', { bubbles: true });
+ inpus.forEach(function (a, b, c) {
+ if (answerArray[0] == undefined) {
isManual = true;
+ let a = document.querySelector(".q-body").innerText;
+ let n = parseInt(Math.random() * 2 + 2);
+ let i = parseInt(Math.random() * (a.length - n - 1));
+ answerArray[0] = a.substr(i, n);
}
- manualManage();
- delay = delay == 0 ? 2500 : 1500;
- }
- break;
- case "填空题":
- var inpus = document.querySelectorAll('.q-body input');
- var inputs_e = document.querySelectorAll('.q-body input[value=""]');
- options = inpus.length - inputs_e.length;
- if (inputs_e.length > 0) {
- var ev = new Event('input', {bubbles: true});
- inpus.forEach(function (a, b, c) {
- if (optionsArray[0] == undefined) {
- isManual = true;
- let a = document.querySelector(".q-body").innerText;
- let n = parseInt(Math.random() * 2 + 2);
- let i = parseInt(Math.random() * (a.length - n - 1));
- optionsArray[0] = a.substr(i, n);
- }
- var value = "";
- if (c.length == 1)
- value = optionsArray.join('');
- else
- value = b < optionsArray.length ? optionsArray[b] : optionsArray[0];
- if (a.value == "") {
- a.setAttribute("value", value);
- a.dispatchEvent(ev);
- options++;
- }
- })
- manualManage();
- delay = 3500;
- }
- break;
- }
- setTimeoutFunc = setTimeout(function () {
- answerSubmit(options)
- }, parseInt(Math.random() * 1000 + delay));
+ var value = "";
+ if (c.length == 1) {
+ value = answerArray.join('');
+ } else {
+ value = b < answerArray.length ? answerArray[b] : answerArray[0];
+ }
+ if (a.value == "") {
+ a.setAttribute("value", value);
+ a.dispatchEvent(ev);
+ answerChoseNum++;
+ }
+ })
+ manualManage();
+ timeDelay = 1500;
+ }
+ break;
}
+ setTimeoutFunc = setTimeout(function () {
+ answerSubmit(answerChoseNum)
+ }, parseInt(Math.random() * timeDelay));
+ }
- function answerSubmit(options = 0) {
- if (options > 0 && ManageType == 'auto') {
- if ($(".submit-btn").length) {
- $(".submit-btn").click();
- } else {
- if ($(".next-btn").length) {
- $(".next-btn").click();
- }
+ function answerSubmit(answerChoseNum = 0) {
+ // 提交答案
+ if (answerChoseNum > 0 && ManageType == 'auto') {
+ // 有提交按钮,提交数据
+ if ($(".submit-btn").length) {
+ $(".submit-btn").click();
+ } else {
+ if ($(".next-btn").length) {
+ $(".next-btn").click();
}
- setTimeoutFunc = setTimeout(getAnswers, parseInt(Math.random() * 1000));
}
+ setTimeoutFunc = setTimeout(getAnswers, parseInt(Math.random() * 1000 + 2000));
}
+ }
- function getoptionMatches(a = '', b = '') {
- let c = 0;
- for (let i = 0; i < b.length; i++) {
- if (a.indexOf(b.substr(i, 1)) != -1) {
- c++;
- }
+ function getAnswerMatches(a = '', b = '') {
+ let c = 0;
+ for (let i = 0; i < b.length; i++) {
+ if (a.indexOf(b.substr(i, 1)) != -1) {
+ c++;
}
- return c;
}
+ return c;
+ }
- function manualManage() {
- if (document.querySelector("#my_ms") != null || !isManual) return;
- let ds_c = 0;
- let ds_t = null;
- ManageType = "wait";
- let e = document.createElement("div");
- e.id = "my_ms";
- e.innerHTML = "此题无完全匹配答案,已填写(选择)一个相对最匹配的答案(可能是错误的)。你可以点击下面按钮切换到手动做题并修正答案后再次点击按钮切换到自动做题。
若 " + waitTiming + " 秒无操作则继续自动做题
";
- e.style.color = 'red';
- e.style.fontSize = '20px';
- e.style.textAlign = 'center';
- document.querySelector(".header-row").appendChild(e);
- let b = document.createElement("button");
- b.style.color = 'green';
- b.style.fontSize = '24px';
- b.style.textAlign = 'center';
- b.style.marginTop = '10px';
- b.value = 'auto';
- b.innerText = '切换到手动做题';
- b.onclick = function () {
- document.querySelector("#my_ds").innerHTML = '';
- if (ds_t != null) {
- clearInterval(ds_t);
- ds_t = null;
- }
- if (this.value == 'auto') {
- this.value = 'manual';
- ManageType = "manual";
- b.innerText = '切换到自动做题';
- this.style.color = 'red';
- } else {
- this.value = 'auto';
- ManageType = 'auto';
- b.innerText = '切换到手动做题';
- this.style.color = 'green';
- document.querySelector("#my_ms").remove();
- getAnswers();
- }
- }
- e.appendChild(b);
- ds_t = setInterval(function () {
- ds_c++;
- document.querySelector("#my_ds_c").innerText = waitTiming - ds_c;
- if (ds_c >= waitTiming) {
- document.querySelector("#my_ms").remove();
- clearInterval(ds_t);
- ds_t = null;
- ManageType = 'auto';
- answerSubmit(1);
- }
- }, 1000);
+ function manualManage() {
+ let myId = "my_ms";
+ if ($('#' + myId).length || !isManual) {
+ return;
}
- setTimeoutFunc = setTimeout(getAnswers, parseInt(Math.random() * 1000));
+ // 浏览器提醒
+ chrome.runtime.sendMessage({ type: "answerError" });
+
+ // 设置类型等待
+ ManageType = "wait";
+
+ let timerId = "my_ds_c";
+ let buttonId = "my_bt_c";
+ let html = '
t |