1
0
Fork 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
1 changed files with 9 additions and 5 deletions

View File

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