window.onload = () => { chrome.storage.sync.get("patterns", (result) => { killStickyIfMatch(result.patterns); }); }; function killStickyIfMatch(patterns) { if (typeof patterns == "undefined") return; patterns = patterns.split("\n"); var killSticky = false; for (let pattern of patterns) { if (location.href.match(new RegExp(pattern))) { killSticky = true; break; } } if (!killSticky) return; console.log("Killing all stickies!"); document.querySelectorAll('body *').forEach(element => { if (getComputedStyle(element).position === 'fixed' || getComputedStyle(element).position === 'sticky') { element.remove(); } }); }