Преглед изворни кода

Optimize killSticky to only call getComputedStyle once per element

master
saturn пре 6 година
родитељ
комит
6711ae5729
1 измењених фајлова са 3 додато и 3 уклоњено
  1. 3
    3
      src/contentScript.js

+ 3
- 3
src/contentScript.js Прегледај датотеку

function killSticky(root) { function killSticky(root) {
root = root || document.querySelector("body"); root = root || document.querySelector("body");
root.querySelectorAll('*').forEach(element => { root.querySelectorAll('*').forEach(element => {
if (getComputedStyle(element).position === 'fixed' ||
getComputedStyle(element).position === 'sticky') {
let position = getComputedStyle(element).position;
if (position === 'fixed' || position === 'sticky') {
// uBlock exception. // uBlock exception.
if (element.tagName == "IFRAME" && if (element.tagName == "IFRAME" &&
element.parentElement.tagName == "HTML") element.parentElement.tagName == "HTML")
} }
}); });
} }
initialize();
initialize();

Loading…
Откажи
Сачувај