feat(script): disable cookies automatically
This commit is contained in:
parent
44c52f188c
commit
f20c420137
@ -15,4 +15,3 @@ if (!!window.chrome) {
|
|||||||
// Inject logic script
|
// Inject logic script
|
||||||
target.appendChild(script);
|
target.appendChild(script);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,11 +5,21 @@ import { getNotRemovableElements, getRemovableElements } from './helpers.js';
|
|||||||
const observer = new MutationObserver((mutations, observer) => {
|
const observer = new MutationObserver((mutations, observer) => {
|
||||||
mutations.forEach(() => {
|
mutations.forEach(() => {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
|
disableCookies();
|
||||||
doMagic();
|
doMagic();
|
||||||
observe();
|
observe();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Cookies disabler
|
||||||
|
const disableCookies = () => {
|
||||||
|
const cookies = document.cookie.split(';');
|
||||||
|
|
||||||
|
cookies.forEach(cookie => {
|
||||||
|
document.cookie = `${cookie.split('=')[0]}=; expires=${new Date(null).toUTCString()}; path=/;`;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Remover
|
// Remover
|
||||||
const doMagic = () => {
|
const doMagic = () => {
|
||||||
// Getting elements
|
// Getting elements
|
||||||
@ -58,5 +68,6 @@ const observe = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Then...
|
// Then...
|
||||||
|
disableCookies();
|
||||||
doMagic();
|
doMagic();
|
||||||
observe();
|
observe();
|
Loading…
Reference in New Issue
Block a user