-
Notifications
You must be signed in to change notification settings - Fork 0
/
职教云刷课脚本.js
206 lines (204 loc) · 8.02 KB
/
职教云刷课脚本.js
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
// ==UserScript==
// @name 职教云刷课(慢,稳)
// @namespace Violentmonkey Scripts
// @match https://zjy2.icve.com.cn/*
// @grant none
// @version 5.31
// @author -
// @description 2020/5/8 上午9:11:21
// ==/UserScript==
window.onload=function(){
setTimeout(function(){
if(document.getElementsByClassName("am-progress-bar").length!=0){
localStorage.setItem("home",window.location.href);
console.log("刷课地址已储存。")
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 120px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px 40px;font-size:12px")
div.innerHTML='全局模式<input name="mode" type="radio" value=""/><br>智能搜索模式<input name="mode" type="radio" value=""/>'
document.body.appendChild(div);
console.log("刷课地址为:"+localStorage.getItem("home"));
if(localStorage.getItem("mode")!=null){
if(localStorage.getItem("mode")==1){
document.getElementsByName("mode")[0].checked=true;
mode1();
}else{
document.getElementsByName("mode")[1].checked=true;
mode2();
}
}
setInterval(function(){
if(document.getElementsByName("mode")[0].checked){
localStorage.setItem("mode",1);
}
if(document.getElementsByName("mode")[1].checked){
localStorage.setItem("mode",2);
}
},100)
}
},3000)
function mode1(){
var res=false;
var openmenu=setInterval(function(){
try{
var fu=document.getElementsByClassName("am-icon-caret-right")[0];
fu.click();
var Tasks=fu.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("sh-res_p");
for(var i = 0;i<Tasks.length;i++){
if(parseInt(Tasks[i].style.width)<95){
console.log(Tasks[i].style.width);
Tasks[i].click();
break;
}
}
}catch(e){
res=true;
console.log(res);
clearInterval(openmenu);
}
},1200);
}
function mode2(){
var zhang;
var kai;
if(document.getElementsByClassName("am-progress-bar").length!=0){
zhang=document.getElementsByClassName("am-progress-bar");
for(var i =0;i<zhang.length;i++){
if(parseInt(zhang[i].style.width)<97){
kai=zhang[i].parentNode.parentNode.getElementsByClassName("am-icon-caret-right")[0];
if(kai==null){
kai=zhang[i].parentNode.parentNode.getElementsByClassName("am-icon-caret-down")[0];
}
kai.click();
break;
}else{
if(zhang[i].parentNode.parentNode.getElementsByClassName("am-icon-caret-down").length!=0){
zhang[i].parentNode.parentNode.getElementsByClassName("am-icon-caret-down")[0].click();
}
}
}
var timegetmenu=setInterval(function(){
try{
var ke=kai.parentNode.parentNode.getElementsByClassName("am-icon-caret-right")[0];
ke.click();
console.log(ke);
}catch(e){
console.log("打开目录完毕");
clearInterval(timegetmenu);
getK();
}
},1000);
}
}
function getK(){
var all=document.getElementsByClassName("sh-res_p");
for(var jj =0;jj<=all.length;jj++){
console.log(parseInt(all[jj].style.width));
if(parseInt(all[jj].style.width)<95){
all[jj].click();
break;
}
}
}
var mp;
var nextbtn;
var a=0;
setTimeout(function(){
if(document.getElementsByClassName("jw-video")[0]!=null){
mp=document.getElementsByClassName("jw-video")[0];
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px")
div.innerHTML='勾选视频页面静音 <input type="checkbox" id="jingyin">';
document.body.appendChild(div);
if(localStorage.getItem("muted")=="true"){
document.getElementById("jingyin").checked=true;
mp.muted=true;
}
document.getElementById("jingyin").onclick=function(){
if(document.getElementById("jingyin").checked){
localStorage.setItem("muted","true");
mp.muted=true;
}else{
localStorage.setItem("muted","flase");
mp.muted=false;
}
}
setInterval(function(){
mp.onended=function(){
setTimeout(function(){
window.location.href=localStorage.getItem("home");
},5000)
}
},1000);
}
if(document.getElementsByClassName("MPreview-arrowBottom")[0]!=null){
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px;font-size:12px")
div.innerText="文档页面";
document.body.appendChild(div);
console.log("找到下一页按钮");
var itemcount=parseInt(document.getElementsByClassName("MPreview-pageCount")[0].getElementsByTagName("em")[0].textContent);
nextbtn=document.getElementsByClassName("MPreview-arrowBottom")[0];
var ino=setInterval(function(){
if(a<itemcount){
console.log(a);
nextbtn.click();
a++;
}else{
clearInterval(ino);
window.location.href=localStorage.getItem("home");
}
},3000)
}
if(document.getElementsByClassName("stage-next-btn")[0]!=null){
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px;font-size:12px")
div.innerText="ppt页面停留120s";
document.body.appendChild(div);
console.log("找到下一页按钮");
nextbtn=document.getElementsByClassName("stage-next-btn")[0];
var ino=setInterval(function(){
a++;
if(a<120){
console.log(a);
nextbtn.click();
}else{
clearInterval(ino);
window.location.href=localStorage.getItem("home");
}
},1000)
}
if(document.getElementById("studyNow")!=null){
document.getElementById("studyNow").click();
}
if(document.getElementsByClassName("np-link-go")[0]!=null){
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px")
div.innerText="压缩包页面"
document.body.appendChild(div);
console.log("压缩包页面");
setTimeout(function(){
window.location.href=localStorage.getItem("home");
},5000);
}
if(document.getElementsByClassName("iviewer_cursor")[0]!=null){
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px")
div.innerText="图片页面"
document.body.appendChild(div);
console.log("图片页面");
setTimeout(function(){
window.location.href=localStorage.getItem("home");
},5000);
}
if(document.getElementsByTagName("param")[0]!=null){
var div=document.createElement("div");
div.setAttribute("style"," color: white;width: 100px;height: 60px;background: black;position: fixed;right: 0;bottom: 0;padding:10px;border-radius:8px;margin:5px")
div.innerText="swf页面"
document.body.appendChild(div);
console.log("swf页面");
setTimeout(function(){
window.location.href=localStorage.getItem("home");
},5000);
}
},3000)
}