Last active
October 19, 2024 09:53
-
-
Save rxliuli/0a7da6f1d748213f6ea7ed3e55a9f73a to your computer and use it in GitHub Desktop.
自动屏蔽 bilibili 登录弹窗
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站(bilibili)自动续播因未登录而暂停的视频 (Bilibili: Continue playing without logging-in) | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description 解决B站(bilibili)因未登录而自动暂停视频并弹出登录窗口的问题 / Solve the problem of Bilibili automatically pausing video and popping up a login window because it is not logged in | |
// @author TheBeacon | |
// @match https://www.bilibili.com/video/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// @license MIT | |
// @downloadURL https://gist.github.com/rxliuli/0a7da6f1d748213f6ea7ed3e55a9f73a/raw/da80f48bfca06da4be4dcd9d33ff21be48342265/index.user.js | |
// @updateURL https://gist.github.com/rxliuli/0a7da6f1d748213f6ea7ed3e55a9f73a/raw/da80f48bfca06da4be4dcd9d33ff21be48342265/index.user.js | |
// @upstream https://greasyfork.org/zh-CN/scripts/462122-b%E7%AB%99-bilibili-%E8%87%AA%E5%8A%A8%E7%BB%AD%E6%92%AD%E5%9B%A0%E6%9C%AA%E7%99%BB%E5%BD%95%E8%80%8C%E6%9A%82%E5%81%9C%E7%9A%84%E8%A7%86%E9%A2%91-bilibili-continue-playing-without-logging-in | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var target = document.querySelector(".bpx-player-row-dm-wrap"); | |
var config = {attributes: true, attributeFilter: ["class"]}; | |
var observer = new MutationObserver(function(motationList, observer) { | |
setTimeout(function(){ | |
const $mask = document.querySelector(".bili-mini-mask") | |
if ($mask) { | |
// console.log("captured!"); | |
// console.log(motationList[0]); | |
$mask.remove(); | |
if (document.querySelector('.bpx-state-paused')) { | |
document.getElementsByClassName("bpx-player-ctrl-btn bpx-player-ctrl-play")[0].click(); | |
} //else { | |
// console.log("but do nothing"); | |
//} | |
observer.takeRecords(); | |
} | |
}, 1000); | |
}); | |
observer.observe(target, config); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment