-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScripts.js
More file actions
1779 lines (1759 loc) · 88.4 KB
/
Scripts.js
File metadata and controls
1779 lines (1759 loc) · 88.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ==UserScript==
// @name 学习通小助手
// @namespace unrival
// @version 1.01
// @description 后台任务、支持超星视频、文档、答题、自定义正确率、掉线自动登录、考试答题
// @author unrival
// @run-at document-end
// @storageName unrivalxxt
// @connect cx.icodef.com
// @run-at document-end
// @grant unsafeWindow
// @grant GM_setClipboard
// @match *://*.chaoxing.com/*
// @match *://*.edu.cn/*
// @match *://*.nbdlib.cn/*
// @match *://*.hnsyu.net/*
// @match *://scriptcat.org/script-show-page/*
// @icon http://pan-yz.chaoxing.com/favicon.ico
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addValueChangeListener
// @grant GM_info
// @grant GM_openInTab
// @license Copycat Has No Dick
// @connect mooc1-1.chaoxing.com
// @connect mooc1.chaoxing.com
// @connect mooc1-2.chaoxing.com
// @connect passport2-api.chaoxing.com
// @connect api.7j112.com
// @connect tencent-api.7j112.com
// @connect cx.icodef.com
// @contributionURL https://afdian.net/@unrival
// @antifeature payment
//如果脚本提示添加安全网址,请将脚本提示内容填写到下方区域,一行一个,如果不会,请加群询问
//安全网址请填写在上方空白区域
// ==/UserScript==
(()=>{
var maxRate = 300 , //倍速设置,倍速过高可能导致出现异常记录/清除进度,建议根据自己胆量修改。
jumpType = 1 , // 0:智能模式,1:遍历模式,2:不跳转,如果智能模式出现无限跳转/不跳转情况,请切换为遍历模式
disableMonitor = 0 ,// 0:无操作,1:解除多端学习监控,开启此功能后可以多端学习,不会被强制下线。
accuracy = 100,//章节测试正确率百分比,在答题正确率在规定之上并且允许自动提交时才会提交答案
randomDo = 0,//将0改为1,找不到答案的单选、多选、判断就会自动选【B、ABCD、错】,只在规定正确率不为100%时才生效
autoLogin = 0, //掉线是否自动登录,1为自动登录,需要配置登录信息(仅支持手机号+密码登陆)
phoneNumber = '', //自动登录的手机号,填写在单引号之间。
password = '', //自动登录的密码,填写在单引号之间。
kaoshiUrl = "mooc1.chaoxing.com/exam/test/reVersionTestStartNew",
ctUrl = 'http://cx.icodef.com/wyn-nb?v=2'; //题库服务器,填写在两个单引号之间,由题库作者向您提供,不懂不要修改。
rate = GM_getValue('unrivalrate','1'),
getQueryVariable = (variable) => {
let q = _l.search.substring(1),
v = q.split("&"),
r = false;
for (let i = 0, l = v.length; i < l; i++) {
let p = v[i].split("=");
p[0] == variable && (r = p[1]);
}
return r;
},
getCookie=(name)=>{
var ca,re=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(ca=_d.cookie.match(re)){
return unescape(ca[2]);
}else{
return '';
}
},
_w = unsafeWindow,
_d = _w.document,
_l = _w.location,
_p = _l.protocol,
_h = _l.host,
isEdge=_w.navigator.userAgent.includes("Edg/"),
isFf=_w.navigator.userAgent.includes("Firefox"),
isMobile = _w.navigator.userAgent.includes("Android"),
stop = false,
trim = (s)=>{
return s.replace('javascript:void(0);','').replace(new RegExp(" ",("gm")),'').replace(/^\s+/, '').replace(/\s+$/, '').replace(new RegExp(",",("gm")),',').replace(new RegExp("。",("gm")),'.').replace(new RegExp(":",("gm")),':').replace(new RegExp(";",("gm")),';').replace(new RegExp("?",("gm")),'?').replace(new RegExp("(",("gm")),'(').replace(new RegExp(")",("gm")),')').replace(new RegExp("“",("gm")),'"').replace(new RegExp("”",("gm")),'"');
},
cVersion = 999,
classId = getQueryVariable('clazzid')||getQueryVariable('clazzId')||getQueryVariable('classid')||getQueryVariable('classId'),
courseId = getQueryVariable('courseid')||getQueryVariable('courseId');
// 考试答题设置
// 设置修改后,需要刷新或重新打开网课页面才会生效
var setting = {
// 8E3 == 8000,科学记数法,表示毫秒数
time: 5E3, // 默认响应速度为8秒,不建议小于5秒
// 1代表开启,0代表关闭
none: 0, // 未找到答案或无匹配答案时执行默认操作,默认关闭
jump: 1, // 答题完成后自动切换,默认开启
copy: 0, // 自动复制答案到剪贴板,也可以通过手动点击按钮或答案进行复制,默认关闭
// 非自动化操作
hide: 0, // 不加载答案搜索提示框,键盘↑和↓可以临时移除和加载,默认关闭
scale: 0, // 富文本编辑器高度自动拉伸,用于文本类题目,答题框根据内容自动调整大小,默认关闭
},
_self = unsafeWindow,
$ = _self.jQuery,
UE = _self.UE;
if(parseFloat(rate)==parseInt(rate)){
rate = parseInt(rate);
}else{
rate = parseFloat(rate);
}
if(rate>maxRate){
rate = 1;
GM_setValue('unrivalrate',rate);
}
try{
_w.top.unrivalReviewMode = GM_getValue('unrivalreview','0')||'0';
_w.top.unrivalDoWork = GM_getValue('unrivaldowork','1')||'1';
_w.top.unrivalAutoSubmit = GM_getValue('unrivalautosubmit','0')||'0';
_w.top.unrivalAutoSave = GM_getValue('unrivalautosave','0')||'0';
}catch(e){}
if(_l.href.indexOf("knowledge/cards") >0){
GM_setValue('unrivalUd',getCookie('_uid'));
let allowBackground = false,
spans = _d.getElementsByTagName('span');
for(let i=0,l=spans.length;i<l;i++){
if(spans[i].innerHTML.indexOf('章节未开放')!=-1){
if(_l.href.indexOf("ut=s")!=-1){
_l.href = _l.href.replace("ut=s","ut=t").replace(/&cpi=[0-9]{1,10}/,'');
}else if(_l.href.indexOf("ut=t")!=-1){
spans[i].innerHTML = '此课程为闯关模式,请回到上一章节完成学习任务!'
return;
}
break;
}
}
_w.top.unrivalPageRd = String(Math.random());
if(!isFf){
try{
cVersion = parseInt(navigator.userAgent.match(/Chrome\/[0-9]{2,3}./)[0].replace('Chrome/','').replace('.',''));
}catch(e){}
}
var busyThread = 0,
getStr = (str, start, end)=> {
let res = str.substring(str.indexOf(start),str.indexOf(end)).replace(start,'');
return res ;
},
scripts = _d.getElementsByTagName('script'),
param = null,
rt='0.9';
for(let i=0,l=scripts.length;i<l;i++){
if(scripts[i].innerHTML.indexOf('mArg = "";')!=-1&&scripts[i].innerHTML.indexOf('==UserScript==')==-1){
param = getStr(scripts[i].innerHTML,'try{\n mArg = ',';\n}catch(e){');
}
}
if(param==null){
return;
}
try{
vrefer = _d.getElementsByClassName('ans-attach-online ans-insertvideo-online')[0].src;
}catch(e){
vrefer = _p+'//'+_h+'/ananas/modules/video/index.html?v=2022-0528-1945';
}
_d.getElementsByTagName("html")[0].innerHTML=`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>学习通小助手</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<link href="https://z.chaoxing.com/yanshi/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="row" style="margin: 10px;">
<div class="col-md-6 col-md-offset-3">
<div class="header clearfix">
<h3 class="text-muted" style="margin-top: 20px;margin-bottom: 0;float: left;"><a href="https://github.com/BaiSugar/ChaoXingScript" target="view_window">学习通小助手v1.0 </a></h3><div id="onlineNum"></div>
</div>
<hr style="margin-top: 10px;margin-bottom: 20px;">
<div class="panel panel-info" id="normalQuery">
<div class="panel-heading">任务配置</div>
<div class="panel-body">
<div>
<div style="padding: 0;font-size: 20px;float: left;">视频倍速:</div>
<div>
<input type="number" id="unrivalRate" style="width: 80px;">
 
<a id='updateRateButton' class="btn btn-default">保存</a>
|
<a id='reviewModeButton' class="btn btn-default">复习模式</a>
|
<a id='videoTimeButton' class="btn btn-default">查看学习进度</a>
|
<a id='fuckMeModeButton' class="btn btn-default" href="https://github.com/BaiSugar/ChaoXingScript/" target="view_window">Github</a>
</div><br>
<div style="padding: 0;font-size: 20px;float: left;">章节测试:</div>
<a id='autoDoWorkButton' class="btn btn-default">自动答题</a> |
<a id='autoSubmitButton' class="btn btn-default">自动提交</a> |
<a id='autoSaveButton' class="btn btn-default">自动保存</a>
</div>
</div>
</div>
<div class="panel panel-info" id='videoTime' style="display: none;height: 300px;">
<div class="panel-heading">学习进度</div>
<div class="panel-body" style="height: 100%;">
<iframe id="videoTimeContent" src="" frameborder="0" scrolling="auto"
style="width: 100%;height: 85%;"></iframe>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">任务列表</div>
<div class="panel-body" id='joblist'>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading">运行日志</div>
<div class="panel-body">
<div id="result" style="overflow:auto;line-height: 30px;">
<div id="log">
<span style="color: red">[00:00:00]如果此提示不消失,说明页面出现了错误,请联系作者</span>
</div>
</div>
</div>
</div>
<div class="panel panel-info" id='workPanel' style="display: none;height: 1000px;">
<div class="panel-heading">章节测试</div>
<div class="panel-body" id='workWindow' style="height: 100%;">
<iframe id="frame_content" name="frame_content" src="" frameborder="0" scrolling="auto"
style="width: 100%;height: 95%;"></iframe>
</div>
</div>
</div>
</div>
</body>
</html>
`;
var logs = {
"logArry": [],
"addLog": function(str, color = "black") {
if (this.logArry.length >= 50) {
this.logArry.splice(0, 1);
}
var nowTime = new Date();
var nowHour = (Array(2).join(0) + nowTime.getHours()).slice(-2);
var nowMin = (Array(2).join(0) + nowTime.getMinutes()).slice(-2);
var nowSec = (Array(2).join(0) + nowTime.getSeconds()).slice(-2);
this.logArry.push("<span style='color: " + color + "'>[" + nowHour + ":" + nowMin + ":" +
nowSec + "] " + str + "</span>");
let logStr = "";
for (let logI = 0, logLen = this.logArry.length; logI < logLen; logI++) {
logStr += this.logArry[logI] + "<br>";
}
_d.getElementById('log').innerHTML = logStr;
var logElement = _d.getElementById('log');
logElement.scrollTop = logElement.scrollHeight;
}
},
htmlHook = setInterval(function(){
if(_d.getElementById('unrivalRate')&&_d.getElementById('updateRateButton')&&_d.getElementById('reviewModeButton')&&_d.getElementById('autoDoWorkButton')&&_d.getElementById('autoSubmitButton')&&_d.getElementById('autoSaveButton')){
function afevaabrr(){
if(Math.round(new Date() / 1000)-parseInt(GM_getValue('unrivalBackgroundVideoEnable','6'))<15){
allowBackground = true;
_d.getElementById('fuckMeModeButton').setAttribute('href','unrivalxxtbackground/');
}else{
_d.getElementById('fuckMeModeButton').setAttribute('href','https://github.com/BaiSugar/ChaoXingScript');
allowBackground = false;
}
}
afevaabrr();
clearInterval(htmlHook);
if(cVersion<86){
logs.addLog('\u60a8\u7684\u6d4f\u89c8\u5668\u5185\u6838\u8fc7\u8001\uff0c\u8bf7\u66f4\u65b0\u7248\u672c\u6216\u4f7f\u7528\u4e3b\u6d41\u6d4f\u89c8\u5668\uff0c\u63a8\u8350\u003c\u0061\u0020\u0068\u0072\u0065\u0066\u003d\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0077\u0077\u0077\u002e\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u007a\u0068\u002d\u0063\u006e\u002f\u0065\u0064\u0067\u0065\u0022\u0020\u0074\u0061\u0072\u0067\u0065\u0074\u003d\u0022\u0076\u0069\u0065\u0077\u005f\u0077\u0069\u006e\u0064\u006f\u0077\u0022\u003e\u0065\u0064\u0067\u0065\u6d4f\u89c8\u5668\u0026\u0065\u006e\u0073\u0070\u003b\u007c\u003c\u002f\u0061\u003e\u003c\u0061\u0020\u0068\u0072\u0065\u0066\u003d\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0062\u0072\u006f\u0077\u0073\u0065\u0072\u002e\u0033\u0036\u0030\u002e\u0063\u006e\u002f\u0065\u0065\u0022\u0020\u0074\u0061\u0072\u0067\u0065\u0074\u003d\u0022\u0076\u0069\u0065\u0077\u005f\u0077\u0069\u006e\u0064\u006f\u0077\u0022\u003e\u007c\u0026\u0065\u006e\u0073\u0070\u003b\u0033\u0036\u0030\u6781\u901f\u6d4f\u89c8\u5668\u0028\u0036\u0034\u4f4d\u7248\u672c\u0029\u003c\u002f\u0061\u003e','red');
stop = true;
return;
}
if(isMobile){
logs.addLog('手机浏览器不保证能正常运行','red');
}
_d.getElementById('unrivalRate').value = rate;
_d.getElementById('updateRateButton').onclick = function(){
let urate = _d.getElementById('unrivalRate').value;
if(parseFloat(urate)==parseInt(urate)){
urate = parseInt(urate);
}else{
urate = parseFloat(urate);
}
if(urate>maxRate){
_d.getElementById('unrivalRate').value = rate;
logs.addLog('已超过脚本限制最高倍速,修改失败,<b>倍速大于1可能会面临清除进度/全校通报风险</b>,如有特殊需求请修改脚本代码内限制参数','red');
return;
}
GM_setValue('unrivalrate',urate);
rate = urate;
if(urate>0){
logs.addLog('视频倍速已更新为'+urate+'倍,将在3秒内生效','green');
}else{
logs.addLog('奇怪的倍速,将会自动跳过视频任务','red');
}
}
_d.getElementById('reviewModeButton').onclick=function(){
let reviewButton = _d.getElementById('reviewModeButton');
if(reviewButton.getAttribute('class')=='btn btn-default'){
_d.getElementById('reviewModeButton').setAttribute('class','btn btn-success');
logs.addLog('复习模式已开启,遇到已完成的视频任务不会跳过','green');
GM_setValue('unrivalreview','1');
_w.top.unrivalReviewMode = '1';
}else{
_d.getElementById('reviewModeButton').setAttribute('class','btn btn-default');
logs.addLog('复习模式已关闭,遇到已完成的视频任务会自动跳过','green');
GM_setValue('unrivalreview','0');
_w.top.unrivalReviewMode = '0';
}
}
_d.getElementById('autoDoWorkButton').onclick=function(){
let autoDoWorkButton = _d.getElementById('autoDoWorkButton');
if(autoDoWorkButton.getAttribute('class')=='btn btn-default'){
_d.getElementById('autoDoWorkButton').setAttribute('class','btn btn-success');
logs.addLog('自动做章节测试已开启,将会自动做章节测试','green');
GM_setValue('unrivaldowork','1');
_w.top.unrivalDoWork = '1';
}else{
_d.getElementById('autoDoWorkButton').setAttribute('class','btn btn-default');
logs.addLog('自动做章节测试已关闭,将不会自动做章节测试','green');
GM_setValue('unrivaldowork','0');
_w.top.unrivalDoWork = '0';
}
}
_d.getElementById('autoSubmitButton').onclick=function(){
let autoSubmitButton = _d.getElementById('autoSubmitButton');
if(autoSubmitButton.getAttribute('class')=='btn btn-default'){
_d.getElementById('autoSubmitButton').setAttribute('class','btn btn-success');
logs.addLog('符合提交标准的章节测试将会自动提交','green');
GM_setValue('unrivalautosubmit','1');
_w.top.unrivalAutoSubmit = '1';
}else{
_d.getElementById('autoSubmitButton').setAttribute('class','btn btn-default');
logs.addLog('章节测试将不会自动提交','green');
GM_setValue('unrivalautosubmit','0');
_w.top.unrivalAutoSubmit = '0';
}
}
_d.getElementById('autoSaveButton').onclick=function(){
let autoSaveButton = _d.getElementById('autoSaveButton');
if(autoSaveButton.getAttribute('class')=='btn btn-default'){
_d.getElementById('autoSaveButton').setAttribute('class','btn btn-success');
logs.addLog('不符合提交标准的章节测试将会自动保存','green');
GM_setValue('unrivalautosave','1');
_w.top.unrivalAutoSave = '1';
}else{
_d.getElementById('autoSaveButton').setAttribute('class','btn btn-default');
logs.addLog('不符合提交标准的章节测试将不会自动保存,等待用户自己操作','green');
GM_setValue('unrivalautosave','0');
_w.top.unrivalAutoSave = '0';
}
}
_d.getElementById('videoTimeButton').onclick=function(){
_d.getElementById('videoTime').style.display = 'block';
_d.getElementById('videoTimeContent').src=_p+'//stat2-ans.chaoxing.com/task/s/index?courseid='+courseId+'&clazzid='+classId;
}
}
},100),
loopjob= ()=>{
if(_w.top.unrivalScriptList.length>1){
logs.addLog('您同时开启了多个刷课脚本,会挂科的!','red');
}
if(cVersion<8.6*10){
logs.addLog('\u60a8'+'\u7684'+'\u6d4f'+'\u89c8'+'\u5668'+'\u5185'+'\u6838'+'\u8fc7'+'\u8001'+'\uff0c'+'\u8bf7'+'\u66f4'+'\u65b0'+'\u7248'+'\u672c'+'\u6216'+'\u4f7f'+'\u7528'+'\u4e3b'+'\u6d41'+'\u6d4f'+'\u89c8'+'\u5668'+'\uff0c\u63a8\u8350\u003c\u0061\u0020\u0068\u0072\u0065\u0066\u003d\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0077\u0077\u0077\u002e\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u007a\u0068\u002d\u0063\u006e\u002f\u0065\u0064\u0067\u0065\u0022\u0020\u0074\u0061\u0072\u0067\u0065\u0074\u003d\u0022\u0076\u0069\u0065\u0077\u005f\u0077\u0069\u006e\u0064\u006f\u0077\u0022\u003e\u0065\u0064\u0067\u0065\u6d4f\u89c8\u5668\u0026\u0065\u006e\u0073\u0070\u003b\u007c\u003c\u002f\u0061\u003e\u003c\u0061\u0020\u0068\u0072\u0065\u0066\u003d\u0022\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0062\u0072\u006f\u0077\u0073\u0065\u0072\u002e\u0033\u0036\u0030\u002e\u0063\u006e\u002f\u0065\u0065\u0022\u0020\u0074\u0061\u0072\u0067\u0065\u0074\u003d\u0022\u0076\u0069\u0065\u0077\u005f\u0077\u0069\u006e\u0064\u006f\u0077\u0022\u003e\u007c\u0026\u0065\u006e\u0073\u0070\u003b\u0033\u0036\u0030\u6781\u901f\u6d4f\u89c8\u5668\u0028\u0036\u0034\u4f4d\u7248\u672c\u0029\u003c\u002f\u0061\u003e','red');
stop = true;
return;
}
if(stop){
return;
}
let missionli = missionList;
if(missionli==[]){
setTimeout(loopjob,500);
return;
}
for(let itemName in missionli){
if(missionli[itemName]['running']){
setTimeout(loopjob,500);
return;
}
}
for(let itemName in missionli){
if(!missionli[itemName]['done']){
switch(missionli[itemName]['type']){
case 'video':doVideo(missionli[itemName]);
break;
case 'document':doDocument(missionli[itemName]);
break;
case 'work':doWork(missionli[itemName]);
break;
}
setTimeout(loopjob,500);
return;
}
}
if(busyThread <=0){
if(jumpType!=2){
_w.top.jump = true;
logs.addLog('所有任务处理完毕,5秒后自动下一章','green');
}else{
logs.addLog('所有任务处理完毕,用户设置为不跳转,脚本已结束运行,如需自动跳转,请编辑脚本代码参数','green');
}
clearInterval(loopjob);
}else{
setTimeout(loopjob,500);
}
},
readyCheck = ()=>{
setTimeout(function(){
try{
if(_w.top.unrivalReviewMode=='1'){
logs.addLog('复习模式已开启,遇到已完成的视频任务不会跳过','green');
_d.getElementById('reviewModeButton').setAttribute('class',['btn btn-default','btn btn-success'][_w.top.unrivalReviewMode]);
}
if(_w.top.unrivalDoWork=='1'){
logs.addLog('自动做章节测试已开启,将会自动做章节测试','green');
_d.getElementById('autoDoWorkButton').setAttribute('class',['btn btn-default','btn btn-success'][_w.top.unrivalDoWork]);
}
_d.getElementById('autoSubmitButton').setAttribute('class',['btn btn-default','btn btn-success'][_w.top.unrivalAutoSubmit]);
_d.getElementById('autoSaveButton').setAttribute('class',['btn btn-default','btn btn-success'][_w.top.unrivalAutoSave]);
}catch(e){
console.log(e);
readyCheck();
return;
}
},500);
}
readyCheck();
try{
var pageData = JSON.parse(param);
}catch(e){
if(jumpType!=2){
_w.top.jump = true;
logs.addLog('此页无任务,5秒后自动下一章','green');
}else{
logs.addLog('此页无任务,用户设置为不跳转,脚本已结束运行,如需自动跳转,请编辑脚本代码参数','green');
}
return;
}
var data = pageData['defaults'],
jobList = [],
classId = data['clazzId'],
chapterId = data['knowledgeid'],
reportUrl = data['reportUrl'];
for(let i=0,l=pageData['attachments'].length;i<l;i++){
let item = pageData['attachments'][i];
if(item['job']!=true||item['isPassed']==true){
if(_w.top.unrivalReviewMode=='1'&&item['type']=='video'){
jobList.push(item);
}else{
continue;
}
}else{
jobList.push(item);
}
}
var video_getReady=(item)=>{
let statusUrl = _p+'//'+_h+'/ananas/status/'+item['property']['objectid']+'?k='+getCookie('fid')+'&flag=normal&_dc='+String(Math.round(new Date())),
doubleSpeed = item['property']['doublespeed'];
busyThread +=1;
GM_xmlhttpRequest({
method: "get",
headers: {
'Host': _h,
'Referer': vrefer,
'Sec-Fetch-Site':'same-origin'
},
url: statusUrl,
onload: function(res) {
try{
busyThread -=1;
let videoInfo = JSON.parse(res.responseText),
duration = videoInfo['duration'],
dtoken = videoInfo['dtoken'];
if(duration==undefined){
_d.getElementById('joblist').innerHTML += `
<div class="panel panel-default">
<div class="panel-body">
`+'[无效视频]'+item['property']['name']+`
</div>
</div>`
return;
}
missionList['m'+item['jobid']]={
'type':'video',
'dtoken':dtoken,
'duration':duration,
'objectId':item['property']['objectid'],
'otherInfo':item['otherInfo'],
'doublespeed':doubleSpeed,
'jobid':item['jobid'],
'name':item['property']['name'],
'done':false,
'running':false
};
_d.getElementById('joblist').innerHTML += `
<div class="panel panel-default">
<div class="panel-body">
`+'[视频]'+item['property']['name']+`
</div>
</div>`
}catch(e){
}
},
onerror:function(err){
console.log(err);
if(err.error.indexOf('@connect list')>=0){
logs.addLog('请添加安全网址,将 【 //@connect '+_h+' 】方括号里的内容(不包括方括号)添加到脚本代码内指定位置,否则脚本无法正常运行,如图所示:','red');
logs.addLog('<img src="https://pan-yz.chaoxing.com/thumbnail/0,0,0/609a8b79cbd6a91d10c207cf2b5f368d">');
stop = true;
}else{
logs.addLog('获取任务详情失败','red');
logs.addLog('错误原因:'+err.error,'red');
}
}
});
},
doVideo = (item)=>{
if(rate<=0){
missionList['m'+item['jobid']]['running']=true;
logs.addLog('奇怪的倍速,视频已自动跳过','red');
setTimeout(function(){
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
},5000);
return;
}
let videojs_id = String(parseInt(Math.random() * 9999999));
_d.cookie='videojs_id='+videojs_id+';path=/'
logs.addLog('开始刷视频:'+item['name']+',倍速:'+String(rate)+'倍');
logs.addLog('视频观看信息每60秒上报一次,请耐心等待,脚本在正常运行,请不要在60秒内卸载脚本然后去评论脚本不能用,奶奶滴!','green');
if(item['doublespeed']==0&&rate!=1&&_w.top.unrivalReviewMode=='0'){
logs.addLog('倍速播放此视频有99%几率导致“老师发现”、“清除进度”!!!','red');
logs.addLog('倍速播放此视频有99%几率导致“老师发现”、“清除进度”!!!','red');
logs.addLog('倍速播放此视频有99%几率导致“老师发现”、“清除进度”!!!','red');
}
let playTime = 0,
playsTime = 0,
isdrag = '3',
times = 0,
encUrl = '',
first = true,
loop = setInterval(function(){
if(rate<=0){
clearInterval(loop);
logs.addLog('奇怪的倍速,视频已自动跳过','red');
setTimeout(function(){
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
},5000);
return;
}
playsTime += rate;
playTime = Math.ceil(playsTime);
if(times==0||times%60==0||playTime>=item['duration']){
if(first){
playTime = 0;
}
if(playTime>=item['duration']){
clearInterval(loop);
playTime = item['duration'];
isdrag = '4';
}else if(playTime>0){
isdrag = '0';
}
busyThread +=1;
let _bold_playTime = playTime;
GM_xmlhttpRequest({
method: "get",
url: "",
onload: function(res) {
var enc_Unencrypted = "["+classId+"]["+GM_getValue('unrivalUd','666')+"]["+item['jobid']+"]["+item['objectId']+"]["+_bold_playTime*1000+"][d_yHJ!$pdA~5]["+item['duration']*1000+"][0_"+item['duration']+"]";
var enc = md5(enc_Unencrypted,32);
logs.addLog("视频enc: "+enc,'green');
let reportsUrl = reportUrl+'/'+item['dtoken']+'?clazzId='+classId+'&playingTime='+_bold_playTime+'&duration='+item['duration']+'&clipTime=0_'+item['duration']+'&objectId='+item['objectId']+'&otherInfo='+item['otherInfo']+'&jobid='+item['jobid']+'&userid='+ GM_getValue('unrivalUd','666')+'&isdrag='+isdrag+'&view=pc&enc='+enc+'&rt='+rt+'&dtype=Video&_t='+String(Math.round(new Date()));
GM_xmlhttpRequest({
method: "get",
headers: {
'Host': _h,
'Referer': vrefer,
'Sec-Fetch-Site':'same-origin',
'Content-Type': 'application/json'
},
url: reportsUrl,
onload: function(res) {
if(GM_getValue('unrivalUd','666')!=getCookie('_uid')){
stop = true;
logs.addLog('\u591a\u8d26\u53f7\u540c\u5237\u4f1a\u5bfc\u81f4\u5f02\u5e38\uff0c\u8bf7\u5173\u95ed\u6240\u6709\u6d4f\u89c8\u5668\u7a97\u53e3\u540e\u91cd\u8bd5','red');
}
try{
busyThread -=1;
let ispass = JSON.parse(res.responseText);
first = false;
if(ispass['isPassed']&&_w.top.unrivalReviewMode=='0'){
logs.addLog('视频任务已完成','green');
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
clearInterval(loop);
}else if(isdrag == '4'){
if(_w.top.unrivalReviewMode=='1'){
logs.addLog('视频已观看完毕','green');
}else{
logs.addLog('视频已观看完毕,但视频任务未完成','red');
}
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
try{
clearInterval(loop);
}catch(e){
}
}else{
logs.addLog(item['name']+'已观看'+_bold_playTime+'秒,剩余大约'+String(item['duration']-_bold_playTime)+'秒');
}
}catch(e){
console.log(e);
if(res.responseText.indexOf('验证码')>=0){
logs.addLog('已被超星风控,请<a href="'+reportsUrl+'" target="_blank">点我处理</a>,60秒后自动刷新页面','red');
missionList['m'+item['jobid']]['running']=false;
clearInterval(loop);
stop = true;
setTimeout(function(){
_l.reload();
},60000);
return;
}
if(rt=='0.9'){
if(first){
logs.addLog('超星返回错误信息,尝试更换参数','orange');
rt='1';
times = -3;
}else{
logs.addLog('超星返回错误信息,十秒后重试(1)','red');
times = -10;
}
return;
}else{
if(first){
rt='0.9';
}
logs.addLog('超星返回错误信息,十秒后重试(2)','red');
times = -10;
console.log(res.responseText);
return;
}
}
},
onerror:function(err){
console.log(err);
if(err.error.indexOf('@connect list')>=0){
logs.addLog('请添加安全网址,将 【 //@connect '+_h+' 】方括号里的内容(不包括方括号)添加到脚本代码内指定位置,否则脚本无法正常运行,如图所示:','red');
logs.addLog('<img src="https://pan-yz.chaoxing.com/thumbnail/0,0,0/609a8b79cbd6a91d10c207cf2b5f368d">');
stop = true;
}else{
logs.addLog('观看视频失败','red');
logs.addLog('错误原因:'+err.error,'red');
}
missionList['m'+item['jobid']]['running']=false;
clearInterval(loop);
}
});
},
onerror:function(err){
console.log(err);
logs.addLog('获取视频enc失败,请检查脚本插件是否有完整的访问权限,具体请见脚本下载页','red');
missionList['m'+item['jobid']]['running']=false;
clearInterval(loop);
}
});
}
times+=1;
},1000);
missionList['m'+item['jobid']]['running']=true;
},
doDocument=(item)=>{
missionList['m'+item['jobid']]['running']=true;
logs.addLog('开始刷文档:'+item['name']);
setTimeout(function(){
busyThread += 1;
GM_xmlhttpRequest({
method: "get",
url: _p+'//'+_h+'/ananas/job/document?jobid='+item['jobid']+'&knowledgeid='+chapterId+'&courseid='+courseId+'&clazzid='+classId+'&jtoken='+item['jtoken'],
onload: function(res) {
try{
busyThread -= 1;
let ispass = JSON.parse(res.responseText);
if(ispass['status']){
logs.addLog('文档任务已完成','green');
}else{
logs.addLog('文档已阅读完成,但任务点未完成','red');
}
}catch(err){
console.log(err);
console.log(res.responseText);
logs.addLog('解析文档内容失败','red');
}
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
},
onerror:function(err){
console.log(err);
if(err.error.indexOf('@connect list')>=0){
logs.addLog('请添加安全网址,将 【 //@connect '+_h+' 】方括号里的内容(不包括方括号)添加到脚本代码内指定位置,否则脚本无法正常运行,如图所示:','red');
logs.addLog('<img src="https://pan-yz.chaoxing.com/thumbnail/0,0,0/609a8b79cbd6a91d10c207cf2b5f368d">');
stop = true;
}else{
logs.addLog('阅读文档失败','red');
logs.addLog('错误原因:'+err.error,'red');
}
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
}
});
},parseInt(Math.random()*2000+9000,10))
},
doWork = (item)=>{
missionList['m'+item['jobid']]['running']=true;
logs.addLog('开始刷章节测试:'+item['name']);
logs.addLog('您设置的答题正确率为:'+String(accuracy)+'%,只有在高于此正确率时才会提交测试','blue');
logs.addLog('您设置的题库接口为:'+ctUrl,'blue');
_d.getElementById('workPanel').style.display = 'block';
_d.getElementById('frame_content').src=_p+'//'+_h+'/work/phone/work?workId='+item['jobid'].replace('work-','')+'&courseId='+courseId+'&clazzId='+classId+'&knowledgeId='+chapterId+'&jobId='+item['jobid']+'&enc='+item['enc'];
_w.top.unrivalWorkInfo='';
_w.top.unrivalDoneWorkId='';
setInterval(function(){
if(_w.top.unrivalWorkInfo!=''){
logs.addLog(_w.top.unrivalWorkInfo);
_w.top.unrivalWorkInfo='';
}
},100);
let checkcross=setInterval(function(){
if(_w.top.unrivalWorkDone==false){
clearInterval(checkcross);
return;
}
let ifW = _d.getElementById('frame_content').contentWindow;
try{
ifW.location.href;
}catch(e){
console.log(e);
if(e.message.indexOf('cross-origin')!=-1){
clearInterval(checkcross);
_w.top.unrivalWorkDone = true;
return;
}
}
},2000);
let workDoneInterval = setInterval(function(){
if(_w.top.unrivalWorkDone){
_w.top.unrivalWorkDone = false;
clearInterval(workDoneInterval);
_w.top.unrivalDoneWorkId = '';
_d.getElementById('workPanel').style.display = 'none';
_d.getElementById('frame_content').src='';
setTimeout(function(){
missionList['m'+item['jobid']]['running']=false;
missionList['m'+item['jobid']]['done']=true;
},5000);
}
},500);
},
missionList = [];
if(jobList.length<=0){
if(jumpType!=2){
_w.top.jump = true;
logs.addLog('此页无任务,5秒后自动下一章','green');
}else{
logs.addLog('此页无任务,用户设置为不跳转,脚本已结束运行,如需自动跳转,请编辑脚本代码参数','green');
}
return;
}
for(let i=0,l=jobList.length;i<l;i++){
let item = jobList[i];
if(item['type']=='video'){
video_getReady(item);
}else if(item['type']=='document'){
missionList['m'+item['jobid']]={
'type':'document',
'jtoken':item['jtoken'],
'jobid':item['jobid'],
'name':item['property']['name'],
'done':false,
'running':false
};
_d.getElementById('joblist').innerHTML += `
<div class="panel panel-default">
<div class="panel-body">
`+'[文档]'+item['property']['name']+`
</div>
</div>`
}else if(item['type']=='workid'&&_w.top.unrivalDoWork=='1'){
missionList['m'+item['jobid']]={
'type':'work',
'workid':item['property']['workid'],
'jobid':item['jobid'],
'name':item['property']['title'],
'enc':item['enc'],
'done':false,
'running':false
};
_d.getElementById('joblist').innerHTML += `
<div class="panel panel-default">
<div class="panel-body">
`+'[章节测试]'+item['property']['title']+`
</div>
</div>`
}else{
try{
let jobName = item['property']['name'];
if(jobName==undefined){
jobName = item['property']['title'];
}
_d.getElementById('joblist').innerHTML += `
<div class="panel panel-default">
<div class="panel-body">
`+'已跳过:'+jobName+`
</div>
</div>`
}catch(e){
}
}
}
loopjob();
}else if(_l.href.indexOf("mycourse/studentstudy") >0){
try{
_w.unrivalScriptList.push('Fuck me please');
}catch(e){
_w.unrivalScriptList = ['Fuck me please'];
}
function checkOffline(){
let dleft = _d.getElementsByClassName('left');
if(dleft.length==1){
let img=dleft[0].getElementsByTagName('img');
if(img.length==1){
if(img[0].src.indexOf('loading.gif')!=-1){
return true;
}
}
}
return false;
}
setInterval(function(){
if(checkOffline()){
setTimeout(function(){
if(checkOffline()){
_l.reload();
}
},10000)
}
},3000);
_w.unrivalgetTeacherAjax = _w.getTeacherAjax;
_w.getTeacherAjax=(courseid,classid,cid)=>{
if(cid==getQueryVariable('chapterId')){
return;
}
_w.top.unrivalPageRd = '';
_w.unrivalgetTeacherAjax(courseid,classid,cid);
}
if(disableMonitor == 1){
_w.appendChild = _w.Element.prototype.appendChild;
_w.Element.prototype.appendChild = function(){
try{
if(arguments[0].src.indexOf('detect.chaoxing.com')>0){
return;
}
}catch(e){}
_w.appendChild.apply(this, arguments);
};
}
_w.jump = false;
setInterval(function(){
if(getQueryVariable('mooc2')=='1'){
let tabs= _d.getElementsByClassName('posCatalog_select');
for(let i=0,l=tabs.length;i<l;i++){
let tabId = tabs[i].getAttribute('id');
if(tabId.indexOf('cur')>=0&&tabs[i].getAttribute('class')=='posCatalog_select'){
tabs[i].setAttribute('onclick',"getTeacherAjax('"+courseId+"','"+classId+"','"+tabId.replace('cur','')+"');");
}
}
}else{
let h4s = _d.getElementsByTagName('h4'),
h5s = _d.getElementsByTagName('h5');
for(let i=0,l=h4s.length;i<l;i++){
if(h4s[i].getAttribute('id').indexOf('cur')>=0){
h4s[i].setAttribute('onclick',"getTeacherAjax('"+courseId+"','"+classId+"','"+h4s[i].getAttribute('id').replace('cur','')+"');");
}
}
for(let i=0,l=h5s.length;i<l;i++){
if(h5s[i].getAttribute('id').indexOf('cur')>=0){
h5s[i].setAttribute('onclick',"getTeacherAjax('"+courseId+"','"+classId+"','"+h5s[i].getAttribute('id').replace('cur','')+"');");
}
}
}
},1000);
setInterval(function(){
let but = null;
if(_w.jump){
_w.jump = false;
_w.top.unrivalDoneWorkId = '';
_w.jjump =(rd)=>{
if(rd!=_w.top.unrivalPageRd){
return;
}
try{
setTimeout(function(){
if(jumpType == 1){
if(getQueryVariable('mooc2')=='1'){
but = _d.getElementsByClassName('jb_btn jb_btn_92 fs14 prev_next next');
}else{
but = _d.getElementsByClassName('orientationright');
}
try{
setTimeout(function(){
if(rd!=_w.top.unrivalPageRd){
return;
}
but[0].click();
},2000);
}catch(e){
}
return;
}
if(getQueryVariable('mooc2')=='1'){
let ul = _d.getElementsByClassName('prev_ul')[0],
lis = ul.getElementsByTagName('li');
for(let i=0,l=lis.length;i<l;i++){
if(lis[i].getAttribute('class')=='active'){
if(i+1>=l){
break;
}else{
try{
lis[i+1].click();
}catch(e){}
return;
}
}
}
let tabs= _d.getElementsByClassName('posCatalog_select');
for(let i=0,l=tabs.length;i<l;i++){
if(tabs[i].getAttribute('class')=='posCatalog_select posCatalog_active'){
while(i+1<tabs.length){
let nextTab= tabs[i+1];
if((nextTab.innerHTML.includes('icon_Completed prevTips')&&_w.top.unrivalReviewMode=='0')||nextTab.innerHTML.includes('catalog_points_er prevTips')){
i++;
continue;
}
if(nextTab.id.indexOf('cur')<0){
i++;
continue;
}
let clickF = setInterval(function(){
if(rd!=_w.top.unrivalPageRd){
clearInterval(clickF);
return;
}
nextTab.click();
},2000);
break;
}
break;
}
}
}else{
let div = _d.getElementsByClassName('tabtags')[0],
spans = div.getElementsByTagName('span');
for(let i=0,l=spans.length;i<l;i++){
if(spans[i].getAttribute('class').indexOf('currents')>=0){
if(i+1==l){
break;
}else{
try{
spans[i+1].click();
}catch(e){}
return;
}
}
}
let tabs= _d.getElementsByTagName('span'),
newTabs = [];
for(let i=0,l=tabs.length;i<l;i++){
if(tabs[i].getAttribute('style')!=null&&tabs[i].getAttribute('style').indexOf('cursor:pointer;height:18px;')>=0){
newTabs.push(tabs[i]);
}
}
tabs = newTabs;
for(let i=0,l=tabs.length;i<l;i++){
if(tabs[i].parentNode.getAttribute('class')=='currents'){
while(i+1<tabs.length){
let nextTab= tabs[i+1].parentNode;
if((nextTab.innerHTML.includes('roundpoint blue')&&_w.top.unrivalReviewMode=='0')||nextTab.innerHTML.includes('roundpointStudent lock')){
i++;
continue;
}
if(nextTab.id.indexOf('cur')<0){
i++;
continue;
}
let clickF = setInterval(function(){
if(rd!=_w.top.unrivalPageRd){