1
0

Observe only if there are any results

This commit is contained in:
clerie 2020-09-16 13:03:05 +02:00
parent a9d7a3bcc0
commit 373e56eb68

View File

@ -7,7 +7,6 @@ function getMediaURL(path) {
return chrome.runtime.getURL(path) || browser.runtime.getURL(path); return chrome.runtime.getURL(path) || browser.runtime.getURL(path);
} }
var target = document.getElementById('resultsOverview');
var observer = new MutationObserver((mutations, observer) => { var observer = new MutationObserver((mutations, observer) => {
mutations.forEach((mutation) => { mutations.forEach((mutation) => {
@ -31,7 +30,12 @@ var observer = new MutationObserver((mutations, observer) => {
}); });
}); });
var target = document.getElementById('resultsOverview');
if(typeof target !== 'undefined') {
observer.observe(target, { observer.observe(target, {
subtree: true, subtree: true,
childList: true childList: true
}); });
}