油猴脚本 调B站播放速度
// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match *bilibili* // @include *bilibili* // @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js // @grant GM.getValue // @grant GM.setValue // @grant GM.listValues // @grant GM.deleteValue // @grant GM.openInTab // @grant GM.registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_addStyle // @run-at document-idle // @grant unsafeWindow // ==/UserScript== function sleep(time) { console.log(`sleep被调用`,time) return new Promise((resolve) => setTimeout(resolve, time)); } (function() { 'use strict'; GM_addStyle(' .h-ol {position: absolute;top: 100px;left: 10px;z-index:9999 }'); let apiList = '<ul class="h-ol" id="my_wsh" ></ul>'; $(document.body).append(apiList); $('.h-ol').append(`<li> <input type="text" Style="width:24px" id="myratevalid" value="1"> </li>`); $('.h-ol').append(`<li><button type="button" id="myrate000">speed</button> </li>`); window.onload = function () { //方法内容 let mymap = []; function fds(node) { if (node.nodeType === 1) { // node.id = "id" + map_num.toLocaleString(); //给节点设置ID if (! mymap.includes(node.nodeName.toLocaleString(),0) ) { mymap.push(node.nodeName.toLocaleString()) } } //获取该元素节点的所有子节点 var children = node.childNodes; for (var i = 0; i < children.length; i++) { //递归调用 fds(children[i]); } } fds(document) // 用法 sleep(2500).then(() => { // 这里写sleep之后需要去做的事情 console.log(mymap) for (let j = 0; j < mymap.length; j++) { //递归调用 if(mymap[j].indexOf('VIDEO',0)!=-1){ console.log(`by_wsh看这里 myv=document.getElementsByTagName("`+mymap[j]+`")`) let myv_0=mymap[j] console.log(myv_0) // myv_0=document.getElementsByTagName(mymap[j])[0] document.getElementById("myrate000").addEventListener("click", function(){ console.log(`触发按钮事件`) let speed0=parseFloat(document.getElementById("myratevalid").value); document.getElementsByTagName(myv_0)[0].playbackRate=speed0 }); } } }) var e var box = document.getElementById("my_wsh"); //获取元素 var x, y; //鼠标相对与div左边,上边的偏移 var isDrop = false; //移动状态的判断鼠标按下才能移动 box.onmousedown = function (e) { e = e || window.event; //要用event这个对象来获取鼠标的位置 x = e.clientX - box.offsetLeft; y = e.clientY - box.offsetTop; isDrop = true; //设为true表示可以移动 } document.onmousemove = function (e) { //是否为可移动状态 if (isDrop) { e = e || window.event; var moveX = e.clientX - x; //得到距离左边移动距离 var moveY = e.clientY - y; //得到距离上边移动距离 //可移动最大距离 var maxX = document.documentElement.clientWidth - box.offsetWidth; var maxY = document.documentElement.clientHeight - box.offsetHeight; //范围限定 当移动的距离最小时取最大 移动的距离最大时取最小 //范围限定方法一 /*if(moveX < 0) { moveX = 0 } else if(moveX > maxX) { moveX = maxX; } if(moveY < 0) { moveY = 0; } else if(moveY > maxY) { moveY = maxY; } */ //范围限定方法二 moveX = Math.min(maxX, Math.max(0, moveX)); moveY = Math.min(maxY, Math.max(0, moveY)); box.style.left = moveX + "px"; box.style.top = moveY + "px"; } else { return; } } document.onmouseup = function () { isDrop = false; //设置为false不可移动 } } })();
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!