Compare commits
3 Commits
2ecd4edcb7
...
c98ca80bbf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c98ca80bbf | ||
|
|
0b3b0a2c58 | ||
|
|
36951432cf |
@ -166,20 +166,30 @@ function restoreScrollability() {
|
|||||||
*/
|
*/
|
||||||
function startConstantVigilance() {
|
function startConstantVigilance() {
|
||||||
// console.log("startConstantVigilance");
|
// console.log("startConstantVigilance");
|
||||||
var observer = new MutationObserver((mutationsList, observer) => {
|
var observer;
|
||||||
window.requestIdleCallback(() => {
|
var starter = function() {
|
||||||
for (var mutation of mutationsList) {
|
observer.observe(document.querySelector("html"), {
|
||||||
killSticky(mutation.target);
|
attributes: true,
|
||||||
}
|
childList: true,
|
||||||
|
subtree: true
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
observer = new MutationObserver((mutationsList, observer) => {
|
||||||
|
// Workaround for Firefox performance bug. Firefox does not properly
|
||||||
|
// coalesce mutations into the mutationsList, instead calling the
|
||||||
|
// callback potentially thousands of times. Therefore we must
|
||||||
|
// disconnect the observer, wait for the main thread to become idle,
|
||||||
|
// and then restart it.
|
||||||
|
observer.disconnect();
|
||||||
|
window.requestIdleCallback(() => {
|
||||||
|
killSticky();
|
||||||
|
starter();
|
||||||
|
}, {timeout: 1000});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Commencing vigilance for stickies!");
|
console.log("Commencing vigilance for stickies!");
|
||||||
observer.observe(document.querySelector("html"), {
|
starter();
|
||||||
attributes: true,
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||||
@ -192,7 +202,7 @@ function beginKillingStickies() {
|
|||||||
window.requestIdleCallback(() => {
|
window.requestIdleCallback(() => {
|
||||||
killSticky();
|
killSticky();
|
||||||
startConstantVigilance();
|
startConstantVigilance();
|
||||||
});
|
}, {timeout: 1000});
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************/
|
/******************/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "AlwaysKillSticky",
|
"name": "AlwaysKillSticky",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"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.3.0",
|
"version": "1.3.1",
|
||||||
"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