commit
e95987f6a9
@ -603,7 +603,6 @@ div[data-is-cookieinfo]
|
|||||||
#site-cookie-policy
|
#site-cookie-policy
|
||||||
#privacy_bandeau
|
#privacy_bandeau
|
||||||
#AdBlockerInfo
|
#AdBlockerInfo
|
||||||
.fbar
|
|
||||||
#cookie--disclaimer
|
#cookie--disclaimer
|
||||||
#cookieNonsense
|
#cookieNonsense
|
||||||
#cookie-confirm-box
|
#cookie-confirm-box
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Do Not Consent",
|
"name": "Do Not Consent",
|
||||||
"version": "4.0.2",
|
"version": "4.0.3",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_appDesc__",
|
"description": "__MSG_appDesc__",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
@ -79,7 +79,6 @@ const enablePopup = (tabId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function getCache
|
* @function getCache
|
||||||
* @description Retrieves cache state
|
* @description Retrieves cache state
|
||||||
*
|
*
|
||||||
@ -88,7 +87,7 @@ const enablePopup = (tabId) => {
|
|||||||
* @returns {Promise<{ enabled: boolean, matches: string[] }>} Cache state
|
* @returns {Promise<{ enabled: boolean, matches: string[] }>} Cache state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const getCache = async (hostname, responseCallback) => {
|
const getCache = (hostname, responseCallback) => {
|
||||||
chrome.storage.local.get(null, (store) => {
|
chrome.storage.local.get(null, (store) => {
|
||||||
try {
|
try {
|
||||||
const cache = store[hostname];
|
const cache = store[hostname];
|
||||||
@ -104,7 +103,6 @@ const getCache = async (hostname, responseCallback) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function getTab
|
* @function getTab
|
||||||
* @description Retrieves current tab information
|
* @description Retrieves current tab information
|
||||||
*
|
*
|
||||||
@ -146,7 +144,6 @@ const getList = async (responseCallback) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function updateCache
|
* @function updateCache
|
||||||
* @description Update cache state
|
* @description Update cache state
|
||||||
*
|
*
|
||||||
@ -154,7 +151,7 @@ const getList = async (responseCallback) => {
|
|||||||
* @param {object} [state]
|
* @param {object} [state]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const updateCache = async (hostname, state) => {
|
const updateCache = (hostname, state) => {
|
||||||
chrome.storage.local.get(null, (cache) => {
|
chrome.storage.local.get(null, (cache) => {
|
||||||
const current = cache[hostname];
|
const current = cache[hostname];
|
||||||
|
|
||||||
|
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
let attempts = 1;
|
let attempts = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant dispatch
|
||||||
|
* @description Shortcut to send messages to background script
|
||||||
|
* @type {void}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const dispatch = chrome.runtime.sendMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var intervalId
|
* @var intervalId
|
||||||
* @description Task interval identifier
|
* @description Task interval identifier
|
||||||
@ -46,7 +54,7 @@ let selectorsFromNetwork = [];
|
|||||||
const fix = () => {
|
const fix = () => {
|
||||||
const html = document.documentElement;
|
const html = document.documentElement;
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
const facebook = document.getElementsByClassName("._31e")[0];
|
const facebook = document.getElementsByClassName("_31e")[0];
|
||||||
|
|
||||||
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");
|
||||||
@ -116,7 +124,7 @@ const removeFromNetwork = () => {
|
|||||||
if (!["BODY", "HTML"].includes(tagName)) {
|
if (!["BODY", "HTML"].includes(tagName)) {
|
||||||
element.remove();
|
element.remove();
|
||||||
loading = false;
|
loading = false;
|
||||||
chrome.runtime.sendMessage({
|
dispatch({
|
||||||
hostname: document.location.hostname,
|
hostname: document.location.hostname,
|
||||||
state: { matches: [selector] },
|
state: { matches: [selector] },
|
||||||
type: "UPDATE_CACHE",
|
type: "UPDATE_CACHE",
|
||||||
@ -152,25 +160,23 @@ const runTasks = () => {
|
|||||||
* @description Setup extension context
|
* @description Setup extension context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
chrome.runtime.sendMessage(
|
dispatch(
|
||||||
{ hostname: document.location.hostname, type: "GET_CACHE" },
|
{ hostname: document.location.hostname, type: "GET_CACHE" },
|
||||||
null,
|
null,
|
||||||
async ({ enabled, matches }) => {
|
async ({ enabled, matches }) => {
|
||||||
chrome.runtime.sendMessage({ type: "ENABLE_POPUP" });
|
dispatch({ type: "ENABLE_POPUP" });
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
selectorsFromCache = matches;
|
selectorsFromCache = matches;
|
||||||
chrome.runtime.sendMessage({ type: "ENABLE_ICON" });
|
dispatch({ type: "ENABLE_ICON" });
|
||||||
chrome.runtime.sendMessage(
|
dispatch({ type: "GET_LIST" }, null, async ({ selectors }) => {
|
||||||
{ type: "GET_LIST" },
|
selectorsFromNetwork = selectors;
|
||||||
null,
|
intervalId = setInterval(runTasks, 500);
|
||||||
async ({ selectors }) => {
|
});
|
||||||
selectorsFromNetwork = selectors;
|
|
||||||
intervalId = setInterval(runTasks, 500);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.style.setProperty("opacity", "1", "important");
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
document.body.style.setProperty("opacity", "1", "important");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,14 @@
|
|||||||
const chromeUrl =
|
const chromeUrl =
|
||||||
"https://chrome.google.com/webstore/detail/do-not-consent/djcbfpkdhdkaflcigibkbpboflaplabg";
|
"https://chrome.google.com/webstore/detail/do-not-consent/djcbfpkdhdkaflcigibkbpboflaplabg";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant dispatch
|
||||||
|
* @description Shortcut to send messages to background script
|
||||||
|
* @type {void}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const dispatch = chrome.runtime.sendMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constant firefoxUrl
|
* @constant firefoxUrl
|
||||||
* @description Firefox Add-ons link
|
* @description Firefox Add-ons link
|
||||||
@ -25,43 +33,37 @@ const firefoxUrl =
|
|||||||
const isChromium = chrome.runtime.getURL("").startsWith("chrome-extension://");
|
const isChromium = chrome.runtime.getURL("").startsWith("chrome-extension://");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function handlePowerChange
|
* @function handlePowerChange
|
||||||
* @description Disables or enables extension on current page
|
* @description Disables or enables extension on current page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const handlePowerChange = async () => {
|
const handlePowerChange = () => {
|
||||||
chrome.runtime.sendMessage({ type: "GET_TAB" }, null, ({ hostname, id }) => {
|
dispatch({ type: "GET_TAB" }, null, ({ hostname, id }) => {
|
||||||
chrome.runtime.sendMessage(
|
dispatch({ hostname, type: "GET_CACHE" }, null, ({ enabled }) => {
|
||||||
{ hostname, type: "GET_CACHE" },
|
const power = document.getElementById("power");
|
||||||
null,
|
|
||||||
({ enabled }) => {
|
|
||||||
const power = document.getElementById("power");
|
|
||||||
|
|
||||||
chrome.runtime.sendMessage({
|
dispatch({
|
||||||
hostname,
|
hostname,
|
||||||
state: { enabled: !enabled },
|
state: { enabled: !enabled },
|
||||||
type: "UPDATE_CACHE",
|
type: "UPDATE_CACHE",
|
||||||
});
|
});
|
||||||
chrome.runtime.sendMessage({
|
dispatch({
|
||||||
type: !enabled === true ? "ENABLE_ICON" : "DISABLE_ICON",
|
type: !enabled === true ? "ENABLE_ICON" : "DISABLE_ICON",
|
||||||
});
|
});
|
||||||
if (!enabled === false) power.removeAttribute("checked");
|
if (!enabled === false) power.removeAttribute("checked");
|
||||||
if (!enabled === true) power.setAttribute("checked", "checked");
|
if (!enabled === true) power.setAttribute("checked", "checked");
|
||||||
chrome.tabs.reload(id, { bypassCache: true });
|
chrome.tabs.reload(id, { bypassCache: true });
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function handleReload
|
* @function handleReload
|
||||||
* @description Reload current page
|
* @description Reload current page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const handleReload = async () => {
|
const handleReload = () => {
|
||||||
chrome.runtime.sendMessage({ type: "GET_TAB" }, null, ({ id }) => {
|
dispatch({ type: "GET_TAB" }, null, ({ id }) => {
|
||||||
chrome.tabs.reload(id, { bypassCache: true });
|
chrome.tabs.reload(id, { bypassCache: true });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -92,33 +94,28 @@ const handleRate = (event) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @async
|
|
||||||
* @function handleContentLoaded
|
* @function handleContentLoaded
|
||||||
* @description Setup stars handlers and result message links
|
* @description Setup stars handlers and result message links
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const handleContentLoaded = async () => {
|
const handleContentLoaded = () => {
|
||||||
chrome.runtime.sendMessage({ type: "GET_TAB" }, null, ({ hostname, id }) => {
|
dispatch({ type: "GET_TAB" }, null, ({ hostname, id }) => {
|
||||||
chrome.runtime.sendMessage(
|
dispatch({ hostname, type: "GET_CACHE" }, null, ({ enabled }) => {
|
||||||
{ hostname, type: "GET_CACHE" },
|
const host = document.getElementById("host");
|
||||||
null,
|
const like = document.getElementById("like");
|
||||||
({ enabled }) => {
|
const power = document.getElementById("power");
|
||||||
const host = document.getElementById("host");
|
const reload = document.getElementById("reload");
|
||||||
const like = document.getElementById("like");
|
const store = document.getElementById("store");
|
||||||
const power = document.getElementById("power");
|
const unlike = document.getElementById("unlike");
|
||||||
const reload = document.getElementById("reload");
|
|
||||||
const store = document.getElementById("store");
|
|
||||||
const unlike = document.getElementById("unlike");
|
|
||||||
|
|
||||||
like.addEventListener("click", handleRate);
|
like.addEventListener("click", handleRate);
|
||||||
power.addEventListener("change", handlePowerChange);
|
power.addEventListener("change", handlePowerChange);
|
||||||
reload.addEventListener("click", handleReload);
|
reload.addEventListener("click", handleReload);
|
||||||
store.setAttribute("href", isChromium ? chromeUrl : firefoxUrl);
|
store.setAttribute("href", isChromium ? chromeUrl : firefoxUrl);
|
||||||
unlike.addEventListener("click", handleRate);
|
unlike.addEventListener("click", handleRate);
|
||||||
if (location) host.innerText = hostname.replace("www.", "");
|
if (location) host.innerText = hostname.replace("www.", "");
|
||||||
if (!enabled) power.removeAttribute("checked");
|
if (!enabled) power.removeAttribute("checked");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user