Skip to content
This repository was archived by the owner on Apr 25, 2022. It is now read-only.

Commit 94986cf

Browse files
committed
2.0测试&油猴版本信息
1 parent c2b3caf commit 94986cf

File tree

4 files changed

+28
-170
lines changed

4 files changed

+28
-170
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,19 @@ npm run server
9292
## 说明
9393
使用已安装扩展插件的浏览器打开超星慕课学习页面,在视频上方会显示相关功能按钮。扩展图标点击可展示配置项目,将鼠标放在配置项上可以看见配置详情。
9494

95+
油猴版本请打开源码查看,global.config中修改配置值
96+
9597
**秒过视频**功能可直接将视频看完,但是**有一定的风险**
9698

9799
插件功能:(勾为已实现的功能,空为将更新的内容)
98100
* [x] 刷课挂机
99101
* [x] 视频秒过
100102
* [x] 视频加速
101103
* [x] 视频静音
102-
* [x] 自动答题 **(详情请见[题库](#题库))**
104+
* [x] 自动答题
105+
* [x] 自动阅读
103106
* [ ] 视频内题目填充
104-
* [ ] 考试答题 **(不完善)**
107+
* [ ] 考试答题
105108

106109
...
107110

src/cxmooc-tools/mooc.js

+2-164
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
// import {
2-
// showExpand,
3-
// removeHTML,
4-
// get,
5-
// getLocalTopic,
6-
// removeinjected,
7-
// } from './common';
8-
// const md5 = require("md5");
9-
// const moocServer = require('../config');
101
const common = require('./common');
112
const chaoxing = require('./chaoxing/chaoxing');
123

134
common.removeinjected(document);
145
global.config = JSON.parse(localStorage['config']);
15-
global.timer=new Array();
6+
global.timer = new Array();
167
if (window.location.href.indexOf('mycourse/studentstudy?') > 0) {
178
//超星学习页面
189
document.addEventListener('load', function (ev) {
@@ -26,7 +17,7 @@ if (window.location.href.indexOf('mycourse/studentstudy?') > 0) {
2617
if (frame != null) {
2718
factory('chaoxing').studentstudy();
2819
}
29-
}else if(window.location.href.indexOf('ztnodedetailcontroller/visitnodedetail') > 0){
20+
} else if (window.location.href.indexOf('ztnodedetailcontroller/visitnodedetail') > 0) {
3021
//超星阅读页面
3122
factory('chaoxing').read();
3223
}
@@ -43,156 +34,3 @@ function factory(object) {
4334
}
4435
}
4536
}
46-
47-
48-
// //监听框架加载
49-
// document.addEventListener('load', function (ev) {
50-
// var ev = ev || event;
51-
// var _this = ev.srcElement || ev.target;
52-
// if (_this.id == 'iframe') {
53-
// showExpand(_this);
54-
// }
55-
// }, true);
56-
// //监测框架
57-
// var frame = document.getElementById('iframe');
58-
// if (frame != null) {
59-
// showExpand(frame);
60-
// }
61-
// //监测作业板块
62-
// if (window.location.href.indexOf('work/doHomeWorkNew') > 0) {
63-
// var form = document.getElementById('form1');
64-
// if (form != null) {
65-
// //显示答题按钮
66-
// const topic = require('./topic');
67-
// topic(document, form.previousElementSibling, 0, false);
68-
// }
69-
// }
70-
71-
// if (window.location.href.indexOf('work/selectWorkQuestionYiPiYue') > 0) {
72-
// var form = document.getElementById('ZyBottom');
73-
// if (form != null) {
74-
// //显示答题按钮
75-
// const topic = require('./topic');
76-
// topic(document, form.previousElementSibling, 0, true);
77-
// }
78-
// }
79-
80-
// //考试
81-
// if (window.location.href.indexOf('exam/test/reVersionTestStartNew') > 0) {
82-
// //读取题目和答案
83-
// var config = JSON.parse(localStorage['config']);
84-
// var topic = document.getElementById('position${velocityCount}').getElementsByClassName('clearfix')[0];
85-
// var prompt = document.createElement('div');
86-
// prompt.style.color = "#e53935";
87-
// prompt.className = "prompt";
88-
// document.getElementsByTagName('form')[0].appendChild(prompt);
89-
// var netReq;
90-
// if (config['blurry_answer']) {
91-
// topic = dealTopic(topic);
92-
// netReq = common.post(moocServer.url + 'v2/answer', 'topic[0]=' + topic, false);
93-
// } else {
94-
// topic = md5(dealTopic(topic));
95-
// netReq = get(moocServer.url + 'answer?topic[0]=' + md5(topic));
96-
// }
97-
// netReq.onreadystatechange = function () {
98-
// if (this.readyState == 4) {
99-
// if (this.status != 200) {
100-
// prompt.innerText = '网络错误';
101-
// } else {
102-
// var json = JSON.parse(this.responseText);
103-
// if (json[0].result.length <= 0) {
104-
// prompt.innerText = '没有搜索到答案,尝试从题库中查询';
105-
// //从本地题库读取内容
106-
// var localTopic = getLocalTopic(topic);
107-
// if (localTopic != undefined) {
108-
// //检索到题目了
109-
// var tmpResult = {
110-
// correct: []
111-
// };
112-
// //类型判断
113-
// if (/^[\w]+$/.test(localTopic.answer)) {
114-
// tmpResult.type = 2;
115-
// } else if (/^[√|×]$/) {
116-
// tmpResult.type = 3;
117-
// } else {
118-
// tmpResult.type = 4;
119-
// }
120-
// if (tmpResult.type == 3) {
121-
// //判断题
122-
// tmpResult.correct.push({
123-
// content: (localTopic.answer == '√' ? true : false)
124-
// });
125-
// } else if (tmpResult.type <= 2) {
126-
// //单/多选
127-
// var reg = /[\w]/g;
128-
// var match = localTopic.answer.match(reg);
129-
// if (match != undefined) {
130-
// for (var i = 0; i < match.length; i++) {
131-
// tmpResult.correct.push({
132-
// option: match[i]
133-
// });
134-
// }
135-
// }
136-
// } else if (tmpResult.type == 4) {
137-
// //填空题,暂时空一下
138-
139-
// }
140-
// if (tmpResult.correct.length > 0) {
141-
// json[0].result.push(tmpResult);
142-
// prompt.innerHTML = "成功的从本地题库搜索到答案:<br />" + localTopic.content + "<br/>答案:" + localTopic.answer + "<br/>";
143-
// } else {
144-
// prompt.innerHTML += "<br />题库中无该题答案";
145-
// }
146-
// } else {
147-
// prompt.innerHTML += "<br />题库中无该题答案";
148-
// }
149-
// } else {
150-
// prompt.innerHTML += "搜索成功,答案:";
151-
// }
152-
153-
// switch (json["0"].result["0"].type) {
154-
// case 1:
155-
// case 2:
156-
// {
157-
// var options = document.getElementsByClassName('Cy_ulTop')[0].getElementsByTagName('li');
158-
// var answer = json["0"].result["0"].correct;
159-
// //选择题
160-
// for (let i = 0; i < answer.length; i++) {
161-
// console.log(options[answer[i].option.charCodeAt() - 65]);
162-
// if (options[answer[i].option.charCodeAt() - 65].className != 'Hover') {
163-
// options[answer[i].option.charCodeAt() - 65].click();
164-
// }
165-
// prompt.innerHTML += answer[i].option + '、' + answer[i].content + " "
166-
// }
167-
// break;
168-
// }
169-
// case 3:
170-
// {
171-
// var options = document.getElementsByClassName('Cy_ulBottom')[0].getElementsByTagName('li');
172-
// //判断题
173-
// if (json["0"].result["0"].correct["0"].content == true) {
174-
// options[0].click();
175-
// } else {
176-
// options[0].click();
177-
// }
178-
// break;
179-
// }
180-
// case 4:
181-
// {
182-
// //填空题
183-
// }
184-
// }
185-
186-
// }
187-
// }
188-
// }
189-
// }
190-
191-
// function dealTopic(topic) {
192-
// topic = removeHTML(topic.innerHTML);
193-
// var revHtml = /<[\s\S]*?>/g;
194-
// //处理分
195-
// topic = topic.replace(/\([\S]+?分)/, '')
196-
// topic = topic.replace(revHtml, '').trim();
197-
// return topic
198-
// }

src/cxmooc-tools/start.js

-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ window.onload = function () {
1919
'video_mute',
2020
'answer_ignore',
2121
'video_multiple',
22-
'blurry_answer'
2322
], function (items) {
2423
//设置一下配置
25-
if (items.blurry_answer == undefined) {
26-
items.blurry_answer = true;
27-
}
2824
localStorage['rand-answer'] = items.rand_answer;
2925
localStorage['config'] = JSON.stringify(items);
3026
});

tampermonkey.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// ==UserScript==
2+
// @name cxmooc-tools
3+
// @namespace https://github.com/CodFrm/cxmooc-tools
4+
// @version 1.0
5+
// @description 超星慕课小工具
6+
// @author CodFrm
7+
// @match *://*/mycourse/studentstudy?*
8+
// @match "*://*/ztnodedetailcontroller/visitnodedetail?*"
9+
// @grant nne
10+
// ==/UserScript==
11+
12+
let config = {
13+
answer_ignore: true, //忽略题目
14+
auto: true, //全自动挂机
15+
interval: "5", //时间间隔
16+
rand_answer: true, //随机答案
17+
video_multiple: "1", //视频播放倍速
18+
video_mute: true, //视频静音
19+
};
20+
localStorage['config'] = JSON.stringify(config);
21+

0 commit comments

Comments
 (0)