javascript - How to get grease monkey to run on Youtube link changes? -
it's first time using grease monkey, , i'm novice @ javascript, have simple code delete suggested videos on right-hand side of youtube, find can distract me work:
var elem = document.getelementbyid('watch-related'); elem.parentnode.removechild(elem);
i've tried using addeventlistener()
; while
loop settimeout()
; , i've tried setinterval()
. none worked. all, including plain code, work if refresh page or arrive @ link external source, if arrive @ video youtube page doesn't.
i think has way youtube loads pages, haven't been able find workarounds. ideas?
edit: found this, has info on topic, doesn't work.
option 1:
install ublock origin or adblock plus, , add custom filter: youtube.com###watch-related
.
option 2 (in case have use greasemonkey):
// ==userscript== // @name youtube suggested video hider // @include https://www.youtube.com/watch?* // @grant gm_addstyle // ==/userscript== gm_addstyle('#watch-related { display: none; }')