Disabled debugging code

This commit is contained in:
achmizs 2019-12-18 02:55:19 -05:00
parent b9efe86d0b
commit 68884dcd03

View File

@ -17,7 +17,7 @@
zero exclusion matters match the URL of the current page) zero exclusion matters match the URL of the current page)
*/ */
function checkForShouldKillSticky(result) { function checkForShouldKillSticky(result) {
console.log("checkForShouldKillSticky"); // console.log("checkForShouldKillSticky");
var shouldKillSticky = false; var shouldKillSticky = false;
/* If whitelist mode is active, then the matching patterns list is treated /* If whitelist mode is active, then the matching patterns list is treated
@ -59,7 +59,7 @@ function checkForShouldKillSticky(result) {
sticky or fixed, and removes those elements. sticky or fixed, and removes those elements.
*/ */
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) { if (killStickyIfNeeded(root) == false) {
root.querySelectorAll('*').forEach(element => { root.querySelectorAll('*').forEach(element => {
@ -72,7 +72,7 @@ function killSticky(root) {
} }
function killStickyIfNeeded(element) { function killStickyIfNeeded(element) {
console.log("killStickyIfNeeded"); // console.log("killStickyIfNeeded");
var position = getComputedStyle(element).position; var position = getComputedStyle(element).position;
if (position === 'fixed' || position === 'sticky') { if (position === 'fixed' || position === 'sticky') {
// uBlock exception. // uBlock exception.
@ -122,7 +122,7 @@ function killStickyIfNeeded(element) {
} }
function killStickyPseudoElement(element, before) { function killStickyPseudoElement(element, before) {
console.log("killStickyPseudoElement"); // console.log("killStickyPseudoElement");
if (!AKS.pseudoElementKillingStyleBlock) { if (!AKS.pseudoElementKillingStyleBlock) {
document.querySelector("head").insertAdjacentHTML("beforeend", "<style id='always-kill-sticky'></style>"); document.querySelector("head").insertAdjacentHTML("beforeend", "<style id='always-kill-sticky'></style>");
AKS.pseudoElementKillingStyleBlock = document.querySelector("style#always-kill-sticky"); AKS.pseudoElementKillingStyleBlock = document.querySelector("style#always-kill-sticky");
@ -137,7 +137,7 @@ function killStickyPseudoElement(element, before) {
} }
function incrementKilledStickiesCount() { function incrementKilledStickiesCount() {
console.log("incrementKilledStickiesCount"); // console.log("incrementKilledStickiesCount");
AKS.stickiesKilled++; AKS.stickiesKilled++;
chrome.runtime.sendMessage({ newBadgeText: "" + AKS.stickiesKilled }); chrome.runtime.sendMessage({ newBadgeText: "" + AKS.stickiesKilled });
} }
@ -147,7 +147,7 @@ function incrementKilledStickiesCount() {
the page un-scrollable. This ensures that the page remains scrollable. the page un-scrollable. This ensures that the page remains scrollable.
*/ */
function restoreScrollability() { function restoreScrollability() {
console.log("restoreScrollability"); // console.log("restoreScrollability");
document.querySelectorAll("html, body").forEach(container => { document.querySelectorAll("html, body").forEach(container => {
container.style.setProperty("overflow-y", "auto", "important"); container.style.setProperty("overflow-y", "auto", "important");
}); });
@ -160,7 +160,7 @@ function restoreScrollability() {
necessary, killing any newly-formed stickies. necessary, killing any newly-formed stickies.
*/ */
function startConstantVigilance() { function startConstantVigilance() {
console.log("startConstantVigilance"); // console.log("startConstantVigilance");
var observer = new MutationObserver((mutationsList, observer) => { var observer = new MutationObserver((mutationsList, observer) => {
window.requestIdleCallback(() => { window.requestIdleCallback(() => {
for (var mutation of mutationsList) { for (var mutation of mutationsList) {
@ -181,7 +181,7 @@ function startConstantVigilance() {
/* Immediately kill all stickies, then commence constant vigilance. /* Immediately kill all stickies, then commence constant vigilance.
*/ */
function beginKillingStickies() { function beginKillingStickies() {
console.log("beginKillingStickies"); // console.log("beginKillingStickies");
if (!window.AKS) window.AKS = { stickiesKilled: 0 }; if (!window.AKS) window.AKS = { stickiesKilled: 0 };
window.requestIdleCallback(() => { window.requestIdleCallback(() => {
@ -195,7 +195,7 @@ function beginKillingStickies() {
/******************/ /******************/
function initialize() { function initialize() {
console.log("initialize"); // console.log("initialize");
chrome.storage.local.get([ "matchingPatterns", "exclusionPatterns", "mode" ], (result) => { chrome.storage.local.get([ "matchingPatterns", "exclusionPatterns", "mode" ], (result) => {
let shouldKillSticky = checkForShouldKillSticky(result); let shouldKillSticky = checkForShouldKillSticky(result);
updateIcon(shouldKillSticky); updateIcon(shouldKillSticky);