Merge pull request #224 from wanhose/v6.3.1

6.3.1
This commit is contained in:
wanhose 2023-05-20 17:27:34 +02:00 committed by GitHub
commit 26cabebf3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 896 additions and 753 deletions

View File

@ -8,11 +8,12 @@
"prepare": "husky install"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"husky": "^8.0.3",
"lint-staged": "^13.1.2",
"prettier": "^2.8.4"
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"rimraf": "^5.0.1"
},
"workspaces": [
"packages/*"

View File

@ -8,29 +8,28 @@
"start": "NODE_PATH=build node build/index.js"
},
"dependencies": {
"@fastify/cors": "^8.2.0",
"@fastify/rate-limit": "^7.6.0",
"@fastify/cors": "^8.2.1",
"@fastify/rate-limit": "^8.0.0",
"dotenv": "^16.0.3",
"fastify": "^4.13.0",
"fastify": "^4.17.0",
"node-fetch": "^2.6.7",
"nodemailer": "^6.9.1",
"octokit": "^2.0.14"
"nodemailer": "^6.9.2",
"octokit": "^2.0.16"
},
"devDependencies": {
"@tsconfig/node16": "^1.0.3",
"@tsconfig/node16": "^1.0.4",
"@types/node": "^16.18.11",
"@types/node-fetch": "^2.6.2",
"@types/nodemailer": "^6.4.6",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"@types/node-fetch": "^2.6.4",
"@types/nodemailer": "^6.4.8",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"nodemon": "^2.0.20",
"rimraf": "^4.1.2",
"nodemon": "^2.0.22",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.2",
"typescript": "^4.9.5"
"tsconfig-paths": "^4.2.0",
"typescript": "^5.0.4"
},
"engines": {
"node": "16.x"

View File

@ -6,12 +6,11 @@
"lint": "eslint src/**/*.js --fix"
},
"devDependencies": {
"@types/chrome": "^0.0.217",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"@types/chrome": "^0.0.236",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"minify": "^9.2.0",
"rimraf": "^4.1.2"
"minify": "^10.0.0"
},
"engines": {
"node": "16.x"

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Cookie Dialog Monster",
"version": "6.3.0",
"version": "6.3.1",
"default_locale": "en",
"description": "__MSG_appDesc__",
"icons": {
@ -23,7 +23,8 @@
"exclude_matches": [
"*://*.googleapis.com/embed/*",
"*://*.sharepoint.com/*",
"*://*.youtube.com/embed/*"
"*://*.youtube.com/embed/*",
"https://www.cookie-dialog-monster.com/*"
],
"js": ["scripts/content.js", "scripts/dialog.js"],
"matches": ["http://*/*", "https://*/*"],

View File

@ -31,13 +31,6 @@ const options = { childList: true, subtree: true };
const preview = hostname.startsWith('consent.') || hostname.startsWith('myprivacy.');
/**
* @description Element that were being removed count
* @type {number}
*/
let elementCount = 0;
/**
* @description Extension state
* @type {{ enabled: boolean }}
@ -62,7 +55,6 @@ const clean = (nodes, skipMatch) => {
});
if (!node.hasAttribute('data-cookie-dialog-monster')) {
elementCount += 1;
node.setAttribute('data-cookie-dialog-monster', 'true');
node.style.setProperty('display', 'none', 'important');
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}
*/
@ -83,7 +75,6 @@ const forceClean = () => {
if (nodes.length) {
fix();
clean(nodes, true);
elementCount += nodes.length;
}
}
};
@ -95,47 +86,26 @@ const forceClean = () => {
*/
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 (
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
);
return scroll + position.top <= scroll + height && scroll + position.bottom >= scroll;
};
/**
* @description Matches if node element is removable
* @description Checks if node element is removable
* @param {Element} node
* @param {boolean?} skipMatch
* @returns {boolean}
*/
const match = (node, skipMatch) => {
if (node instanceof HTMLElement) {
const style = window.getComputedStyle(node);
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?.()) &&
(skipIsInViewport || isInViewport(node)) &&
(!!node.offsetParent || style.position === 'fixed') &&
!!node.parentElement &&
(skipMatch || node.matches(data?.elements ?? []))
);
}
return false;
};
const match = (node, skipMatch) =>
node instanceof HTMLElement &&
!node.getAttribute('data-cookie-dialog-monster') &&
!data?.tags.includes(node.tagName?.toUpperCase?.()) &&
isInViewport(node) &&
(skipMatch || node.matches(data?.elements ?? []));
/**
* @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]) {
item?.classList.remove(...(data?.classes ?? []));
item?.style.setProperty('position', 'initial', 'important');
@ -207,11 +177,11 @@ const observer = new MutationObserver((mutations) => {
/**
* @description Fixes already existing element when page load issues
* @listens window#load
* @listens window#DOMContentLoaded
*/
window.addEventListener('load', () => {
if (elementCount < 2) forceClean();
window.addEventListener('DOMContentLoaded', () => {
forceClean();
});
/**
@ -220,7 +190,9 @@ window.addEventListener('load', () => {
*/
window.addEventListener('pageshow', (event) => {
if (event.persisted) forceClean();
if (event.persisted) {
forceClean();
}
});
/**

View File

@ -6,10 +6,9 @@
"start": "NODE_PATH=build serve build"
},
"devDependencies": {
"minify": "^9.2.0",
"rimraf": "^4.1.2",
"minify": "^10.0.0",
"serve": "^14.2.0",
"tailwindcss": "^3.2.7"
"tailwindcss": "^3.3.2"
},
"engines": {
"node": "16.x"

1524
yarn.lock

File diff suppressed because it is too large Load Diff