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');
10
1
const common = require ( './common' ) ;
11
2
const chaoxing = require ( './chaoxing/chaoxing' ) ;
12
3
13
4
common . removeinjected ( document ) ;
14
5
global . config = JSON . parse ( localStorage [ 'config' ] ) ;
15
- global . timer = new Array ( ) ;
6
+ global . timer = new Array ( ) ;
16
7
if ( window . location . href . indexOf ( 'mycourse/studentstudy?' ) > 0 ) {
17
8
//超星学习页面
18
9
document . addEventListener ( 'load' , function ( ev ) {
@@ -26,7 +17,7 @@ if (window.location.href.indexOf('mycourse/studentstudy?') > 0) {
26
17
if ( frame != null ) {
27
18
factory ( 'chaoxing' ) . studentstudy ( ) ;
28
19
}
29
- } else if ( window . location . href . indexOf ( 'ztnodedetailcontroller/visitnodedetail' ) > 0 ) {
20
+ } else if ( window . location . href . indexOf ( 'ztnodedetailcontroller/visitnodedetail' ) > 0 ) {
30
21
//超星阅读页面
31
22
factory ( 'chaoxing' ) . read ( ) ;
32
23
}
@@ -43,156 +34,3 @@ function factory(object) {
43
34
}
44
35
}
45
36
}
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
- // }
0 commit comments