diff --git a/packages/browser-extension/.minify.json b/packages/browser-extension/.minify.json
new file mode 100644
index 0000000..07cfca1
--- /dev/null
+++ b/packages/browser-extension/.minify.json
@@ -0,0 +1,5 @@
+{
+ "img": {
+ "maxSize": 0
+ }
+}
diff --git a/packages/browser-extension/src/manifest.json b/packages/browser-extension/src/manifest.json
index 9854c31..77a5feb 100644
--- a/packages/browser-extension/src/manifest.json
+++ b/packages/browser-extension/src/manifest.json
@@ -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": {
diff --git a/packages/browser-extension/src/scripts/background.js b/packages/browser-extension/src/scripts/background.js
index 3a17da3..8a7cba7 100644
--- a/packages/browser-extension/src/scripts/background.js
+++ b/packages/browser-extension/src/scripts/background.js
@@ -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: `Browser: ${userAgent}
Site: ${tab.url}
Version: ${version}`,
to: 'wanhose.development@gmail.com',
subject: 'Cookie Dialog Monster Report',
}),
diff --git a/packages/browser-extension/src/scripts/content.js b/packages/browser-extension/src/scripts/content.js
index a039754..f54d039 100644
--- a/packages/browser-extension/src/scripts/content.js
+++ b/packages/browser-extension/src/scripts/content.js
@@ -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);
diff --git a/packages/browser-extension/src/scripts/popup.js b/packages/browser-extension/src/scripts/popup.js
index 76e7dc8..0e2db4f 100644
--- a/packages/browser-extension/src/scripts/popup.js
+++ b/packages/browser-extension/src/scripts/popup.js
@@ -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 });