Home
Community
Scripts list
Browser Extension
Log In
Script Archived
This script has been archived by the author. The script may be no longer functional, and the author no longer maintains it. You cannot provide feedback for this script.
视频加速与时间加速demo
Home
Code
Issue
Comment
Version List
// ==UserScript== // @name 视频加速与时间加速demo // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.1 // @description 用于:http://time.tianqi.com/的时间加速和用于bilibili的一个视频倍速:https://www.bilibili.com/video/BV1ys411p7To // @author 王一之 // @match http://time.tianqi.com/ // @match https://www.bilibili.com/video/* // @run-at document-start // @grant unsafeWindow // ==/UserScript== let rate=4;//倍速 if(unsafeWindow.location.href.indexOf('time.tianqi.com')!=-1){ //时间网站,用时间加速 let hookSetInterval=unsafeWindow.setInterval;//将系统提供的setInterval保存 unsafeWindow.setInterval=function(a,b){//将系统的setInterval替换为我们自己的 return hookSetInterval(a,b/rate);//经过处理后再调用系统的setInterval } }else{ //bilibili用视频加速 unsafeWindow.onload=function(){ //在元素都加载完成后再监听video的播放时间,再进行倍速设置 unsafeWindow.document.querySelector('video').onplay=function(){ unsafeWindow.document.querySelector('video').playbackRate=rate; } } }