//==UserScript==
//@ name test
//@ namespace http://tampermonkey.net/
//@ version 0.1
//@ the description the try to take over the world!
//@ the author You
//@ match https://live.bilibili.com/*
//@ grant none
//==/UserScript==
(function () {
'use strict;
; (function func () {
Const injectAnchor=document. GetElementsByClassName (' right action ') [0]
The console. The log (injectAnchor)
If (injectAnchor) {
The console. The log (' find injectAnchor ')
} else {
RequestAnimationFrame ((function () {
Func ()
}))
}
}) ();
}) ();
Is to use the requestAnimationFrame find - action containing the right element of this class, find stopped,
This code directly put the console to perform is no problem (chrome),
But on the tampermonkey will be infinite, find the class also can't stop, the diagram below:
You can see the code has entered the if, but behind or to perform in the else requestAnimationFrame,
Script matching is b to stand any studio and solving is this why?
CodePudding user response:
Try adding a return falseCodePudding user response: