Przeglądaj źródła

Added support for killing stickies within shadow DOMs

master
achmizs 6 lat temu
rodzic
commit
2ecd4edcb7

+ 11
- 6
src/contentScript.js Wyświetl plik

function killSticky(root) { function killSticky(root) {
// console.log("killSticky"); // console.log("killSticky");
root = root || document.querySelector("body"); root = root || document.querySelector("body");
if (killStickyIfNeeded(root) == false) {
root.querySelectorAll('*').forEach(element => {
killStickyIfNeeded(element)
});
}
if (killStickyIfNeeded(root) == false)
killAllStickiesWithin(root);


// Compensate for full-screen paywalls. // Compensate for full-screen paywalls.
restoreScrollability();
if (root == document.body)
restoreScrollability();
}

function killAllStickiesWithin(root) {
root.querySelectorAll('*').forEach(element => {
if (killStickyIfNeeded(element) == false && element.shadowRoot != null)
killAllStickiesWithin(element.shadowRoot);
});
} }


function killStickyIfNeeded(element) { function killStickyIfNeeded(element) {

+ 1
- 1
src/platform/chrome/manifest.json Wyświetl plik

{ {
"manifest_version": 2, "manifest_version": 2,
"name": "AlwaysKillSticky", "name": "AlwaysKillSticky",
"version": "1.2.9",
"version": "1.3.0",
"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
- 1
src/platform/firefox/manifest.json Wyświetl plik

{ {
"manifest_version": 2, "manifest_version": 2,
"name": "AlwaysKillSticky", "name": "AlwaysKillSticky",
"version": "1.2.9",
"version": "1.3.0",
"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": {

Ładowanie…
Anuluj
Zapisz