Waiting for head to load before inserting banner
parent
aaefcbd468
commit
221b18621c
12
content.js
12
content.js
|
@ -394,8 +394,18 @@ function main(mutations = null, observer = null) {
|
||||||
} else {
|
} else {
|
||||||
newURL = 'https://' + site["destination_base_url"];
|
newURL = 'https://' + site["destination_base_url"];
|
||||||
}
|
}
|
||||||
// Notify that another wiki is available
|
// When head elem is loaded, notify that another wiki is available
|
||||||
|
const docObserver = new MutationObserver(function (mutations, mutationInstance) {
|
||||||
|
const headElement = document.querySelector('head');
|
||||||
|
if (headElement) {
|
||||||
displayRedirectBanner(newURL, site['id'], site['destination'], storage);
|
displayRedirectBanner(newURL, site['id'], site['destination'], storage);
|
||||||
|
mutationInstance.disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
docObserver.observe(document, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue