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,
|
"manifest_version": 2,
|
||||||
"name": "Cookie Dialog Monster",
|
"name": "Cookie Dialog Monster",
|
||||||
"version": "5.5.1",
|
"version": "5.5.2",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_appDesc__",
|
"description": "__MSG_appDesc__",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
@ -93,8 +93,8 @@ const query = async (key, callback) => {
|
|||||||
const queryTab = (callback) => {
|
const queryTab = (callback) => {
|
||||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||||
callback({
|
callback({
|
||||||
id: tabs[0].id,
|
id: tabs[0]?.id,
|
||||||
hostname: new URL(tabs[0].url).hostname,
|
hostname: new URL(tabs[0].url).hostname.split('.').slice(-2).join('.'),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -112,7 +112,7 @@ const report = () => {
|
|||||||
if (tab) {
|
if (tab) {
|
||||||
fetch(`${apiUrl}/report/`, {
|
fetch(`${apiUrl}/report/`, {
|
||||||
body: JSON.stringify({
|
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',
|
to: 'wanhose.development@gmail.com',
|
||||||
subject: 'Cookie Dialog Monster Report',
|
subject: 'Cookie Dialog Monster Report',
|
||||||
}),
|
}),
|
||||||
|
@ -40,9 +40,10 @@ const preview = hostname.startsWith('consent.') || hostname.startsWith('myprivac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Options provided to observer
|
* @description Options provided to observer
|
||||||
|
* @type {MutationObserverInit}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const options = { childList: true, subtree: true };
|
const options = { attributes: true, childList: true, subtree: true };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Selectors list
|
* @description Selectors list
|
||||||
@ -76,11 +77,7 @@ const check = (node) =>
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const clean = (nodes) => {
|
const clean = (nodes) => nodes.filter(check).forEach((node) => (node.outerHTML = ''));
|
||||||
if (selectors.length) {
|
|
||||||
nodes.filter(check).forEach((node) => (node.outerHTML = ''));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Fixes scroll issues
|
* @description Fixes scroll issues
|
||||||
@ -137,7 +134,7 @@ const observer = new MutationObserver((mutations, instance) => {
|
|||||||
|
|
||||||
instance.disconnect();
|
instance.disconnect();
|
||||||
fix();
|
fix();
|
||||||
if (!preview) clean(nodes);
|
if (!preview && selectors.length) clean(nodes);
|
||||||
instance.observe(target, options);
|
instance.observe(target, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -161,8 +158,8 @@ const promiseAll = () =>
|
|||||||
|
|
||||||
document.addEventListener('readystatechange', () => {
|
document.addEventListener('readystatechange', () => {
|
||||||
dispatch({ hostname, type: 'GET_CACHE' }, null, async ({ enabled }) => {
|
dispatch({ hostname, type: 'GET_CACHE' }, null, async ({ enabled }) => {
|
||||||
if (document.readyState === 'complete' && enabled && !preview && selectors.length) {
|
if (document.readyState === 'complete' && enabled && !preview) {
|
||||||
const nodes = Array.from(document.querySelectorAll(selectors));
|
const nodes = selectors.length ? Array.from(document.querySelectorAll(selectors)) : [];
|
||||||
|
|
||||||
fix();
|
fix();
|
||||||
clean(nodes);
|
clean(nodes);
|
||||||
|
@ -44,9 +44,6 @@ const handlePowerChange = () => {
|
|||||||
state: { enabled: !enabled },
|
state: { enabled: !enabled },
|
||||||
type: 'UPDATE_CACHE',
|
type: 'UPDATE_CACHE',
|
||||||
});
|
});
|
||||||
dispatch({
|
|
||||||
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 });
|
||||||
|
Loading…
Reference in New Issue
Block a user