-
Notifications
You must be signed in to change notification settings - Fork 7
/
script.js
36 lines (35 loc) · 1.37 KB
/
script.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
// ==UserScript==
// @name chinahrt helper
// @include https://web.chinahrt.com
// @version 1.0
// @description 自动播放教学视频,并设置多倍速,使网页失去焦点时不再自动暂停
// @author zhanghx0905
// @match http://videoadmin.chinahrt.com.cn/videoPlay/play*
// @match http://videoadmin.chinahrt.com/videoPlay/play*
// @match https://videoadmin.chinahrt.com.cn/videoPlay/play*
// @match https://videoadmin.chinahrt.com/videoPlay/play*
// ==/UserScript==
var rate = 16;
actualInterval = window.setInterval("addActualTime()", 1000 / rate);
playHandler = function () {
console.log("playHandler replaced");
if (typeof (actualInterval) == 'undefined') {
actualInterval = window.setInterval("addActualTime()", 1000 / rate);
}
h5Play();
}
$(document).ready(function () {
setTimeout(() => {
setInterval(() => {
var videoobj = document.getElementsByTagName("video")[0];
videoobj.playbackRate = rate;
videoobj.muted = true;
if (videoobj.paused) {
videoobj.play();
console.log('自动播放');
}
window.onfocus = function () { console.log('原始事件已被替换') };
window.onblur = function () { console.log('原始事件已被替换') };
}, 5000);
}, 1000);
})