Fixed bug with observed changes to specified element; version to 1.2.8
This commit is contained in:
parent
deb03b4cdc
commit
a56cb18a89
@ -54,32 +54,41 @@ function checkForShouldKillSticky(result) {
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* This is the code that actually does the sticky killing! It simply selects
|
||||
all elements whose 'position' CSS property has a computed value of either
|
||||
'sticky' or 'fixed', and removes those elements.
|
||||
all elements whose ‘position’ CSS property has a computed value of either
|
||||
‘sticky’ or ‘fixed’, and removes those elements.
|
||||
*/
|
||||
function killSticky(root) {
|
||||
root = root || document.querySelector("body");
|
||||
root.querySelectorAll('*').forEach(element => {
|
||||
let position = getComputedStyle(element).position;
|
||||
if (position === 'fixed' || position === 'sticky') {
|
||||
// uBlock exception.
|
||||
if (element.tagName == "IFRAME" &&
|
||||
element.parentElement.tagName == "HTML")
|
||||
return;
|
||||
|
||||
// Kill the sticky.
|
||||
console.log("Killing sticky!");
|
||||
element.remove();
|
||||
|
||||
// Increment the stickies killed count, and update icon badge.
|
||||
AKS.stickiesKilled++;
|
||||
chrome.runtime.sendMessage({ newBadgeText: "" + AKS.stickiesKilled });
|
||||
}
|
||||
});
|
||||
if (killStickyIfNeeded(root) == false) {
|
||||
root.querySelectorAll('*').forEach(element => {
|
||||
killStickyIfNeeded(element)
|
||||
});
|
||||
}
|
||||
|
||||
// Compensate for full-screen paywalls.
|
||||
restoreScrollability();
|
||||
}
|
||||
function killStickyIfNeeded(element) {
|
||||
let position = getComputedStyle(element).position;
|
||||
if (position === 'fixed' || position === 'sticky') {
|
||||
// uBlock exception.
|
||||
if (element.tagName == "IFRAME" &&
|
||||
element.parentElement.tagName == "HTML")
|
||||
return;
|
||||
|
||||
// Kill the sticky.
|
||||
console.log("Killing sticky!");
|
||||
element.remove();
|
||||
|
||||
// Increment the stickies killed count, and update icon badge.
|
||||
AKS.stickiesKilled++;
|
||||
chrome.runtime.sendMessage({ newBadgeText: "" + AKS.stickiesKilled });
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
/* Full-screen paywalls not only bring up sticky elements, they also make
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "AlwaysKillSticky",
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8",
|
||||
"description": "Get rid of sticky elements on websites - permanently!",
|
||||
"author": "Said Achmiz",
|
||||
"homepage_url": "https://git.sr.ht/~achmizs/AlwaysKillSticky.git",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "AlwaysKillSticky",
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8",
|
||||
"description": "Get rid of sticky elements on websites - permanently!",
|
||||
"author": "Said Achmiz",
|
||||
"browser_specific_settings": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user