// ==UserScript== // @name 哔哩哔哩bilibili默认关闭弹幕 // @description Bilibili html5播放器默认关闭弹幕 // @author cngege // @version 2020.6.20.a // @namespace cngege // @icon https://www.bilibili.com/favicon.ico // @match *://*.bilibili.com/video/* // @match *://*.bilibili.com/watchlater/* // @match *://*.bilibili.com/bangumi/play/* // @require https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { let url = geturl(); let isgo = true; let Const = 0; let DebugLog = false; go(); setTimeout(goto,3000); function go(){ Const++; //判断弹幕开关是否是打开的 并关闭 if($(".bilibili-player-video-danmaku-switch .bui-switch-dot").css("left") == "30px"){ //向弹幕开关发送点击消息 $('.bui-switch-input').click(); if(DebugLog){console.log("向弹幕开关发送点击消息")} } if($(".bilibili-player-video-danmaku-switch .bui-switch-dot").css("left") == "2px"){ isgo = false; if(DebugLog){console.log("检测到弹幕开关关闭");} return; } if(Const>30){isgo = false;return;} setTimeout(go,300); } function goto(){ if(!isgo && url!=geturl()){ if(url!=geturl()){ Const = 0; } url=geturl(); isgo = true; go(); } setTimeout(goto,3000); } function geturl(){ return window.location.href; } })();