1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-15 14:09:36 +02:00

Added notice for privacy.resistFingerprinting

Fixes #427
This commit is contained in:
kkapsner 2020-01-23 15:23:56 +01:00
parent 1556ee45c2
commit 9353f71455
7 changed files with 73 additions and 28 deletions

View file

@ -37,6 +37,12 @@ header .bookmarkNotice .dontShowOptionsOnUpdate input {
vertical-align: sub;
}
.resistFingerprintingNotice {
margin: 0.5em 0;
padding: 0.5em;
border: 1px solid var(--input-error-background-color);
}
.settings {
width: 100%;
border-spacing: 0;

View file

@ -228,6 +228,29 @@
groupTabs.classList = "groupTabs";
document.body.appendChild(groupTabs);
if (
browser.privacy &&
browser.privacy.websites &&
browser.privacy.websites.resistFingerprinting &&
browser.privacy.websites.resistFingerprinting.get
){
browser.privacy.websites.resistFingerprinting.get({}).then(function({value}){
if (value){
const rfpNotice = document.createElement("div");
rfpNotice.className = "resistFingerprintingNotice";
rfpNotice.appendChild(
extension.parseTranslation(
extension.getTranslation("resistFingerprintingNotice")
)
);
document.body.insertBefore(rfpNotice, groupTabs);
}
return undefined;
}).catch(function(error){
logging.warning("Unable to read resistFingerprinting:", error);
});
}
const groups = document.createElement("ul");
groups.className = "groups";
groupTabs.appendChild(groups);

View file

@ -141,32 +141,7 @@
if (noticeText){
const notice = document.createElement("div");
notice.className = noticeName + " notice";
noticeText.split(/(\{[^}]+\})/).forEach(function(part){
if (part.startsWith("{") && part.endsWith("}")){
part = part.substring(1, part.length - 1);
const args = part.split(":");
switch (args[0]){
case "image": {
const image = document.createElement("img");
image.className = "noticeImage";
image.src = args[1];
notice.appendChild(image);
break;
}
case "link": {
const link = document.createElement("a");
link.target = "_blank";
link.textContent = args[1];
link.href = args[2];
notice.appendChild(link);
break;
}
}
}
else {
notice.appendChild(document.createTextNode(part));
}
});
notice.appendChild(extension.parseTranslation(noticeText));
head.appendChild(notice);
}