Observe only if there are any results
This commit is contained in:
parent
a9d7a3bcc0
commit
373e56eb68
@ -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) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(target, {
|
|
||||||
subtree: true,
|
var target = document.getElementById('resultsOverview');
|
||||||
childList: true
|
|
||||||
});
|
if(typeof target !== 'undefined') {
|
||||||
|
observer.observe(target, {
|
||||||
|
subtree: true,
|
||||||
|
childList: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user