mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
parent
e128cba84a
commit
096db123d7
@ -311,6 +311,15 @@
|
|||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"minColors_title": {
|
||||||
|
"message": "Minimale Anzahl an Farben",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"minColors_description": {
|
||||||
|
"message": "Anzahl der Farben, die ein Canvas aufweisen muss, damit es vorgetäuscht wird. Dies ist ein Parameter, der die Detektion des Addons erschweren soll.\nACHTUNG: Dies kann die Sicherheit des Addons beeinträchtigen. Deswegen wird stark empfohlen, diesen Wert nicht über 10 zu setzen.",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
|
||||||
"fakeAlphaChannel_title": {
|
"fakeAlphaChannel_title": {
|
||||||
"message": "Alpha-Kanal auch vortäuschen",
|
"message": "Alpha-Kanal auch vortäuschen",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
@ -311,6 +311,15 @@
|
|||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"minColors_title": {
|
||||||
|
"message": "Minimal number of colors",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"minColors_description": {
|
||||||
|
"message": "Number of colors that a canvas must have to be faked.\nCAUTION: This can lower the safety of the addon, therefore it is highly recommended not to set this value above 10.",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
|
||||||
"fakeAlphaChannel_title": {
|
"fakeAlphaChannel_title": {
|
||||||
"message": "Fake the alpha channel",
|
"message": "Fake the alpha channel",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
@ -82,4 +82,29 @@
|
|||||||
}
|
}
|
||||||
return statistic;
|
return statistic;
|
||||||
};
|
};
|
||||||
|
scope.hasMoreColors = function hasMoreColors(rawData, threshold, statistic){
|
||||||
|
if (statistic){
|
||||||
|
return statistic.numberOfColors > threshold;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var colors = Object.create(null);
|
||||||
|
var count = 0;
|
||||||
|
for (var i = 0, l = rawData.length; i < l; i += 4){
|
||||||
|
var index = String.fromCharCode(
|
||||||
|
rawData[i + 0],
|
||||||
|
rawData[i + 1],
|
||||||
|
rawData[i + 2],
|
||||||
|
rawData[i + 3]
|
||||||
|
);
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(colors, index)){
|
||||||
|
colors[index] = true;
|
||||||
|
count += 1;
|
||||||
|
if (count > threshold){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count > threshold;
|
||||||
|
}
|
||||||
|
};
|
||||||
}());
|
}());
|
@ -79,10 +79,16 @@
|
|||||||
var l = desc.length;
|
var l = desc.length;
|
||||||
|
|
||||||
var ignoredColors = {};
|
var ignoredColors = {};
|
||||||
|
var statistic;
|
||||||
if (prefs("ignoreFrequentColors")){
|
if (prefs("ignoreFrequentColors")){
|
||||||
var statistic = colorStatistics.compute(source);
|
statistic = colorStatistics.compute(source);
|
||||||
ignoredColors = statistic.getMaxColors(prefs("ignoreFrequentColors"));
|
ignoredColors = statistic.getMaxColors(prefs("ignoreFrequentColors"));
|
||||||
}
|
}
|
||||||
|
if (prefs("minColors")){
|
||||||
|
if (!colorStatistics.hasMoreColors(source, prefs("minColors"), statistic)){
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var rng = randomSupply.getPixelRng(l, window, ignoredColors);
|
var rng = randomSupply.getPixelRng(l, window, ignoredColors);
|
||||||
var fakeAlphaChannel = prefs("fakeAlphaChannel");
|
var fakeAlphaChannel = prefs("fakeAlphaChannel");
|
||||||
|
@ -67,6 +67,10 @@
|
|||||||
name: "ignoreFrequentColors",
|
name: "ignoreFrequentColors",
|
||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "minColors",
|
||||||
|
defaultValue: 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "fakeAlphaChannel",
|
name: "fakeAlphaChannel",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
|
@ -143,6 +143,20 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "minColors",
|
||||||
|
"displayDependencies": [
|
||||||
|
{
|
||||||
|
"blockMode": ["fakeReadout"],
|
||||||
|
"displayAdvancedSettings": [true]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"blockMode": ["askReadout", "ask"],
|
||||||
|
"askDenyMode": ["fake"],
|
||||||
|
"displayAdvancedSettings": [true]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "fakeAlphaChannel",
|
"name": "fakeAlphaChannel",
|
||||||
"displayDependencies": [
|
"displayDependencies": [
|
||||||
|
@ -8,7 +8,8 @@ Version 0.4.3:
|
|||||||
new features:
|
new features:
|
||||||
- reset settings
|
- reset settings
|
||||||
- new white random generator - creates output similar to Tor browser
|
- new white random generator - creates output similar to Tor browser
|
||||||
- blockMode and showNotifications can now be chosen url specific
|
- blockMode and showNotifications can now be chosen url specific
|
||||||
|
- new setting to ignore canvas with only few colors
|
||||||
|
|
||||||
fixes:
|
fixes:
|
||||||
- page action was not always showing
|
- page action was not always showing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user