Bilibili asks for advice on on-screen comments and widescreen scripts.

I want to get a script of bilibili to remove the on-screen and wide-screen screen, and click something like the following

// ==UserScript==
// @name         BAlt
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       You
// @match        *://*.bilibili.com/*
// ==/UserScript==

setTimeout(function(){
  document.querySelector(".bilibili-player-video-btn-widescreen").click();
  document.querySelector(".bui-checkbox").click();
},1000);

but when I put it in the monkey, it only works on the wide screen, but it doesn"t work on the barrage, but I can test it on the console of the webpage. Why?

Aug.01,2021

when your code is executed, there is no tag for on-screen comment, so it doesn't work. You just have to wait for the page to load or the timer delays to execute your code


the timer keeps counting until it arrives

let task=setInterval(()=>{
    if(elem.exist()){
        task.cancel()
        elem.click()
    }
},200)

this is pseudo code, so you can't use it directly. You don't bother to open IDE. You can understand the meaning

.
Menu