Skip to content

Need help with creating a scriptlet, again #2514

Closed Answered by partingscientist
partingscientist asked this question in Q&A
Discussion options

You must be logged in to vote

I think I figured it out.

I realised that uBO probably want to inject scriptlets as soon as possible to a given page. This probably means that when the above scriptlet is executed, document.querySelector(".chat-input__buttons-container") probably returns null because the DOM node has not been loaded yet.

To fix this, I first observe the document on whether the .chat-input__buttons-container node that I'm looking for exists. Then, I disconnect that observer and reattach a new one on the node I'm targeting.

While exploring this, I also noticed that scriptlets seem to cannot have a blank line in it. I failed to find that being documented anywhere so might as well let any future reader know.

T…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@uBlock-user
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@uBlock-user
Comment options

@mapx-
Comment options

mapx- Mar 2, 2023
Collaborator

Answer selected by partingscientist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants