Greasy Fork is available in English.

Discussions » Development

Coding for YouTube - How?

§
Posted: 28-04-2023

I'm working with ChatGPT to try to write some code for YouTube. I want to change the content of certain fields, replace certain words with other words. But when I try, the Javascript can't hack it. I'm targetting the right fields. I can actually change them with a button, but I don't want a button. And of course, when I navigate down, and more of the page loads, these new portions don't have the javascript apply to them, and when I scroll back up and earlier portions of the page reload, the script isn't applied to them anymore. How does this crazy thing work?

NotYouMod
§
Posted: 28-04-2023

Nothing crazy, that's called DOM mutations, to obverse them, use MutationObserver. I don't know how exactly your code works, but probably you can also use event declaration, which is safer because there will be less risk of memory leak. That's all I can say, you didn't present any piece of code, so I don't really can help you more.

Post reply

Sign in to post a reply.