Merge pull request #13 from wanhose/4.3.0

4.3.0
This commit is contained in:
wanhose 2021-07-21 12:02:18 +02:00 committed by GitHub
commit f5f3e62a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 66 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Do Not Consent", "name": "Do Not Consent",
"version": "4.2.0", "version": "4.3.0",
"default_locale": "en", "default_locale": "en",
"description": "__MSG_appDesc__", "description": "__MSG_appDesc__",
"icons": { "icons": {

View File

@ -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 * @description Listens to messages
*/ */
@ -243,9 +209,6 @@ chrome.runtime.onMessage.addListener((request, sender, responseCallback) => {
case "UPDATE_CACHE": case "UPDATE_CACHE":
updateCache(request.hostname, request.state); updateCache(request.hostname, request.state);
break; break;
case "UPDATE_STATE":
if (hasPermission) updateState(tabId, request.state);
break;
default: default:
break; break;
} }

View File

@ -22,14 +22,6 @@ const dispatch = chrome.runtime.sendMessage;
let intervalId = 0; let intervalId = 0;
/**
* @var loading
* @description Is extension loading?
* @type {boolean}
*/
let loading = true;
/** /**
* @var selectorsFromCache * @var selectorsFromCache
* @description Array of selectors * @description Array of selectors
@ -59,7 +51,6 @@ const fix = () => {
if (body) body.style.setProperty("overflow-y", "unset", "important"); if (body) body.style.setProperty("overflow-y", "unset", "important");
if (facebook) facebook.style.setProperty("position", "unset", "important"); if (facebook) facebook.style.setProperty("position", "unset", "important");
if (html) html.style.setProperty("overflow-y", "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) { if (element) {
const tagName = element.tagName.toUpperCase(); const tagName = element.tagName.toUpperCase();
if (!["BODY", "HTML"].includes(tagName)) { if (!["BODY", "HTML"].includes(tagName)) element.remove();
element.remove();
loading = false;
}
} }
} }
}; };
@ -122,7 +110,6 @@ const removeFromNetwork = () => {
if (!["BODY", "HTML"].includes(tagName)) { if (!["BODY", "HTML"].includes(tagName)) {
element.remove(); element.remove();
loading = false;
dispatch({ dispatch({
hostname: document.location.hostname, hostname: document.location.hostname,
state: { matches: [selector] }, state: { matches: [selector] },
@ -139,10 +126,6 @@ const removeFromNetwork = () => {
*/ */
const runTasks = () => { const runTasks = () => {
if (attempts >= 5 || selectorsFromCache.length === 0) {
loading = false;
}
if (attempts <= 20) { if (attempts <= 20) {
fix(); fix();
removeFromCache(); removeFromCache();
@ -166,7 +149,6 @@ dispatch(
dispatch({ type: "ENABLE_POPUP" }); dispatch({ type: "ENABLE_POPUP" });
if (enabled) { if (enabled) {
dispatch({ state: "loading", type: "UPDATE_STATE" });
selectorsFromCache = matches; selectorsFromCache = matches;
dispatch({ type: "ENABLE_ICON" }); dispatch({ type: "ENABLE_ICON" });
dispatch({ type: "GET_LIST" }, null, ({ selectors }) => { dispatch({ type: "GET_LIST" }, null, ({ selectors }) => {

View File

@ -1,9 +0,0 @@
body {
opacity: 0;
}
@media (prefers-color-scheme: dark) {
html {
background-color: #424242;
}
}