forked from QUST-Coder/AutoRunForZHS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TampermonkeyCode
56 lines (51 loc) · 1.83 KB
/
TampermonkeyCode
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
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://study.zhihuishu.com/learning/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var fa=$("body");
var btn=$("<li></li>");
var json={
"background":"#31e16d",
"height":"16px",
"padding":"5px",
"cursor": "pointer",
"top":"300px",
"right":"80px",
"position": "fixed"
};
btn.css(json);
btn.html("<span id='lfsenior'>开启自动播放模式</span>");
fa.append(btn);
var bodywidth=$("#body").css("width");
var mainwidth=$("#main").css("width");
btn.click(function () {
$("#lfsenior").html("自动模式已开启");
//关闭弹题
setInterval(function(){
//开启倍速播放
document.getElementsByClassName("speedTab15")[0].click();
$(".popboxes_close").click();
//获取当前进度
var spans=$(".current_play span");
var progress=spans[spans.size()-1].innerHTML;
if("100"==progress.substring(progress.lastIndexOf("『")+1,progress.lastIndexOf("』")-1)){
//播放完毕
$(".next_lesson a").click();
}else{
$("#vjs_mediaplayer_html5_api")[0].play();
$("#vjs_mediaplayer_html5_api")[0].muted=true;
}
$("#lfsenior").html("自动模式已开启,本章进度:"+progress+"%");
},100);
});
//开启自动模式
document.getElementById("lfsenior").click();
// Your code here...
})();