commit
f5f3e62a28
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Do Not Consent",
|
||||
"version": "4.2.0",
|
||||
"version": "4.3.0",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_appDesc__",
|
||||
"icons": {
|
||||
|
@ -169,40 +169,6 @@ const updateCache = (hostname, state) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function updateState
|
||||
* @description Set an extension state
|
||||
*
|
||||
* @param {string} [tabId]
|
||||
* @param {string} [state]
|
||||
*/
|
||||
|
||||
const updateState = (tabId, state) => {
|
||||
switch (state) {
|
||||
case "loading":
|
||||
chrome.tabs.insertCSS(
|
||||
tabId,
|
||||
{
|
||||
file: "styles/content.css",
|
||||
runAt: "document_start",
|
||||
},
|
||||
() => chrome.runtime.lastError
|
||||
);
|
||||
break;
|
||||
case "ready":
|
||||
chrome.tabs.removeCSS(
|
||||
tabId,
|
||||
{
|
||||
file: "styles/content.css",
|
||||
},
|
||||
() => chrome.runtime.lastError
|
||||
);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Listens to messages
|
||||
*/
|
||||
@ -243,9 +209,6 @@ chrome.runtime.onMessage.addListener((request, sender, responseCallback) => {
|
||||
case "UPDATE_CACHE":
|
||||
updateCache(request.hostname, request.state);
|
||||
break;
|
||||
case "UPDATE_STATE":
|
||||
if (hasPermission) updateState(tabId, request.state);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -22,14 +22,6 @@ const dispatch = chrome.runtime.sendMessage;
|
||||
|
||||
let intervalId = 0;
|
||||
|
||||
/**
|
||||
* @var loading
|
||||
* @description Is extension loading?
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
||||
let loading = true;
|
||||
|
||||
/**
|
||||
* @var selectorsFromCache
|
||||
* @description Array of selectors
|
||||
@ -59,7 +51,6 @@ const fix = () => {
|
||||
if (body) body.style.setProperty("overflow-y", "unset", "important");
|
||||
if (facebook) facebook.style.setProperty("position", "unset", "important");
|
||||
if (html) html.style.setProperty("overflow-y", "unset", "important");
|
||||
if (!loading) dispatch({ state: "ready", type: "UPDATE_STATE" });
|
||||
};
|
||||
|
||||
/**
|
||||
@ -99,10 +90,7 @@ const removeFromCache = () => {
|
||||
if (element) {
|
||||
const tagName = element.tagName.toUpperCase();
|
||||
|
||||
if (!["BODY", "HTML"].includes(tagName)) {
|
||||
element.remove();
|
||||
loading = false;
|
||||
}
|
||||
if (!["BODY", "HTML"].includes(tagName)) element.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -122,7 +110,6 @@ const removeFromNetwork = () => {
|
||||
|
||||
if (!["BODY", "HTML"].includes(tagName)) {
|
||||
element.remove();
|
||||
loading = false;
|
||||
dispatch({
|
||||
hostname: document.location.hostname,
|
||||
state: { matches: [selector] },
|
||||
@ -139,10 +126,6 @@ const removeFromNetwork = () => {
|
||||
*/
|
||||
|
||||
const runTasks = () => {
|
||||
if (attempts >= 5 || selectorsFromCache.length === 0) {
|
||||
loading = false;
|
||||
}
|
||||
|
||||
if (attempts <= 20) {
|
||||
fix();
|
||||
removeFromCache();
|
||||
@ -166,7 +149,6 @@ dispatch(
|
||||
dispatch({ type: "ENABLE_POPUP" });
|
||||
|
||||
if (enabled) {
|
||||
dispatch({ state: "loading", type: "UPDATE_STATE" });
|
||||
selectorsFromCache = matches;
|
||||
dispatch({ type: "ENABLE_ICON" });
|
||||
dispatch({ type: "GET_LIST" }, null, ({ selectors }) => {
|
||||
|
@ -1,9 +0,0 @@
|
||||
body {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html {
|
||||
background-color: #424242;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user