commit
026a5ed92e
16
data/tags.txt
Normal file
16
data/tags.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
BASE
|
||||||
|
BODY
|
||||||
|
HEAD
|
||||||
|
HTML
|
||||||
|
IMG
|
||||||
|
LI
|
||||||
|
LINK
|
||||||
|
META
|
||||||
|
NAV
|
||||||
|
OL
|
||||||
|
SCRIPT
|
||||||
|
STYLE
|
||||||
|
SVG
|
||||||
|
TITLE
|
||||||
|
UL
|
||||||
|
VIDEO
|
@ -9,12 +9,14 @@ export default (server: FastifyInstance, options: RouteShorthandOptions, done: (
|
|||||||
const elementsUrl = `${dataUrl}/elements.txt`;
|
const elementsUrl = `${dataUrl}/elements.txt`;
|
||||||
const fixesUrl = `${dataUrl}/fixes.txt`;
|
const fixesUrl = `${dataUrl}/fixes.txt`;
|
||||||
const skipsUrl = `${dataUrl}/skips.txt`;
|
const skipsUrl = `${dataUrl}/skips.txt`;
|
||||||
|
const tagsUrl = `${dataUrl}/tags.txt`;
|
||||||
|
|
||||||
const results = await Promise.all([
|
const results = await Promise.all([
|
||||||
fetch(classesUrl),
|
fetch(classesUrl),
|
||||||
fetch(elementsUrl),
|
fetch(elementsUrl),
|
||||||
fetch(fixesUrl),
|
fetch(fixesUrl),
|
||||||
fetch(skipsUrl),
|
fetch(skipsUrl),
|
||||||
|
fetch(tagsUrl),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
reply.send({
|
reply.send({
|
||||||
@ -23,6 +25,7 @@ export default (server: FastifyInstance, options: RouteShorthandOptions, done: (
|
|||||||
elements: (await results[1].text()).split('\n'),
|
elements: (await results[1].text()).split('\n'),
|
||||||
fixes: (await results[2].text()).split('\n'),
|
fixes: (await results[2].text()).split('\n'),
|
||||||
skips: (await results[3].text()).split('\n'),
|
skips: (await results[3].text()).split('\n'),
|
||||||
|
tags: (await results[4].text()).split('\n'),
|
||||||
},
|
},
|
||||||
success: true,
|
success: true,
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Cookie Dialog Monster",
|
"name": "Cookie Dialog Monster",
|
||||||
"version": "6.0.0",
|
"version": "6.0.1",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_appDesc__",
|
"description": "__MSG_appDesc__",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @description Data properties
|
* @description Data properties
|
||||||
* @type {{ classes: string[], fixes: string[], elements: string[], skips: string[] }?}
|
* @type {{ classes: string[], fixes: string[], elements: string[], skips: string[], tags: string[] }?}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let data = null;
|
let data = null;
|
||||||
@ -11,12 +11,6 @@ let data = null;
|
|||||||
|
|
||||||
const dispatch = chrome.runtime.sendMessage;
|
const dispatch = chrome.runtime.sendMessage;
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Forbidden tags to ignore in the DOM
|
|
||||||
*/
|
|
||||||
|
|
||||||
const forbiddenTags = ['BASE', 'BODY', 'HEAD', 'HTML', 'LINK', 'META', 'SCRIPT', 'STYLE', 'TITLE'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Current hostname
|
* @description Current hostname
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -51,7 +45,7 @@ const match = (node) => {
|
|||||||
const isVisible = rect.top <= (window.innerHeight || document.documentElement.clientHeight);
|
const isVisible = rect.top <= (window.innerHeight || document.documentElement.clientHeight);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!forbiddenTags.includes(node.tagName?.toUpperCase?.()) &&
|
!data?.tags.includes(node.tagName?.toUpperCase?.()) &&
|
||||||
(isFullscreen || isVisible) &&
|
(isFullscreen || isVisible) &&
|
||||||
(node.offsetParent || window.getComputedStyle(node).position === 'fixed') &&
|
(node.offsetParent || window.getComputedStyle(node).position === 'fixed') &&
|
||||||
node.parentElement &&
|
node.parentElement &&
|
||||||
|
@ -60,8 +60,9 @@ const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1;
|
|||||||
|
|
||||||
const handlePowerChange = async () => {
|
const handlePowerChange = async () => {
|
||||||
const state = await dispatch({ hostname, type: 'GET_STATE' });
|
const state = await dispatch({ hostname, type: 'GET_STATE' });
|
||||||
|
const enabled = typeof state?.enabled === 'undefined' ? false : !state.enabled;
|
||||||
|
|
||||||
dispatch({ hostname, state: { enabled: !state?.enabled }, type: 'UPDATE_STATE' });
|
dispatch({ hostname, state: { enabled }, type: 'UPDATE_STATE' });
|
||||||
chrome.tabs.reload({ bypassCache: true });
|
chrome.tabs.reload({ bypassCache: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user