feat(content): improve script

This commit is contained in:
Juan José Vílchez 2021-02-05 16:28:41 +01:00
parent c4b833587f
commit d791a86b37

View File

@ -8,15 +8,16 @@ if (!!window.chrome) {
const fix = () => {
document.body.style = "overflow-y: unset !important;";
document.documentElement.style = "overflow-y: unset !important;";
};
const retrieveElement = (match) => {
if (!match.includes("[") && !match.includes(">")) {
if (match[0] === ".") {
if (match.startsWith(".")) {
return document.getElementsByClassName(match.slice(1))[0];
}
if (match[0] === "#") {
if (match.startsWith("#")) {
return document.getElementById(match.slice(1));
}
} else {
@ -62,7 +63,7 @@ if (!!window.chrome) {
};
const removeFromFilters = () => {
if (attempts < 3) {
if (attempts < 5) {
filters.forEach((match) => {
const element = retrieveElement(match);
const tagName = element ? element.tagName.toUpperCase() : "";