commit
271d8dc134
5
packages/browser-extension/.minify.json
Normal file
5
packages/browser-extension/.minify.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"img": {
|
||||
"maxSize": 0
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Cookie Dialog Monster",
|
||||
"version": "5.5.1",
|
||||
"version": "5.5.2",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_appDesc__",
|
||||
"icons": {
|
||||
|
@ -93,8 +93,8 @@ const query = async (key, callback) => {
|
||||
const queryTab = (callback) => {
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||
callback({
|
||||
id: tabs[0].id,
|
||||
hostname: new URL(tabs[0].url).hostname,
|
||||
id: tabs[0]?.id,
|
||||
hostname: new URL(tabs[0].url).hostname.split('.').slice(-2).join('.'),
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -112,7 +112,7 @@ const report = () => {
|
||||
if (tab) {
|
||||
fetch(`${apiUrl}/report/`, {
|
||||
body: JSON.stringify({
|
||||
text: `There's a problem with ${tab.url} using ${userAgent} in CDM ${version}`,
|
||||
html: `<b>Browser:</b> ${userAgent}<br/><b>Site:</b> ${tab.url}<br/> <b>Version:</b> ${version}`,
|
||||
to: 'wanhose.development@gmail.com',
|
||||
subject: 'Cookie Dialog Monster Report',
|
||||
}),
|
||||
|
@ -40,9 +40,10 @@ const preview = hostname.startsWith('consent.') || hostname.startsWith('myprivac
|
||||
|
||||
/**
|
||||
* @description Options provided to observer
|
||||
* @type {MutationObserverInit}
|
||||
*/
|
||||
|
||||
const options = { childList: true, subtree: true };
|
||||
const options = { attributes: true, childList: true, subtree: true };
|
||||
|
||||
/**
|
||||
* @description Selectors list
|
||||
@ -76,11 +77,7 @@ const check = (node) =>
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
const clean = (nodes) => {
|
||||
if (selectors.length) {
|
||||
nodes.filter(check).forEach((node) => (node.outerHTML = ''));
|
||||
}
|
||||
};
|
||||
const clean = (nodes) => nodes.filter(check).forEach((node) => (node.outerHTML = ''));
|
||||
|
||||
/**
|
||||
* @description Fixes scroll issues
|
||||
@ -137,7 +134,7 @@ const observer = new MutationObserver((mutations, instance) => {
|
||||
|
||||
instance.disconnect();
|
||||
fix();
|
||||
if (!preview) clean(nodes);
|
||||
if (!preview && selectors.length) clean(nodes);
|
||||
instance.observe(target, options);
|
||||
});
|
||||
|
||||
@ -161,8 +158,8 @@ const promiseAll = () =>
|
||||
|
||||
document.addEventListener('readystatechange', () => {
|
||||
dispatch({ hostname, type: 'GET_CACHE' }, null, async ({ enabled }) => {
|
||||
if (document.readyState === 'complete' && enabled && !preview && selectors.length) {
|
||||
const nodes = Array.from(document.querySelectorAll(selectors));
|
||||
if (document.readyState === 'complete' && enabled && !preview) {
|
||||
const nodes = selectors.length ? Array.from(document.querySelectorAll(selectors)) : [];
|
||||
|
||||
fix();
|
||||
clean(nodes);
|
||||
|
@ -44,9 +44,6 @@ const handlePowerChange = () => {
|
||||
state: { enabled: !enabled },
|
||||
type: 'UPDATE_CACHE',
|
||||
});
|
||||
dispatch({
|
||||
type: !enabled === true ? 'ENABLE_ICON' : 'DISABLE_ICON',
|
||||
});
|
||||
if (!enabled === false) power.removeAttribute('checked');
|
||||
if (!enabled === true) power.setAttribute('checked', 'checked');
|
||||
chrome.tabs.reload(id, { bypassCache: true });
|
||||
|
Loading…
Reference in New Issue
Block a user