Fixed bug with load event timing
This commit is contained in:
parent
ad308ab270
commit
34709c9eab
@ -70,6 +70,7 @@ function startConstantVigilance() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("Commencing vigilance for stickies!");
|
||||||
observer.observe(document.querySelector("html"), {
|
observer.observe(document.querySelector("html"), {
|
||||||
attributes: true,
|
attributes: true,
|
||||||
childList: true,
|
childList: true,
|
||||||
@ -82,13 +83,16 @@ function startConstantVigilance() {
|
|||||||
/******************/
|
/******************/
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ],
|
chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ], (result) => {
|
||||||
(result) => {
|
|
||||||
let shouldKillSticky = checkForShouldKillSticky(result);
|
let shouldKillSticky = checkForShouldKillSticky(result);
|
||||||
updateIcon(shouldKillSticky);
|
updateIcon(shouldKillSticky);
|
||||||
if (shouldKillSticky) {
|
if (shouldKillSticky) {
|
||||||
startConstantVigilance();
|
startConstantVigilance();
|
||||||
window.onload = () => {
|
if (document.readyState == "loading") {
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
killSticky();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
killSticky();
|
killSticky();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user