Skip to content

Instantly share code, notes, and snippets.

@Jack-Works

Jack-Works/bilibili.js

Last active Oct 27, 2019
Embed
What would you like to do?
bilibili speed 3.0x
// ==UserScript==
// @name Bilibili 调速度
// @namespace http://tampermonkey.net/
// @version 0.4
// @description try to take over the world!
// @author Jack Works
// @match https://www.bilibili.com/video/*
// @grant none
// @require https://unpkg.com/@holoflows/kit@0.6.0
// ==/UserScript==
const { LiveSelector, MutationObserverWatcher } = HoloflowsKit;
const watch = new MutationObserverWatcher(new LiveSelector().querySelector('[data-rate="2"]')).startWatch({
subtree: true,
childList: true,
})
watch.firstDOMProxy.after.innerText = '3.0'
watch.firstDOMProxy.after.setAttribute('data-rate', '3')
watch.firstDOMProxy.after.addEventListener('click', (e) => {
e.stopPropagation()
e.stopImmediatePropagation()
document.querySelector('video').playbackRate = 3.0
}, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment