Last active
May 25, 2023 10:01
-
-
Save yang10560/4b0f350c76c8bdc245c29dcdf246bf05 to your computer and use it in GitHub Desktop.
B站视频调速
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name B站视频调速 | |
// @namespace yeyu | |
// @version 0.1 | |
// @description bilibili视频调速,突破2倍速 | |
// @author 夜雨 | |
// @match http*://www.bilibili.com/video/* | |
// @match http*://www.bilibili.com/bangumi/play/* | |
// @grant GM_addStyle | |
// @license MIT | |
// ==/UserScript== | |
(function() { | |
GM_addStyle(` | |
#videoRate { | |
appearance: none; | |
text-align: center; | |
height: 36px; | |
width: 70px; | |
border-radius: 15px; | |
border: 0px solid #fff; | |
padding: 0 8px; | |
outline: 0; | |
letter-spacing: 1px; | |
font-weight: 600; | |
background: rgba(45,45,45,.10); | |
border: 1px solid rgba(255,255,255,.15); | |
box-shadow: 0 2px 3px 0 rgba(0,0,0,.1) inset; | |
text-shadow: 0 1px 2px rgba(0,0,0,.1); | |
-o-transition: all .2s; | |
-moz-transition: all .2s; | |
-webkit-transition: all .2s; | |
-ms-transition: all .2s; | |
} | |
`) | |
'use strict'; | |
window.onload = function() { | |
var bar = document.querySelector(".bpx-player-sending-area"); | |
var input = document.createElement("input"); | |
input.value = 1; | |
input.id = "videoRate"; | |
input.type = "number"; | |
input.onchange = function(e) { | |
if (e.type == "change" && !isNaN(this.value)) { | |
console.log(this.value) | |
if (this.value > 16 || this.value < 0) { | |
this.value = 1; | |
} | |
let video_ = document.querySelector("bwp-video") | |
if(!video_){ | |
video_ = document.querySelector("video") | |
} | |
video_.playbackRate = this.value; | |
} | |
} | |
var sp = document.createElement("span") | |
sp.innerText = "视频速度: (0~16) =>" | |
bar.appendChild(sp) | |
bar.appendChild(input); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment