From a0c5d18b4854b03b69e56d8b6b2d53c5c69f37d7 Mon Sep 17 00:00:00 2001 From: CodFrm Date: Fri, 10 May 2019 11:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=BC=98=E5=8C=96&?= =?UTF-8?q?=E7=AD=94=E9=A2=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++- build/cxmooc-tools/manifest.json | 2 +- docs/.vuepress/config.js | 18 +++++++----- docs/1-UserGuide/1-1-chrome.md | 2 +- docs/1-UserGuide/1-2-firefox.md | 2 -- docs/1-UserGuide/README.md | 13 +++++++-- docs/1-UserGuide/featured.md | 23 +++++++++++++++ docs/README.md | 11 +------ package.json | 2 +- src/config.js | 2 +- src/cxmooc-tools/chaoxing/exam.js | 45 ++++++++++------------------- src/cxmooc-tools/chaoxing/topic.js | 6 ++-- src/cxmooc-tools/chaoxing/util.js | 27 ----------------- src/cxmooc-tools/chaoxing/vcode.js | 10 +++---- src/cxmooc-tools/common.js | 26 +++++++++++++++-- src/cxmooc-tools/html/popup.html | 4 +-- src/cxmooc-tools/zhihuishu/topic.js | 8 ++--- src/server/listen.js | 14 ++++----- 18 files changed, 111 insertions(+), 108 deletions(-) create mode 100644 docs/1-UserGuide/featured.md diff --git a/README.md b/README.md index 4d4a5e2b..99603631 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/codfrm/cxmooc-tools.svg?label=version) ## 关于超星慕课小工具 -一个超星慕课刷课工具,火狐,谷歌,油猴支持.全自动任务,视频倍速秒过,作业考试题库,验证码自动打码(੧ᐛ੭挂科模式,启动) +一个超星(学习通)和智慧树(知到)刷课工具,火狐,谷歌,油猴支持.全自动任务,视频倍速秒过,作业考试题库,验证码自动打码(੧ᐛ੭挂科模式,启动) ### 浏览器适配列表 * [x] Chrome for PC @@ -14,6 +14,8 @@ * [x] Tampermonkey ### 功能支持列表 +> 详情请看使用文档 + * [x] 视频挂机 * [x] 视频秒过 * [x] 视频倍速 diff --git a/build/cxmooc-tools/manifest.json b/build/cxmooc-tools/manifest.json index 56874df2..758820ef 100644 --- a/build/cxmooc-tools/manifest.json +++ b/build/cxmooc-tools/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "超星慕课小工具", - "version": "2.0.8", + "version": "2.1", "description": "用于超星慕课的小工具", "icons": { "16": "img/logo.png", diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 1c8d0b75..ad5d8cae 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -21,6 +21,7 @@ module.exports = { { text: 'Chrome 扩展', link: '/1-UserGuide/1-1-chrome.html' }, { text: 'FireFox 扩展', link: '/1-UserGuide/1-2-firefox.html' }, { text: 'Tampermonkey 脚本', link: '/1-UserGuide/1-3-tampermonkey.html' }, + { text: '功能说明', link: '/1-UserGuide/featured.html' }, { text: '配置说明', link: '/1-UserGuide/1-4-config.html' } ] }, @@ -43,6 +44,7 @@ module.exports = { '1-1-chrome.html', /* /foo/ */ '1-2-firefox.html', /* /foo/one.html */ '1-3-tampermonkey.html', + 'featured.html', '1-4-config.html' ], }, @@ -53,10 +55,10 @@ module.exports = { // message: "New content is available.", // buttonText: "Refresh" // } - updatePopup: { - message: "文档有更新,新的内容已准备就绪", - buttonText: "刷新获取新内容" - } + updatePopup: { + message: "文档有更新,新的内容已准备就绪", + buttonText: "刷新获取新内容" + } }, // 假定是 GitHub. 同时也可以是一个完整的 GitLab URL repo: 'CodFrm/cxmooc-tools', @@ -78,11 +80,11 @@ module.exports = { }, plugins: [ ['@vuepress/back-to-top'], - [ + [ '@vuepress/google-analytics', { - 'ga': 'UA-138255059-2' + 'ga': 'UA-138255059-2' } - ] - ] + ] + ] } \ No newline at end of file diff --git a/docs/1-UserGuide/1-1-chrome.md b/docs/1-UserGuide/1-1-chrome.md index 807c213b..eadb1dc3 100644 --- a/docs/1-UserGuide/1-1-chrome.md +++ b/docs/1-UserGuide/1-1-chrome.md @@ -30,7 +30,7 @@ title: Chrome插件 下载[发布版本](https://github.com/CodFrm/cxmooc-tools/releases)cxmooc-tools.crx文件,直接拖入浏览器安装 某些浏览器允许直接拖入扩展进行安装。(内核为Chromium,如果不行,请按照方法2来) -- 支持列表 +#### 支持列表 > 可以通过下方**在 GitHub 上编辑此页**来进行补充 * 360极速浏览器 diff --git a/docs/1-UserGuide/1-2-firefox.md b/docs/1-UserGuide/1-2-firefox.md index f432887f..44424a66 100644 --- a/docs/1-UserGuide/1-2-firefox.md +++ b/docs/1-UserGuide/1-2-firefox.md @@ -7,8 +7,6 @@ title: FireFox插件 [应用市场](https://addons.mozilla.org/zh-CN/firefox/addon/%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7/) 下载安装插件。 -如果火狐出现题库错误等问题,请访问一次这个网址:[https://blog.icodef.com:8081/](https://blog.icodef.com:8081/),允许访问通过 - ## 火狐手机版(Android) > 待完善,可以下载app后在商店安装,但是功能并不保证稳定(超星手机浏览器无法完成视频任务点) diff --git a/docs/1-UserGuide/README.md b/docs/1-UserGuide/README.md index 90445e22..13d9ef36 100644 --- a/docs/1-UserGuide/README.md +++ b/docs/1-UserGuide/README.md @@ -4,11 +4,17 @@ title: 开始 本插件提供多种使用方式,请按照需求查阅相应的文档支持 ## 小白 -小白用户建议使用FireFox浏览器,前往FireFox商店下载更新:[FireFox](/1-UserGuide/1-2-firefox.html) +小白用户建议使用FireFox浏览器,前往FireFox商店下载更新:[**FireFox**](/1-UserGuide/1-2-firefox.html) -或者使用已经打包好了的浏览器版本使用:[打包版浏览器](/1-UserGuide/1-1-chrome.html#%E6%89%93%E5%8C%85%E7%89%88%E6%B5%8F%E8%A7%88%E5%99%A8),但是这个更新速度较慢,也可以自己手动更新 +或者使用已经打包好了的浏览器版本使用:[**打包版浏览器**](/1-UserGuide/1-1-chrome.html#打包版浏览器),但是这个更新速度较慢,也可以自己手动更新 -最近也发布了一个智慧树的版本,油猴脚本:[https://greasyfork.org/zh-CN/scripts/382037-%E6%99%BA%E6%85%A7%E6%A0%91%E5%B0%8F%E5%B7%A5%E5%85%B7](https://greasyfork.org/zh-CN/scripts/382037-%E6%99%BA%E6%85%A7%E6%A0%91%E5%B0%8F%E5%B7%A5%E5%85%B7),插件是全部整合的 +## 油猴 + +超星油猴脚本:[https://greasyfork.org/zh-CN/scripts/376190-超星慕课小工具](https://greasyfork.org/zh-CN/scripts/376190-%E8%B6%85%E6%98%9F%E6%85%95%E8%AF%BE%E5%B0%8F%E5%B7%A5%E5%85%B7) + +智慧树油猴脚本:[https://greasyfork.org/zh-CN/scripts/382037-智慧树小工具](https://greasyfork.org/zh-CN/scripts/382037-%E6%99%BA%E6%85%A7%E6%A0%91%E5%B0%8F%E5%B7%A5%E5%85%B7) + +**插件是全部整合的** [telegram群](https://t.me/joinchat/MHU8Gg2fP3Q51HLY2wqmQA) [QQ群](https://shang.qq.com/wpa/qunwpa?idkey=9bddd2564d84bd999940de422d1c0c70f87ecaf02fe9d7c60389fc2b376179eb) @@ -16,4 +22,5 @@ title: 开始 - Chrome插件 - FireFox插件 - 油猴脚本 +- 功能说明 - 使用说明 \ No newline at end of file diff --git a/docs/1-UserGuide/featured.md b/docs/1-UserGuide/featured.md new file mode 100644 index 00000000..1ba2fdcb --- /dev/null +++ b/docs/1-UserGuide/featured.md @@ -0,0 +1,23 @@ +--- +title: 功能说明 +--- + +## 超星 +* [x] 视频挂机 +* [x] 视频秒过 +* [x] 视频倍速 +* [x] 静音播放 +* [x] 自动答题 +* [x] 自动阅读 +* [x] 自动填写验证码 +* [x] 考试答题 +* [x] 作业答题 +* [x] 手机任务解锁 + +## 智慧树 +* [x] 视频挂机 +* [x] 视频秒过 +* [x] 视频倍速 +* [x] 静音播放 +* [x] 题目屏蔽 +* [x] 检测答题 diff --git a/docs/README.md b/docs/README.md index c845d979..0a81da55 100644 --- a/docs/README.md +++ b/docs/README.md @@ -33,13 +33,4 @@ footer: MIT Licensed | Copyright © 2018 CXmooc-tool developer Team * Chrome 系浏览器 ### 功能支持列表 - -* 视频挂机 -* 视频秒过 -* 视频倍速 -* 静音播放 -* 自动答题 -* 自动阅读 -* 自动填写验证码 -* 考试答题 - +**详情请看->[功能说明](/1-UserGuide/featured.html)** diff --git a/package.json b/package.json index 033e2660..5f845906 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cxmooc-tools", - "version": "2.0.8", + "version": "2.1.0", "description": "> 一个快速学习超星慕课的chrome扩展工具(੧ᐛ੭挂科模式,启动)\r > 初次开发chrome扩展,有兴趣的朋友可以一起来哦", "main": "mooc.js", "scripts": { diff --git a/src/config.js b/src/config.js index fb48d125..6452083c 100644 --- a/src/config.js +++ b/src/config.js @@ -1,6 +1,6 @@ module.exports = { url: "https://cx.icodef.com/", - version: 2.09, + version: 2.10, update: 'https://github.com/CodFrm/cxmooc-tools/releases', enforce: false, cx: { diff --git a/src/cxmooc-tools/chaoxing/exam.js b/src/cxmooc-tools/chaoxing/exam.js index df93f7c1..6907cf95 100644 --- a/src/cxmooc-tools/chaoxing/exam.js +++ b/src/cxmooc-tools/chaoxing/exam.js @@ -16,7 +16,7 @@ module.exports = { text = text.substr(0, text.lastIndexOf('(')); return text; }, - geTHomeworkTopic: function () { + getHomeworkTopic: function () { let topic = $('.Zy_TItle.clearfix .clearfix'); if (topic.length <= 0) { return undefined; @@ -62,35 +62,20 @@ module.exports = { btn.onclick = function () { $(btn).text('搜索中...'); //搜索答案 - let topic = self.geTHomeworkTopic(); + let topic = self.getHomeworkTopic(); if (topic == undefined) { return false; } - function requestAnswer(page) { - let post = ''; - for (let i = (page * 5), n = 0; i < topic.length && n < 5; i++ , n++) { - post += 'topic[' + n + ']=' + topic[i].topic + '&type[' + n + ']=' + topic[i].type + '&'; - } - if (post == '') { - $(btn).text('搜索完成'); + common.requestAnswer(topic, 'cx', 0, function (topic, answer) { + let index = topic.index; + if (answer == undefined) { + common.signleLine('无答案', 'answer' + index, undefined, topic.options); return; } - common.gm_post(moocServer.url + 'v2/answer', post, false, function (data) { - let json = JSON.parse(data); - for (let i = 0; i < json.length; i++) { - let index = json[i].index + page * 5; - if (json[i].result.length <= 0) { - common.signleLine('无答案', 'answer' + index, undefined, topic[index].options); - continue; - } - self.fillHomeWorkAnswer(topic[index], json[i].result[Math.floor(Math.random() * Math.floor(json[i].result.length))]); - } - setTimeout(() => { requestAnswer(page + 1); }, 1000); - }).error(function () { - $(btn).text('网络错误'); - }); - } - requestAnswer(0); + self.fillHomeWorkAnswer(topic, answer); + }, () => { $(btn).text('搜索完成'); }, + () => { $(btn).text('网络错误'); } + ); return false; } }, @@ -138,7 +123,7 @@ module.exports = { if (topic == undefined) { return false; } - common.gm_post(moocServer.url + 'v2/answer', 'topic[0]=' + topic, false, function (data) { + common.gm_post(moocServer.url + 'v2/answer?platform=cx', 'topic[0]=' + topic, false, function (data) { let json = JSON.parse(data); if (json[0].result.length <= 0) { return self.notic.text('未找到答案'); @@ -258,7 +243,7 @@ module.exports = { options = $(timu[i]).find('.Cy_ulTop li'); topicText = topicText.substr(0, topicText.lastIndexOf('(')); } - let pushOption = { topic: topicText, answer: [], correct: [] }; + let pushOption = { topic: topicText, answers: [], correct: [] }; if (options.length <= 0) { //非选择 let is = false; @@ -306,15 +291,15 @@ module.exports = { if (correctText.indexOf(option) >= 0) { pushOption.correct.push(tmp); } - pushOption.answer.push(tmp); + pushOption.answers.push(tmp); } pushOption.type = correctText.length <= 1 ? 1 : 2; } answer.push(pushOption); } // console.log(answer); - common.gm_post(moocServer.url + 'answer', JSON.stringify(answer), true, function () { - let box = util.pop_prompt("√ 答案自动记录成功"); + common.gm_post(moocServer.url + 'answer?platform=cx', JSON.stringify(answer), true, function () { + let box = common.pop_prompt("√ 答案自动记录成功"); $(document.body).append(box); setTimeout(function () { box.style.opacity = "1"; }, 500); }); diff --git a/src/cxmooc-tools/chaoxing/topic.js b/src/cxmooc-tools/chaoxing/topic.js index 85a5d84e..98ba134f 100644 --- a/src/cxmooc-tools/chaoxing/topic.js +++ b/src/cxmooc-tools/chaoxing/topic.js @@ -29,7 +29,7 @@ module.exports = function () { for (let i in topic) { data += 'topic[' + i + ']=' + topic[i].topic + '&type[' + i + ']=' + topic[i].type + '&'; } - common.gm_post(moocServer.url + 'v2/answer', data, false, function (data) { + common.gm_post(moocServer.url + 'v2/answer?platform=cx', data, false, function (data) { let json = JSON.parse(data); let answer_null = false; for (let i = 0; i < json.length; i++) { @@ -151,10 +151,10 @@ module.exports = function () { } answer.push(tmp); } - let box = until.pop_prompt("√ 答案自动记录成功"); + let box = common.pop_prompt("√ 答案自动记录成功"); $(document.body).append(box); setTimeout(function () { box.style.opacity = "1"; }, 500); - common.gm_post(moocServer.url + 'answer', JSON.stringify(answer), true, function () { + common.gm_post(moocServer.url + 'answer?platform=cx', JSON.stringify(answer), true, function () { common.log(self.iframe.className + " topic answer complete") self.complete(2); }).error(function () { diff --git a/src/cxmooc-tools/chaoxing/util.js b/src/cxmooc-tools/chaoxing/util.js index 80948413..8d0ffc91 100644 --- a/src/cxmooc-tools/chaoxing/util.js +++ b/src/cxmooc-tools/chaoxing/util.js @@ -52,30 +52,3 @@ export function isTask(el) { } return false; } - - -export function pop_prompt(text, sec = 4) { - var box = document.createElement('div'); - box.style.position = "fixed"; - box.style.background = "#aeffab"; - box.style.fontSize = "18px"; - box.style.padding = "4px 20px"; - box.style.borderRadius = "20px"; - box.style.top = "50%"; - box.style.left = "50%"; - box.style.transform = "translate(-50%,-50%)"; - box.style.transition = "1s"; - box.style.opacity = "0"; - box.innerText = text; - setTimeout(function () { - box.style.opacity = "0"; - setTimeout(function () { - box.remove(); - }, 1000) - }, sec * 1000); - return box; -} - -export function getAnswer() { - -} \ No newline at end of file diff --git a/src/cxmooc-tools/chaoxing/vcode.js b/src/cxmooc-tools/chaoxing/vcode.js index 0c67566c..be551c2e 100644 --- a/src/cxmooc-tools/chaoxing/vcode.js +++ b/src/cxmooc-tools/chaoxing/vcode.js @@ -24,7 +24,7 @@ module.exports = function () { $('input#code').val(code); setTimeout(function () { $('a#sub').click(); - }, 2000); + }, 3000); }, true); }); } @@ -40,7 +40,7 @@ module.exports = function () { document.getElementById('ucode').value = code; setTimeout(function () { document.getElementsByClassName('submit')[0].click(); - }, 2000); + }, 3000); }); } } @@ -64,7 +64,7 @@ module.exports = function () { $('input#identifyCodeRandom').val(code); setTimeout(function () { continueGetTeacherAjax(); - }, 2000); + }, 3000); }); } } @@ -76,7 +76,7 @@ module.exports = function () { if (!show) { img.src = base64; } - if (config.is_ruokuai) { + if (false && config.is_ruokuai) { //若快打码 } else { common.gm_post(serverConfig.url + 'vcode', 'img=' + encodeURIComponent(base64.substr('data:image/jpeg;base64,'.length)), false, function (ret) { @@ -87,7 +87,7 @@ module.exports = function () { } else if (json.msg) { callback(json.msg); } else { - getVcode(url, img, callback); + setTimeout(() => { getVcode(url, img, callback); },3000); } }).error(function () { callback(undefined, '网络请求失败'); diff --git a/src/cxmooc-tools/common.js b/src/cxmooc-tools/common.js index 93115e21..ff528c06 100644 --- a/src/cxmooc-tools/common.js +++ b/src/cxmooc-tools/common.js @@ -333,7 +333,29 @@ export function postAnswer(topic, platform, collect, compile, error) { } } console.log(answer); - // gm_post(moocServer.url + 'answer?platform='+platform, JSON.stringify(answer), true, compile, error); + gm_post(moocServer.url + 'answer?platform=' + platform, JSON.stringify(answer), true, compile).error(error); +} + +export function pop_prompt(text, sec = 4) { + var box = document.createElement('div'); + box.style.position = "fixed"; + box.style.background = "#aeffab"; + box.style.fontSize = "18px"; + box.style.padding = "4px 20px"; + box.style.borderRadius = "20px"; + box.style.top = "50%"; + box.style.left = "50%"; + box.style.transform = "translate(-50%,-50%)"; + box.style.transition = "1s"; + box.style.opacity = "0"; + box.innerText = text; + setTimeout(function () { + box.style.opacity = "0"; + setTimeout(function () { + box.remove(); + }, 1000) + }, sec * 1000); + return box; } export function requestAnswer(topic, platform, page, answer, compile, error, count, time) { @@ -342,7 +364,7 @@ export function requestAnswer(topic, platform, page, answer, compile, error, cou time = time || 2000; let post = ''; for (let i = (page * count), n = 0; i < topic.length && n < count; i++ , n++) { - post += 'topic[' + n + ']=' + '正弦电流 ' + '&type[' + n + ']=' + topic[i].type + '&'; + post += 'topic[' + n + ']=' + topic[i].topic + '&type[' + n + ']=' + topic[i].type + '&'; } if (post == '') { compile && compile(); diff --git a/src/cxmooc-tools/html/popup.html b/src/cxmooc-tools/html/popup.html index 3a4363c3..10527f2f 100644 --- a/src/cxmooc-tools/html/popup.html +++ b/src/cxmooc-tools/html/popup.html @@ -350,8 +350,8 @@

公告

插件配置: - - + +
若快打码设置:
diff --git a/src/cxmooc-tools/zhihuishu/topic.js b/src/cxmooc-tools/zhihuishu/topic.js index e5259e55..7a28a8b0 100644 --- a/src/cxmooc-tools/zhihuishu/topic.js +++ b/src/cxmooc-tools/zhihuishu/topic.js @@ -119,7 +119,7 @@ module.exports = { if ($(topic.options).find('.key_yes').length <= 0) { return undefined; } - let pushOption = { topic: topic.topic, type: topic.type, answer: [], correct: [] }; + let pushOption = { topic: topic.topic, type: topic.type, answers: [], correct: [] }; let options = self.findOption(topic.options, topic.type); switch (topic.type) { case 1: @@ -152,9 +152,9 @@ module.exports = { } return pushOption; }, function () { - alert('收集完成'); - }, function () { - alert('网络错误'); + let box = common.pop_prompt("√ 答案自动记录成功"); + $(document.body).append(box); + setTimeout(function () { box.style.opacity = "1"; }, 500); }); } } \ No newline at end of file diff --git a/src/server/listen.js b/src/server/listen.js index 2dc387c6..01d68e5b 100644 --- a/src/server/listen.js +++ b/src/server/listen.js @@ -79,7 +79,7 @@ app.all('/player/*', function (req, res, next) { app.post('/answer', function (req, res) { let token = req.header('Authorization') || ''; - let platform = req.query('platform') || 'cx'; + let platform = req.query.platform || 'cx'; var ip = getClientIp(req); var ret = []; if (req.body.length <= 0) { @@ -180,15 +180,15 @@ function getClientIp(req) { app.post('/v2/answer', function (req, res) { var topic = req.body.topic || []; var type = req.body.type || []; - let platform = req.query('platform') || 'cx'; + let platform = req.query.platform || 'cx'; selectAnswer(topic, res, function (i) { - var where = { topic: { $regex: '^' + topic_n } }; - topic[i] = dealSymbol(topic[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')); - var topic_n = topic[i]; + let where = {}; + let topic_n = dealSymbol(topic[i].replace(/[-\/\\^$*+?.|[\]{}]/g, '\\$&')); // topic[i] = topic; if (type[i] != undefined) { where = { type: parseInt(type[i]) }; } + where.topic = { $regex: '^'+topic_n }; return where; }); }); @@ -205,7 +205,7 @@ function dealSymbol(topic) { app.get('/answer', function (req, res) { var topic = req.query.topic || []; - let platform = req.query('platform') || 'cx'; + let platform = req.query.platform || 'cx'; selectAnswer(topic, res, function (i) { return { topic: topic[i] }; }); @@ -229,7 +229,7 @@ function selectAnswer(topic, res, where) { time: 1, correct: 1 } - }).limit(10).toArray(function (err, result) { + }).limit(5).toArray(function (err, result) { var pushData = { topic: topic[i], index: i