5

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.

Community
  • 1
  • 1
ljfed
  • 51
  • 3
  • See [Recall Tampermonkey script when page location changes](http://stackoverflow.com/a/32277150) – wOxxOm Jun 30 '16 at 12:13
  • Thanks, that pretty much solves my problem. – ljfed Jul 01 '16 at 01:52
  • Does this answer your question? [Recall Tampermonkey script when page location changes](https://stackoverflow.com/questions/32275387/recall-tampermonkey-script-when-page-location-changes) – double-beep Nov 14 '21 at 14:38

1 Answers1

1

In the post you linked, checkout that you did include:

// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
Chevdor
  • 664
  • 4
  • 12