This repository was archived by the owner on Mar 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
49 lines (48 loc) · 1.79 KB
/
main.js
File metadata and controls
49 lines (48 loc) · 1.79 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
// ==UserScript==
// @name 英华学堂刷课脚本
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description 学堂在线自动播放下一集(仅在成都文理学院测试成功,其他学校没试)
// @author LayFz
// @match *://mooc.*
// @grant none
// @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
var playNext = function(){
// 定位当前数据
var localElement = $('.detmain-navlist ').parent().find('.item a').index($('a.on'));
// 所有课程数据
var sameChaperNameArray = $('.detmain-navlist ').parent().find('.item a');
if(localElement == (sameChaperNameArray.length-1)){
$('video')[0].onended = function(){
alert("Easy Easy,区区网课也敢班门弄斧!")
}
}else{
setTimeout(function(){
async : $(sameChaperNameArray[localElement+1])[0].click();
},5000);
}
}
$(document).ready(function(){
var timer = setInterval(function(){
if($('video').length && $('video')[0].readyState == 4){
if($('video')[0].readyState == 4){
if($('video')[0].paused){
console.log("paused");
$('video')[0].play();
}
$('video')[0].onended = function(){
playNext();
}
$('video')[0].muted = true;
$('video')[0].playbackRate = 1.0;
$('video')[0].currentTime = 0;
// $('video')[0].volume = 0;
clearInterval(timer);
}
}
},1000);
});
})();