Basically when I go onto a youtube page tampermonkey says the script is running, but it isn't. After I refresh the page it works fine though.
I have found a few other posts with a similar issue and they used waitForKeyElements. However I don't fully understand how this works and can't manage to make it work myself.
The script i'm making can be found here
I tried surrounding everything with a function
betterYoutubeScrolling()
{
// code
}
and adding
waitForKeyElements ("#movie_player", betterYoutubeScrolling);
to the beginging. After doing this I get following error in the console.
"ReferenceError: waitForKeyElements is not defined"
I can't find any other information about waitForKeyElements or any other method of solving the issue so any help is appreciated.