mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
parent
30b97df8fc
commit
59c75cdbaa
@ -1675,7 +1675,7 @@
|
|||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"whitelist_inspection_description": {
|
"whitelist_inspection_description": {
|
||||||
"message": "Shows which API protections are active for a given site. If you remove a checkmark for an API this API will be not protected for the selected site.",
|
"message": "This shows which fingerprint protections are active for specified sites.\n\nUnchecked means that the site can use that particular function in an unaltered manner. This includes it could use it to (partially) fingerprint your browser.\nChecked means that CanvasBlocker provides a protection which makes it harder for the site to uniquely identifying you.",
|
||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"whitelist_all_apis": {
|
"whitelist_all_apis": {
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
.description {
|
.description {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.whitelist {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.whitelist tr.highlight {
|
||||||
|
background-color: var(--highlight-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.whitelist th {
|
||||||
|
padding: 0.1em 0.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.whitelist td {
|
||||||
|
padding: 0.1em 0.4em;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
.whitelist .inputCell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
@ -20,7 +20,11 @@
|
|||||||
|
|
||||||
const description = document.createElement("div");
|
const description = document.createElement("div");
|
||||||
description.className = "description";
|
description.className = "description";
|
||||||
description.textContent = extension.getTranslation("whitelist_inspection_description");
|
extension.getTranslation("whitelist_inspection_description").split(/(\n)/g).forEach(function(line){
|
||||||
|
const node = line === "\n"? document.createElement("br"): document.createTextNode(line);
|
||||||
|
description.appendChild(node);
|
||||||
|
});
|
||||||
|
|
||||||
document.body.appendChild(description);
|
document.body.appendChild(description);
|
||||||
|
|
||||||
|
|
||||||
@ -81,18 +85,30 @@
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
settings.onloaded(function(){
|
const table = document.createElement("table");
|
||||||
const sets = settingContainers.urlContainer.get();
|
table.className = "whitelist";
|
||||||
|
document.body.appendChild(table);
|
||||||
|
|
||||||
const selectLabel = document.createElement("label");
|
const header = document.createElement("thead");
|
||||||
selectLabel.textContent = "URL ";
|
table.appendChild(header);
|
||||||
document.body.appendChild(selectLabel);
|
|
||||||
|
|
||||||
const setSelect = document.createElement("select");
|
const headerRow = document.createElement("tr");
|
||||||
sets.forEach(function(set){
|
header.appendChild(headerRow);
|
||||||
setSelect.appendChild(new Option(set.url));
|
|
||||||
|
const urlCell = document.createElement("th");
|
||||||
|
urlCell.textContent = "URL";
|
||||||
|
headerRow.appendChild(urlCell);
|
||||||
|
|
||||||
|
whitelistSettings.forEach(function(setting){
|
||||||
|
const cell = document.createElement("th");
|
||||||
|
cell.textContent = setting.title;
|
||||||
|
setting.headerCell = cell;
|
||||||
|
headerRow.appendChild(cell);
|
||||||
});
|
});
|
||||||
selectLabel.appendChild(setSelect);
|
const tableBody = document.createElement("tbody");
|
||||||
|
table.appendChild(tableBody);
|
||||||
|
settings.onloaded(function(){
|
||||||
|
const sets = Array.from(settingContainers.urlContainer.get());
|
||||||
|
|
||||||
if (searchParameters.has("urls")){
|
if (searchParameters.has("urls")){
|
||||||
const urls = JSON.parse(searchParameters.get("urls")).map(function(url){
|
const urls = JSON.parse(searchParameters.get("urls")).map(function(url){
|
||||||
@ -103,56 +119,69 @@
|
|||||||
if (urls.some(function(url){
|
if (urls.some(function(url){
|
||||||
return set.match && set.match(url);
|
return set.match && set.match(url);
|
||||||
})){
|
})){
|
||||||
setSelect.selectedIndex = index;
|
set.highlight = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}) &&
|
}) &&
|
||||||
searchParameters.has("domain")
|
searchParameters.has("domain")
|
||||||
){
|
){
|
||||||
setSelect.appendChild(new Option(searchParameters.get("domain")));
|
sets.unshift({url: searchParameters.get("domain"), highlight: true});
|
||||||
setSelect.selectedIndex = setSelect.options.length - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const table = document.createElement("table");
|
const setNodes = new Map();
|
||||||
|
sets.forEach(function(set){
|
||||||
|
const row = document.createElement("tr");
|
||||||
|
if (set.highlight){
|
||||||
|
row.className = "highlight";
|
||||||
|
}
|
||||||
|
tableBody.appendChild(row);
|
||||||
|
|
||||||
|
const urlCell = document.createElement("td");
|
||||||
|
urlCell.textContent = set.url;
|
||||||
|
row.appendChild(urlCell);
|
||||||
|
|
||||||
|
const nodes = new Map();
|
||||||
whitelistSettings.forEach(function(setting){
|
whitelistSettings.forEach(function(setting){
|
||||||
const settingDefinition = settings.getDefinition(setting.name);
|
const settingDefinition = settings.getDefinition(setting.name);
|
||||||
const row = document.createElement("tr");
|
const cell = document.createElement("td");
|
||||||
setting.row = row;
|
cell.className = "inputCell";
|
||||||
const name = document.createElement("td");
|
row.appendChild(cell);
|
||||||
name.textContent = setting.title || extension.getTranslation(setting.name + "_title");
|
|
||||||
row.appendChild(name);
|
const input = document.createElement("input");
|
||||||
setting.input = document.createElement("input");
|
input.type = "checkbox";
|
||||||
setting.input.type = "checkbox";
|
input.addEventListener("change", function(){
|
||||||
setting.input.addEventListener("change", function(){
|
|
||||||
const value = this.checked? setting.protectedValue: setting.whitelistValue;
|
const value = this.checked? setting.protectedValue: setting.whitelistValue;
|
||||||
if (settingDefinition.get() === value){
|
if (settingDefinition.get() === value){
|
||||||
settingDefinition.reset(setSelect.value);
|
settingDefinition.reset(set.url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
settingDefinition.set(value, setSelect.value);
|
settingDefinition.set(value, set.url);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const input = document.createElement("td");
|
nodes.set(setting, {cell, input});
|
||||||
input.appendChild(setting.input);
|
cell.appendChild(input);
|
||||||
row.appendChild(input);
|
});
|
||||||
table.appendChild(row);
|
setNodes.set(set, nodes);
|
||||||
});
|
});
|
||||||
document.body.appendChild(table);
|
|
||||||
|
|
||||||
function update(){
|
function update(){
|
||||||
|
sets.forEach(function(set){
|
||||||
|
const nodes = setNodes.get(set);
|
||||||
whitelistSettings.forEach(function(setting){
|
whitelistSettings.forEach(function(setting){
|
||||||
setting.row.style.display = settings.get(setting.name) === setting.whitelistValue?
|
const display = settings.get(setting.name) === setting.whitelistValue?
|
||||||
"none":
|
"none":
|
||||||
"";
|
"";
|
||||||
|
setting.headerCell.style.display = display;
|
||||||
const currentValue = settings.get(setting.name, setSelect.value);
|
const currentValue = settings.get(setting.name, set.url);
|
||||||
setting.input.checked = currentValue !== setting.whitelistValue;
|
const node = nodes.get(setting);
|
||||||
|
node.cell.style.display = display;
|
||||||
|
node.input.checked = currentValue !== setting.whitelistValue;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
setSelect.addEventListener("change", update);
|
|
||||||
settings.on("any", update);
|
settings.on("any", update);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
@ -7,4 +7,5 @@ body {
|
|||||||
--button-background-image: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.1) 100%);
|
--button-background-image: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.1) 100%);
|
||||||
--stacked-inputs-border-color: rgb(255, 0, 255);
|
--stacked-inputs-border-color: rgb(255, 0, 255);
|
||||||
--stacked-inputs-focus-color: rgb(255, 196, 0);
|
--stacked-inputs-focus-color: rgb(255, 196, 0);
|
||||||
|
--highlight-color: rgb(203, 255, 192);
|
||||||
}
|
}
|
@ -7,4 +7,5 @@ body {
|
|||||||
--button-background-image: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.1) 100%);
|
--button-background-image: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.1) 100%);
|
||||||
--stacked-inputs-border-color: rgb(92, 92, 97);
|
--stacked-inputs-border-color: rgb(92, 92, 97);
|
||||||
--stacked-inputs-focus-color: rgb(92, 92, 97);
|
--stacked-inputs-focus-color: rgb(92, 92, 97);
|
||||||
|
--highlight-color: rgb(26, 92, 24);
|
||||||
}
|
}
|
@ -7,4 +7,5 @@ body {
|
|||||||
--button-background-image: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.1) 100%);
|
--button-background-image: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.1) 100%);
|
||||||
--stacked-inputs-border-color: rgb(185, 185, 185);
|
--stacked-inputs-border-color: rgb(185, 185, 185);
|
||||||
--stacked-inputs-focus-color: rgb(236, 237, 236);
|
--stacked-inputs-focus-color: rgb(236, 237, 236);
|
||||||
|
--highlight-color: rgb(203, 255, 192);;
|
||||||
}
|
}
|
@ -7,4 +7,5 @@ body {
|
|||||||
--button-background-image: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.1) 100%);
|
--button-background-image: linear-gradient(transparent 0%, rgba(0, 0, 0, 0.1) 100%);
|
||||||
--stacked-inputs-border-color: rgb(222, 222, 222);
|
--stacked-inputs-border-color: rgb(222, 222, 222);
|
||||||
--stacked-inputs-focus-color: rgb(240, 240, 240);
|
--stacked-inputs-focus-color: rgb(240, 240, 240);
|
||||||
|
--highlight-color: rgb(203, 255, 192);;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user