commit
26cabebf3f
@ -8,11 +8,12 @@
|
|||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^17.4.4",
|
"@commitlint/cli": "^17.6.3",
|
||||||
"@commitlint/config-conventional": "^17.4.4",
|
"@commitlint/config-conventional": "^17.6.3",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lint-staged": "^13.1.2",
|
"lint-staged": "^13.2.2",
|
||||||
"prettier": "^2.8.4"
|
"prettier": "^2.8.8",
|
||||||
|
"rimraf": "^5.0.1"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
@ -8,29 +8,28 @@
|
|||||||
"start": "NODE_PATH=build node build/index.js"
|
"start": "NODE_PATH=build node build/index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/cors": "^8.2.0",
|
"@fastify/cors": "^8.2.1",
|
||||||
"@fastify/rate-limit": "^7.6.0",
|
"@fastify/rate-limit": "^8.0.0",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"fastify": "^4.13.0",
|
"fastify": "^4.17.0",
|
||||||
"node-fetch": "^2.6.7",
|
"node-fetch": "^2.6.7",
|
||||||
"nodemailer": "^6.9.1",
|
"nodemailer": "^6.9.2",
|
||||||
"octokit": "^2.0.14"
|
"octokit": "^2.0.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node16": "^1.0.3",
|
"@tsconfig/node16": "^1.0.4",
|
||||||
"@types/node": "^16.18.11",
|
"@types/node": "^16.18.11",
|
||||||
"@types/node-fetch": "^2.6.2",
|
"@types/node-fetch": "^2.6.4",
|
||||||
"@types/nodemailer": "^6.4.6",
|
"@types/nodemailer": "^6.4.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
||||||
"@typescript-eslint/parser": "^5.53.0",
|
"@typescript-eslint/parser": "^5.59.6",
|
||||||
"eslint": "^8.34.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"nodemon": "^2.0.20",
|
"nodemon": "^2.0.22",
|
||||||
"rimraf": "^4.1.2",
|
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tsconfig-paths": "^4.1.2",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": "16.x"
|
||||||
|
@ -6,12 +6,11 @@
|
|||||||
"lint": "eslint src/**/*.js --fix"
|
"lint": "eslint src/**/*.js --fix"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chrome": "^0.0.217",
|
"@types/chrome": "^0.0.236",
|
||||||
"eslint": "^8.34.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"minify": "^9.2.0",
|
"minify": "^10.0.0"
|
||||||
"rimraf": "^4.1.2"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": "16.x"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Cookie Dialog Monster",
|
"name": "Cookie Dialog Monster",
|
||||||
"version": "6.3.0",
|
"version": "6.3.1",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_appDesc__",
|
"description": "__MSG_appDesc__",
|
||||||
"icons": {
|
"icons": {
|
||||||
@ -23,7 +23,8 @@
|
|||||||
"exclude_matches": [
|
"exclude_matches": [
|
||||||
"*://*.googleapis.com/embed/*",
|
"*://*.googleapis.com/embed/*",
|
||||||
"*://*.sharepoint.com/*",
|
"*://*.sharepoint.com/*",
|
||||||
"*://*.youtube.com/embed/*"
|
"*://*.youtube.com/embed/*",
|
||||||
|
"https://www.cookie-dialog-monster.com/*"
|
||||||
],
|
],
|
||||||
"js": ["scripts/content.js", "scripts/dialog.js"],
|
"js": ["scripts/content.js", "scripts/dialog.js"],
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
|
@ -31,13 +31,6 @@ const options = { childList: true, subtree: true };
|
|||||||
|
|
||||||
const preview = hostname.startsWith('consent.') || hostname.startsWith('myprivacy.');
|
const preview = hostname.startsWith('consent.') || hostname.startsWith('myprivacy.');
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Element that were being removed count
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
|
|
||||||
let elementCount = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Extension state
|
* @description Extension state
|
||||||
* @type {{ enabled: boolean }}
|
* @type {{ enabled: boolean }}
|
||||||
@ -62,7 +55,6 @@ const clean = (nodes, skipMatch) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!node.hasAttribute('data-cookie-dialog-monster')) {
|
if (!node.hasAttribute('data-cookie-dialog-monster')) {
|
||||||
elementCount += 1;
|
|
||||||
node.setAttribute('data-cookie-dialog-monster', 'true');
|
node.setAttribute('data-cookie-dialog-monster', 'true');
|
||||||
node.style.setProperty('display', 'none', 'important');
|
node.style.setProperty('display', 'none', 'important');
|
||||||
observer.observe(node, { attributes: true, attributeFilter: ['style'] });
|
observer.observe(node, { attributes: true, attributeFilter: ['style'] });
|
||||||
@ -72,7 +64,7 @@ const clean = (nodes, skipMatch) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Cleans DOM
|
* @description Forces a DOM clean
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -83,7 +75,6 @@ const forceClean = () => {
|
|||||||
if (nodes.length) {
|
if (nodes.length) {
|
||||||
fix();
|
fix();
|
||||||
clean(nodes, true);
|
clean(nodes, true);
|
||||||
elementCount += nodes.length;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -95,47 +86,26 @@ const forceClean = () => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const isInViewport = (node) => {
|
const isInViewport = (node) => {
|
||||||
const bounding = node.getBoundingClientRect();
|
const height = window.innerHeight || document.documentElement.clientHeight;
|
||||||
|
const position = node.getBoundingClientRect();
|
||||||
|
const scroll = window.scrollY || window.pageYOffset;
|
||||||
|
|
||||||
return (
|
return scroll + position.top <= scroll + height && scroll + position.bottom >= scroll;
|
||||||
bounding.top >= -node.offsetHeight &&
|
|
||||||
bounding.left >= -node.offsetWidth &&
|
|
||||||
bounding.right <=
|
|
||||||
(window.innerWidth || document.documentElement.clientWidth) + node.offsetWidth &&
|
|
||||||
bounding.bottom <=
|
|
||||||
(window.innerHeight || document.documentElement.clientHeight) + node.offsetHeight
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Matches if node element is removable
|
* @description Checks if node element is removable
|
||||||
* @param {Element} node
|
* @param {Element} node
|
||||||
* @param {boolean?} skipMatch
|
* @param {boolean?} skipMatch
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const match = (node, skipMatch) => {
|
const match = (node, skipMatch) =>
|
||||||
if (node instanceof HTMLElement) {
|
node instanceof HTMLElement &&
|
||||||
const style = window.getComputedStyle(node);
|
!node.getAttribute('data-cookie-dialog-monster') &&
|
||||||
const skipIsInViewport =
|
|
||||||
(style.animationName !== 'none' && style.animationPlayState === 'running') ||
|
|
||||||
style.display === 'none' ||
|
|
||||||
style.height === '0px' ||
|
|
||||||
style.opacity === '0' ||
|
|
||||||
style.transitionProperty !== 'none' ||
|
|
||||||
style.visibility === 'hidden';
|
|
||||||
|
|
||||||
return (
|
|
||||||
!data?.tags.includes(node.tagName?.toUpperCase?.()) &&
|
!data?.tags.includes(node.tagName?.toUpperCase?.()) &&
|
||||||
(skipIsInViewport || isInViewport(node)) &&
|
isInViewport(node) &&
|
||||||
(!!node.offsetParent || style.position === 'fixed') &&
|
(skipMatch || node.matches(data?.elements ?? []));
|
||||||
!!node.parentElement &&
|
|
||||||
(skipMatch || node.matches(data?.elements ?? []))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Fixes scroll issues
|
* @description Fixes scroll issues
|
||||||
@ -184,7 +154,7 @@ const fix = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skips.some((skip) => skip.includes(hostname))) {
|
if (skips.indexOf(hostname) === -1) {
|
||||||
for (const item of [document.body, document.documentElement]) {
|
for (const item of [document.body, document.documentElement]) {
|
||||||
item?.classList.remove(...(data?.classes ?? []));
|
item?.classList.remove(...(data?.classes ?? []));
|
||||||
item?.style.setProperty('position', 'initial', 'important');
|
item?.style.setProperty('position', 'initial', 'important');
|
||||||
@ -207,11 +177,11 @@ const observer = new MutationObserver((mutations) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Fixes already existing element when page load issues
|
* @description Fixes already existing element when page load issues
|
||||||
* @listens window#load
|
* @listens window#DOMContentLoaded
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
if (elementCount < 2) forceClean();
|
forceClean();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -220,7 +190,9 @@ window.addEventListener('load', () => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
window.addEventListener('pageshow', (event) => {
|
window.addEventListener('pageshow', (event) => {
|
||||||
if (event.persisted) forceClean();
|
if (event.persisted) {
|
||||||
|
forceClean();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,10 +6,9 @@
|
|||||||
"start": "NODE_PATH=build serve build"
|
"start": "NODE_PATH=build serve build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"minify": "^9.2.0",
|
"minify": "^10.0.0",
|
||||||
"rimraf": "^4.1.2",
|
|
||||||
"serve": "^14.2.0",
|
"serve": "^14.2.0",
|
||||||
"tailwindcss": "^3.2.7"
|
"tailwindcss": "^3.3.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": "16.x"
|
||||||
|
Loading…
Reference in New Issue
Block a user