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
|
/* 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
|
all elements whose ‘position’ CSS property has a computed value of either
|
||||||
'sticky' or 'fixed', and removes those elements.
|
‘sticky’ or ‘fixed’, and removes those elements.
|
||||||
*/
|
*/
|
||||||
function killSticky(root) {
|
function killSticky(root) {
|
||||||
root = root || document.querySelector("body");
|
root = root || document.querySelector("body");
|
||||||
root.querySelectorAll('*').forEach(element => {
|
if (killStickyIfNeeded(root) == false) {
|
||||||
let position = getComputedStyle(element).position;
|
root.querySelectorAll('*').forEach(element => {
|
||||||
if (position === 'fixed' || position === 'sticky') {
|
killStickyIfNeeded(element)
|
||||||
// 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 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Compensate for full-screen paywalls.
|
// Compensate for full-screen paywalls.
|
||||||
restoreScrollability();
|
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
|
/* Full-screen paywalls not only bring up sticky elements, they also make
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "AlwaysKillSticky",
|
"name": "AlwaysKillSticky",
|
||||||
"version": "1.2.7",
|
"version": "1.2.8",
|
||||||
"description": "Get rid of sticky elements on websites - permanently!",
|
"description": "Get rid of sticky elements on websites - permanently!",
|
||||||
"author": "Said Achmiz",
|
"author": "Said Achmiz",
|
||||||
"homepage_url": "https://git.sr.ht/~achmizs/AlwaysKillSticky.git",
|
"homepage_url": "https://git.sr.ht/~achmizs/AlwaysKillSticky.git",
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "AlwaysKillSticky",
|
"name": "AlwaysKillSticky",
|
||||||
"version": "1.2.7",
|
"version": "1.2.8",
|
||||||
"description": "Get rid of sticky elements on websites - permanently!",
|
"description": "Get rid of sticky elements on websites - permanently!",
|
||||||
"author": "Said Achmiz",
|
"author": "Said Achmiz",
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user