refactor: move one level up removing src structure

This commit is contained in:
wanhose 2021-04-08 23:52:52 +02:00
parent 4108c4cb8a
commit 38b82af3c9
23 changed files with 27 additions and 212 deletions

BIN
assets/icon-disabled.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/icon128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -12572,6 +12572,9 @@ div[aria-labelledby="cookie_banner_title"]
_evidon-barrier-wrapper
#mms-consent-portal-container
div[data-testid="cookie-policy-manage-dialog"]
header[style="z-index: 2147483643;"]
div[aria-label="cookieconsent"]
body[style="overflow-y: unset !important; position: relative; min-height: 100%; top: 0px;"] > div#overlay
body[style="overflow-y: unset !important; position: relative; min-height: 100%; top: 0px;"] > div#overlay
.tco-content-dock left tco-content-dock-on
[class*="AnalyticsFooter-module--container"]
.subredditvars-r-javascript > div > section
.popover--oreo-message

View File

@ -9,7 +9,7 @@ An extension that allows you to remove cookie consent dialogs automatically.
## Compatibility
- Google Chrome 26+.
- Google Chrome 67+.
- Microsoft Edge 79+.
- Mozilla Firefox 48+.
- Opera 48+.

View File

@ -28,9 +28,8 @@ let selectors = [];
* @type {string}
*/
const url = chrome.runtime.getURL("data/elements.txt");
/*const url =
"https://raw.githubusercontent.com/wanhose/do-not-consent/master/data/elements.txt";*/
const url =
"https://raw.githubusercontent.com/wanhose/do-not-consent/master/data/elements.txt";
/**
* @function commit

View File

@ -1,104 +0,0 @@
<html>
<head>
<link rel="stylesheet" href="/styles/reset.css" />
<link rel="stylesheet" href="/styles/index.css" />
<meta charset="UTF-8" />
<meta name="author" content="wanhose" />
<script src="/scripts/popup.js"></script>
</head>
<body>
<h1>Please rate this extension!</h1>
<div id="stars">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="star"
data-score="1"
>
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
/>
</svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="star"
data-score="2"
>
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
/>
</svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="star"
data-score="3"
>
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
/>
</svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="star"
data-score="4"
>
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
/>
</svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="star"
data-score="5"
>
<polygon
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
/>
</svg>
</div>
<p hidden="true" id="negative">
Ooops! We are sorry for the inconvenience, please
<a href="mailto:wanhose.development@gmail.com" target="_blank">
contact us
</a>
and we will help you
<span aria-label="Grinning face with sweat" role="img">😅</span>
</p>
<p hidden="true" id="positive">
Thank you very much! Help us to grow rating and reviewing this extension
<a id="store-link" target="_blank">here</a>
<span aria-label="Smiling face with heart-shaped eyes" role="img">
😍
</span>
</p>
</body>
</html>

View File

@ -1,64 +0,0 @@
let elements = [];
const fix = () => {
const html = document.documentElement;
const body = document.body;
html.style.setProperty("overflow-y", "unset", "important");
body.style.setProperty("overflow-y", "unset", "important");
};
const observe = () => {
observer.observe(document.body, {
attributes: true,
childList: true,
});
};
const search = (match) => {
if (!match.includes("[") && !match.includes(">")) {
if (match.startsWith(".")) {
return document.getElementsByClassName(match.slice(1))[0];
}
if (match.startsWith("#")) {
return document.getElementById(match.slice(1));
}
} else {
return document.querySelector(match);
}
return null;
};
const remove = () => {
for (let i = elements.length; i--; ) {
const match = elements[i];
const element = search(match);
if (element) {
const tagName = element.tagName.toUpperCase();
if (!["BODY", "HTML"].includes(tagName)) element.remove();
}
}
};
const observer = new MutationObserver((_, instance) => {
instance.disconnect();
fix();
remove();
observe();
});
(async () => {
const url = chrome.runtime.getURL("data/elements.txt");
const db = await fetch(url).then((res) => res.text());
elements = db.split("\n");
})();
document.addEventListener("DOMContentLoaded", () => {
fix();
remove();
observe();
});

View File

@ -1,37 +0,0 @@
const handleClick = (event) => {
const negative = document.getElementById("negative");
const positive = document.getElementById("positive");
const { score } = event.currentTarget.dataset;
const stars = document.getElementById("stars");
switch (score) {
case "1":
case "2":
case "3":
stars.setAttribute("hidden", "true");
negative.removeAttribute("hidden");
break;
case "4":
case "5":
stars.setAttribute("hidden", "true");
positive.removeAttribute("hidden");
break;
default:
break;
}
};
document.addEventListener("DOMContentLoaded", () => {
const chromeUrl =
"https://chrome.google.com/webstore/detail/do-not-consent/djcbfpkdhdkaflcigibkbpboflaplabg";
const firefoxUrl =
"https://addons.mozilla.org/es/firefox/addon/do-not-consent/";
const isChrome = chrome.runtime.getURL("").startsWith("chrome-extension://");
const stars = Array.from(document.getElementsByClassName("star"));
const storeLink = document.getElementById("store-link");
stars.forEach((star) => {
star.addEventListener("click", handleClick);
});
storeLink.setAttribute("href", isChrome ? chromeUrl : firefoxUrl);
});

View File

@ -15,7 +15,7 @@ body {
color: var(--color-chocolate);
display: flex;
flex-direction: column;
height: 5rem;
height: 12rem;
justify-content: center;
margin: 1rem;
width: 20rem;
@ -58,6 +58,24 @@ span {
padding-right: 0.75rem;
}
#state-button {
background-color: var(--color-star);
border: none;
border-radius: 0.25rem;
color: var(--color-chocolate);
font-size: 0.875rem;
line-height: 1;
margin: 0 auto 1rem auto;
outline: 0;
padding: 0.5rem 1rem;
}
#state-button:focus,
#state-button:hover {
cursor: pointer;
opacity: 0.7;
}
#stars {
display: inline-flex;
}