mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
parent
1556ee45c2
commit
9353f71455
@ -83,6 +83,10 @@
|
||||
"message": "Bei Aktualisierung nicht wieder anzeigen.",
|
||||
"description": ""
|
||||
},
|
||||
"resistFingerprintingNotice": {
|
||||
"message": "Sie haben privacy.resistFingerprinting aktiviert. Dies verändert das Verhalten von CanvasBlocker ein wenig. Weitere Informationen finden Sie {link:hier:https://github.com/kkapsner/CanvasBlocker/issues/158} und {link:hier:https://github.com/ghacksuserjs/ghacks-user.js/issues/767}.",
|
||||
"description": ""
|
||||
},
|
||||
"openInTab": {
|
||||
"message": "In separatem Tab öffnen",
|
||||
"description": ""
|
||||
|
@ -88,6 +88,10 @@
|
||||
"message": "Don't show up again after update.",
|
||||
"description": ""
|
||||
},
|
||||
"resistFingerprintingNotice": {
|
||||
"message": "You have privacy.resistFingerprinting enabled. This slightly changes the behaviour of CanvasBlocker. See further information {link:here:https://github.com/kkapsner/CanvasBlocker/issues/158} and {link:here:https://github.com/ghacksuserjs/ghacks-user.js/issues/767}.",
|
||||
"description": ""
|
||||
},
|
||||
"openInTab": {
|
||||
"message": "Open in separate tab",
|
||||
"description": ""
|
||||
|
@ -27,6 +27,38 @@
|
||||
return id;
|
||||
};
|
||||
|
||||
scope.parseTranslation = function parseTranslation(message){
|
||||
const container = document.createDocumentFragment();
|
||||
|
||||
message.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.slice(1).join(":");
|
||||
container.appendChild(image);
|
||||
break;
|
||||
}
|
||||
case "link": {
|
||||
const link = document.createElement("a");
|
||||
link.target = "_blank";
|
||||
link.textContent = args[1];
|
||||
link.href = args.slice(2).join(":");
|
||||
container.appendChild(link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
container.appendChild(document.createTextNode(part));
|
||||
}
|
||||
});
|
||||
return container;
|
||||
};
|
||||
|
||||
scope.extensionID = browserAvailable? browser.extension.getURL(""): "extensionID";
|
||||
|
||||
scope.inIncognitoContext = browserAvailable? browser.extension.inIncognitoContext: false;
|
||||
|
@ -91,7 +91,8 @@
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"contextualIdentities",
|
||||
"cookies"
|
||||
"cookies",
|
||||
"privacy"
|
||||
],
|
||||
|
||||
"applications": {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user