// ==UserScript== // @name 宏志助航计划 // @namespace https://bbs.tampermonkey.net.cn/ // @version 1.0.0 // @description 支持自动播放下一章和倍速播放 // @author 宿院网管 // @run-at document-start // @grant unsafeWindow // @match https://hzzh.chsi.com.cn/kc/xx/* // ==/UserScript== let rate = 2;//倍速 unsafeWindow.onload = function () { //在元素都加载完成后再监听video的播放时间,再进行倍速设置 unsafeWindow.document.querySelector('video').onplay = function () { unsafeWindow.document.querySelector('video').playbackRate = rate; } let hookSetInterval = unsafeWindow.setInterval; unsafeWindow.setInterval = function (a, b) { return hookSetInterval(a, b / rate); } unsafeWindow.document.querySelector('video').volume = 0 unsafeWindow.document.querySelector('video').play() var elevideo = document.querySelector("video"); elevideo.addEventListener('ended', function () { //结束 unsafeWindow.document.querySelector('video').play() }); }