|
function observeApp() { |
|
debug(`Observing ${appName}...`); |
|
appObserver = new MutationObserver((mutations, observer) => { |
|
overrideVideoPause(); |
|
}); |
|
|
|
appObserver.observe(document.querySelector(appName), { |
|
childList: true, |
|
subtree: true |
|
}); |
|
} |
If using this extension with a bad loading time, you start to get errors that the "Node" is not defined in appObserver.observe.
Should probably check if it has loaded first, maybe something like this:
function setup() {
if (document.querySelector(appName)) {
observeApp();
return;
}
const observer = new MutationObserver(() => {
if (document.querySelector(appName)) {
observer.disconnect();
observeApp();
}
})
observer.observe(document.documentElement, { childList: true, subtree: true });
}
YoutubeNonStop/autoconfirm.js
Lines 91 to 101 in 7b6b97b
If using this extension with a bad loading time, you start to get errors that the "Node" is not defined in
appObserver.observe.Should probably check if it has loaded first, maybe something like this: