mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Moved i18n to extension module
This commit is contained in:
parent
d89bfe4cb0
commit
bab7d1496f
@ -7,8 +7,8 @@ const util = require("util");
|
||||
function getMessagesInContent(content){
|
||||
const foundMessages = [];
|
||||
[
|
||||
/\b(?:_|browser.i18n.getMessage|notify)\(["']([^"']+)["']\s*(?:\)|,)/g,
|
||||
/\b(?:messageId|name)\s*:\s*["']([^"']+)["']/g,
|
||||
/\b(?:_|browser.i18n.getMessage|notify|extension)\(["']([^"']+)["']\s*(?:\)|,)/g,
|
||||
/\b(?:messageId|name|getTranslation)\s*:\s*["']([^"']+)["']/g,
|
||||
].forEach(function(re){
|
||||
let match;
|
||||
while ((match = re.exec(content)) !== null){
|
||||
|
@ -8,6 +8,7 @@
|
||||
<body>
|
||||
<div id="actions"></div>
|
||||
<script src="../lib/require.js"></script>
|
||||
<script src="../lib/extension.js"></script>
|
||||
<script src="../lib/logging.js"></script>
|
||||
<script src="../lib/settingDefinitions.js"></script>
|
||||
<script src="../lib/settingContainers.js"></script>
|
||||
|
@ -4,6 +4,7 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const logging = require("../lib/logging");
|
||||
const settings = require("../lib/settings");
|
||||
logging.message("Opened browser action");
|
||||
@ -73,7 +74,7 @@
|
||||
|
||||
actionButton.appendChild(
|
||||
document.createTextNode(
|
||||
browser.i18n.getMessage("browserAction_" + action.label) || action.label
|
||||
extension.getTranslation("browserAction_" + action.label) || action.label
|
||||
)
|
||||
);
|
||||
actionButton.addEventListener("click", action.action);
|
||||
@ -81,7 +82,7 @@
|
||||
});
|
||||
|
||||
var search = document.createElement("input");
|
||||
search.placeholder = browser.i18n.getMessage("search");
|
||||
search.placeholder = extension.getTranslation("search");
|
||||
search.className = "search action";
|
||||
actions.appendChild(search);
|
||||
search.focus();
|
||||
|
@ -12,6 +12,7 @@
|
||||
scope = require.register("./notification", {});
|
||||
}
|
||||
|
||||
const extension = require("./extension");
|
||||
const settings = require("./settings");
|
||||
const lists = require("./lists");
|
||||
const logging = require("./logging");
|
||||
@ -109,15 +110,15 @@
|
||||
|
||||
let apiList = "";
|
||||
apis.forEach(function(api){
|
||||
apiList += browser.i18n.getMessage("browserAction_title_protectedAPIs").replace(/{api}/g, api);
|
||||
apiList += extension.getTranslation("browserAction_title_protectedAPIs").replace(/{api}/g, api);
|
||||
});
|
||||
|
||||
let browserActionTitle = browser.i18n.getMessage("browserAction_title_default");
|
||||
let browserActionTitle = extension.getTranslation("browserAction_title_default");
|
||||
if (tabData.whitelisted){
|
||||
browserActionTitle += browser.i18n.getMessage("browserAction_title_whitelisted")
|
||||
browserActionTitle += extension.getTranslation("browserAction_title_whitelisted")
|
||||
.replace(/{url}/g, tabData.url);
|
||||
}
|
||||
browserActionTitle += browser.i18n.getMessage("browserAction_title_notified");
|
||||
browserActionTitle += extension.getTranslation("browserAction_title_notified");
|
||||
browserActionTitle += apiList;
|
||||
browser.browserAction.setTitle({
|
||||
tabId: tabId,
|
||||
@ -152,9 +153,9 @@
|
||||
text: ""
|
||||
});
|
||||
}
|
||||
let browserActionTitle = browser.i18n.getMessage("browserAction_title_default");
|
||||
let browserActionTitle = extension.getTranslation("browserAction_title_default");
|
||||
if (tabData.whitelisted){
|
||||
browserActionTitle += browser.i18n.getMessage("browserAction_title_whitelisted").replace(/{url}/g, url);
|
||||
browserActionTitle += extension.getTranslation("browserAction_title_whitelisted").replace(/{url}/g, url);
|
||||
}
|
||||
browser.browserAction.setTitle({
|
||||
tabId: tabId,
|
||||
|
@ -12,6 +12,7 @@
|
||||
scope = require.register("./search", {});
|
||||
}
|
||||
|
||||
const extension = require("./extension");
|
||||
const texts = [];
|
||||
|
||||
scope.register = function(text, content){
|
||||
@ -52,7 +53,7 @@
|
||||
scope.init = function(){
|
||||
const node = document.createElement("input");
|
||||
node.id = "search";
|
||||
node.placeholder = browser.i18n.getMessage("search");
|
||||
node.placeholder = extension.getTranslation("search");
|
||||
window.setTimeout(() => node.focus(), 1);
|
||||
let lastResults = [];
|
||||
node.addEventListener("input", function(){
|
||||
|
@ -12,6 +12,8 @@
|
||||
scope = require.register("./settingStrings", {});
|
||||
}
|
||||
|
||||
const extension = require("./extension");
|
||||
|
||||
scope.getMessages = function(settingDefinition){
|
||||
const messages = [];
|
||||
if (settingDefinition){
|
||||
@ -68,7 +70,7 @@
|
||||
}
|
||||
|
||||
scope.getMessages(settingDefinition).forEach(function(message){
|
||||
addString(browser.i18n.getMessage(message));
|
||||
addString(extension.getTranslation(message));
|
||||
});
|
||||
|
||||
return strings;
|
||||
|
@ -8,6 +8,7 @@
|
||||
<body>
|
||||
<textarea id="settings"></textarea>
|
||||
<script src="../lib/require.js"></script>
|
||||
<script src="../lib/extension.js"></script>
|
||||
<script src="../lib/logging.js"></script>
|
||||
<script src="../lib/settingDefinitions.js"></script>
|
||||
<script src="../lib/settingContainers.js"></script>
|
||||
|
@ -7,6 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="../lib/require.js"></script>
|
||||
<script src="../lib/extension.js"></script>
|
||||
<script src="../lib/logging.js"></script>
|
||||
<script src="../lib/settingDefinitions.js"></script>
|
||||
<script src="../lib/settingContainers.js"></script>
|
||||
|
@ -4,19 +4,20 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const settings = require("../lib/settings");
|
||||
const navigator = require("../lib/navigator");
|
||||
|
||||
const title = document.createElement("h1");
|
||||
title.className = "title";
|
||||
title.textContent = browser.i18n.getMessage("navigatorSettings_title");
|
||||
title.textContent = extension.getTranslation("navigatorSettings_title");
|
||||
document.body.appendChild(title);
|
||||
|
||||
document.querySelector("head title").textContent = title.textContent;
|
||||
|
||||
const description = document.createElement("div");
|
||||
description.className = "description";
|
||||
description.textContent = browser.i18n.getMessage("navigatorSettings_description");
|
||||
description.textContent = extension.getTranslation("navigatorSettings_description");
|
||||
document.body.appendChild(description);
|
||||
|
||||
function presetSection(title, presets){
|
||||
@ -25,7 +26,7 @@
|
||||
|
||||
const titleNode = document.createElement("h2");
|
||||
titleNode.className = "title";
|
||||
titleNode.textContent = browser.i18n.getMessage("navigatorSettings_presetSection." + title);
|
||||
titleNode.textContent = extension.getTranslation("navigatorSettings_presetSection." + title);
|
||||
container.appendChild(titleNode);
|
||||
|
||||
const presetsList = document.createElement("ul");
|
||||
@ -171,7 +172,7 @@
|
||||
document.body.appendChild(presetSection("browser", browserPresets));
|
||||
|
||||
const valueTitle = document.createElement("h2");
|
||||
valueTitle.textContent = browser.i18n.getMessage("navigatorSettings_values");
|
||||
valueTitle.textContent = extension.getTranslation("navigatorSettings_values");
|
||||
document.body.appendChild(valueTitle);
|
||||
|
||||
const valueSection = document.createElement("table");
|
||||
@ -229,7 +230,7 @@
|
||||
|
||||
const resetButton = document.createElement("button");
|
||||
resetButton.className = "button";
|
||||
resetButton.textContent = browser.i18n.getMessage("navigatorSettings_reset");
|
||||
resetButton.textContent = extension.getTranslation("navigatorSettings_reset");
|
||||
resetButton.addEventListener("click", function(){
|
||||
settings.navigatorDetails = {};
|
||||
});
|
||||
|
@ -7,6 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="../lib/require.js"></script>
|
||||
<script src="../lib/extension.js"></script>
|
||||
<script src="../lib/logging.js"></script>
|
||||
<script src="../lib/settingDefinitions.js"></script>
|
||||
<script src="../lib/settingContainers.js"></script>
|
||||
|
@ -3,7 +3,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const logging = require("../lib/logging");
|
||||
logging.setPrefix("options page");
|
||||
|
||||
@ -101,7 +102,7 @@
|
||||
});
|
||||
},
|
||||
resetSettings: function(){
|
||||
if (window.confirm(browser.i18n.getMessage("resetSettings_confirm"))){
|
||||
if (window.confirm(extension.getTranslation("resetSettings_confirm"))){
|
||||
browser.storage.local.clear();
|
||||
}
|
||||
}
|
||||
@ -119,22 +120,22 @@
|
||||
}).then(function(tabId){
|
||||
return browser.tabs.get(tabId);
|
||||
}).then(function(tab){
|
||||
document.querySelector("head title").textContent = browser.i18n.getMessage("options_title");
|
||||
document.querySelector("head title").textContent = extension.getTranslation("options_title");
|
||||
let head = document.createElement("header");
|
||||
document.body.insertBefore(head, document.body.firstChild);
|
||||
|
||||
if (tab.url === window.location.href){
|
||||
let heading = document.createElement("h1");
|
||||
heading.textContent = browser.i18n.getMessage("options");
|
||||
heading.textContent = extension.getTranslation("options");
|
||||
head.appendChild(heading);
|
||||
|
||||
let introduction = document.createElement("div");
|
||||
introduction.textContent = browser.i18n.getMessage("optionsIntroduction");
|
||||
introduction.textContent = extension.getTranslation("optionsIntroduction");
|
||||
head.appendChild(introduction);
|
||||
|
||||
if (searchParameters.has("notice")){
|
||||
let noticeName = searchParameters.get("notice") + "Notice";
|
||||
let notice = browser.i18n.getMessage(noticeName);
|
||||
let notice = extension.getTranslation(noticeName);
|
||||
if (notice){
|
||||
let bookmarkingNotice = document.createElement("div");
|
||||
bookmarkingNotice.className = noticeName + " bookmarkNotice";
|
||||
@ -153,7 +154,7 @@
|
||||
dontShowAgain.appendChild(dontShowAgainInput);
|
||||
dontShowAgain.appendChild(
|
||||
document.createTextNode(
|
||||
browser.i18n.getMessage("dontShowOptionsOnUpdate")
|
||||
extension.getTranslation("dontShowOptionsOnUpdate")
|
||||
)
|
||||
);
|
||||
bookmarkingNotice.appendChild(dontShowAgain);
|
||||
@ -174,7 +175,7 @@
|
||||
const link = document.createElement("a");
|
||||
link.href = window.location.href;
|
||||
link.target = "_blank";
|
||||
link.textContent = browser.i18n.getMessage("openInTab");
|
||||
link.textContent = extension.getTranslation("openInTab");
|
||||
linkDiv.appendChild(link);
|
||||
head.appendChild(linkDiv);
|
||||
}
|
||||
@ -227,7 +228,7 @@
|
||||
cell.colSpan = 3;
|
||||
row.appendChild(cell);
|
||||
let heading = document.createElement("h2");
|
||||
heading.textContent = browser.i18n.getMessage("section_" + name);
|
||||
heading.textContent = extension.getTranslation("section_" + name);
|
||||
cell.appendChild(heading);
|
||||
body.appendChild(row);
|
||||
}
|
||||
@ -441,7 +442,7 @@
|
||||
matching.length === 0 ||
|
||||
matching[0].protectWindow
|
||||
) &&
|
||||
window.confirm(browser.i18n.getMessage("protectWindow_askReCaptchaException"))
|
||||
window.confirm(extension.getTranslation("protectWindow_askReCaptchaException"))
|
||||
){
|
||||
settings.set("protectWindow", false, reCaptchaEntry);
|
||||
}
|
||||
@ -449,7 +450,7 @@
|
||||
});
|
||||
beforeChangeEventListeners.sharePersistentRndBetweenDomains.push(function(value){
|
||||
if (value){
|
||||
if (!confirm(browser.i18n.getMessage("sharePersistentRndBetweenDomains_confirmMessage"))){
|
||||
if (!confirm(extension.getTranslation("sharePersistentRndBetweenDomains_confirmMessage"))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
else {
|
||||
scope = require.register("./optionsGui", {});
|
||||
}
|
||||
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const logging = require("../lib/logging");
|
||||
|
||||
function createDescription(setting){
|
||||
@ -20,12 +21,12 @@
|
||||
|
||||
var title = document.createElement("span");
|
||||
title.className = "title";
|
||||
title.textContent = browser.i18n.getMessage(setting.name + "_title");
|
||||
title.textContent = extension.getTranslation(setting.name + "_title");
|
||||
c.appendChild(title);
|
||||
|
||||
var descriptionText = browser.i18n.getMessage(setting.name + "_description");
|
||||
var descriptionText = extension.getTranslation(setting.name + "_description");
|
||||
if (setting.urlSpecific){
|
||||
const urlSpecificDescription = browser.i18n.getMessage(setting.name + "_urlSpecific");
|
||||
const urlSpecificDescription = extension.getTranslation(setting.name + "_urlSpecific");
|
||||
if (urlSpecificDescription){
|
||||
descriptionText += (descriptionText? "\n\n": "") + urlSpecificDescription;
|
||||
}
|
||||
@ -53,7 +54,7 @@
|
||||
if (setting.defaultValue === value){
|
||||
option.selected = true;
|
||||
}
|
||||
option.text = browser.i18n.getMessage(setting.name + "_options." + value) || value;
|
||||
option.text = extension.getTranslation(setting.name + "_options." + value) || value;
|
||||
}
|
||||
else {
|
||||
option.disabled = true;
|
||||
@ -156,7 +157,7 @@
|
||||
let cell = document.createElement("td");
|
||||
cell.colSpan = 2;
|
||||
let h = document.createElement("h" + (2 + (key.level || 1)));
|
||||
h.textContent = key.message? browser.i18n.getMessage(key.message): key.name;
|
||||
h.textContent = key.message? extension.getTranslation(key.message): key.name;
|
||||
cell.appendChild(h);
|
||||
row.appendChild(cell);
|
||||
input.appendChild(row);
|
||||
@ -227,7 +228,7 @@
|
||||
});
|
||||
let urlTable = document.createElement("table");
|
||||
let caption = document.createElement("caption");
|
||||
caption.textContent = browser.i18n.getMessage(setting.urlContainer.name + "_title");
|
||||
caption.textContent = extension.getTranslation(setting.urlContainer.name + "_title");
|
||||
urlTable.appendChild(caption);
|
||||
let body = document.createElement("tbody");
|
||||
urlTable.appendChild(body);
|
||||
@ -236,7 +237,7 @@
|
||||
let footCell = document.createElement("td");
|
||||
footCell.colSpan = 3;
|
||||
let newInput = document.createElement("input");
|
||||
newInput.title = browser.i18n.getMessage("inputURL");
|
||||
newInput.title = extension.getTranslation("inputURL");
|
||||
const addURLSetting = function(){
|
||||
var url = newInput.value.trim();
|
||||
if (url){
|
||||
@ -274,7 +275,7 @@
|
||||
input.style.height = urlCell.clientHeight + "px";
|
||||
urlCell.innerHTML = "";
|
||||
urlCell.appendChild(input);
|
||||
input.title = browser.i18n.getMessage("inputURL");
|
||||
input.title = extension.getTranslation("inputURL");
|
||||
input.value = entry.url;
|
||||
input.focus();
|
||||
input.addEventListener("blur", function(){
|
||||
@ -316,7 +317,7 @@
|
||||
|
||||
function createButton(setting){
|
||||
var button = document.createElement("button");
|
||||
button.textContent = browser.i18n.getMessage(setting.name + "_label");
|
||||
button.textContent = extension.getTranslation(setting.name + "_label");
|
||||
button.addEventListener("click", setting.action);
|
||||
return button;
|
||||
}
|
||||
@ -359,7 +360,7 @@
|
||||
function createHide(setting){
|
||||
var label = document.createElement("label");
|
||||
label.className = "content hideContent";
|
||||
label.title = browser.i18n.getMessage("hideSetting");
|
||||
label.title = extension.getTranslation("hideSetting");
|
||||
var input = document.createElement("input");
|
||||
input.type = "checkbox";
|
||||
input.className = "hide";
|
||||
@ -405,7 +406,7 @@
|
||||
const headRow = document.createElement("tr");
|
||||
const hideHeadCell = document.createElement("td");
|
||||
hideHeadCell.className = "hideColumn";
|
||||
hideHeadCell.title = browser.i18n.getMessage(displayHidden.name + "_description");
|
||||
hideHeadCell.title = extension.getTranslation(displayHidden.name + "_description");
|
||||
const label = document.createElement("label");
|
||||
label.className = "hideContent";
|
||||
const input = createInput(displayHidden);
|
||||
|
@ -12,6 +12,7 @@
|
||||
scope = require.register("./sanitationRules", {});
|
||||
}
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const settings = require("../lib/settings");
|
||||
|
||||
scope.ruleset = [
|
||||
@ -20,11 +21,11 @@
|
||||
check: function(errorCallback){
|
||||
const {url: urlContainer} = settings.getContainers();
|
||||
const containerValue = urlContainer.get();
|
||||
const errorMessage = browser.i18n.getMessage("sanitation_error.unnecessaryURLValue");
|
||||
const errorMessage = extension.getTranslation("sanitation_error.unnecessaryURLValue");
|
||||
function createErrorMessage(setting, urlValue){
|
||||
return errorMessage
|
||||
.replace(/{setting-technical}/g, setting.name)
|
||||
.replace(/{setting-title}/g, browser.i18n.getMessage(setting.name + "_title"))
|
||||
.replace(/{setting-title}/g, extension.getTranslation(setting.name + "_title"))
|
||||
.replace(/{url}/g, urlValue.url);
|
||||
}
|
||||
containerValue.forEach(function(urlValues){
|
||||
@ -39,7 +40,7 @@
|
||||
message: createErrorMessage(setting, urlValues),
|
||||
severity: "low",
|
||||
resolutions: [{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.removeURLValue"),
|
||||
label: extension.getTranslation("sanitation_resolution.removeURLValue"),
|
||||
callback: function(){
|
||||
setting.reset(urlValues.url);
|
||||
}
|
||||
@ -54,9 +55,9 @@
|
||||
{
|
||||
name: "disabledFeatures",
|
||||
check: function(errorCallback){
|
||||
const errorMessage = browser.i18n.getMessage("sanitation_error.disabledFeatures");
|
||||
const errorMessage = extension.getTranslation("sanitation_error.disabledFeatures");
|
||||
function createErrorMessage(api){
|
||||
return errorMessage.replace(/{api}/g, browser.i18n.getMessage("section_" + api.section));
|
||||
return errorMessage.replace(/{api}/g, extension.getTranslation("section_" + api.section));
|
||||
}
|
||||
const protectedFeatures = settings.getDefinition("protectedAPIFeatures");
|
||||
const protectedFeaturesValue = protectedFeatures.get();
|
||||
@ -91,7 +92,7 @@
|
||||
severity: "high",
|
||||
resolutions: [
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.enableFeatures"),
|
||||
label: extension.getTranslation("sanitation_resolution.enableFeatures"),
|
||||
callback: function(){
|
||||
const protectedFeaturesValue = protectedFeatures.get();
|
||||
getSectionKeys(api.section).forEach(function(key){
|
||||
@ -101,7 +102,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.disableMainFlag"),
|
||||
label: extension.getTranslation("sanitation_resolution.disableMainFlag"),
|
||||
callback: function(){
|
||||
settings.set(api.mainFlag, false);
|
||||
}
|
||||
@ -120,10 +121,10 @@
|
||||
const protectedCanvasPart = settings.protectedCanvasPart;
|
||||
if (!blockMode.match("^fake|^ask")){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.badBlockMode"),
|
||||
message: extension.getTranslation("sanitation_error.badBlockMode"),
|
||||
severity: "medium",
|
||||
resolutions: [{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.switchToFake"),
|
||||
label: extension.getTranslation("sanitation_resolution.switchToFake"),
|
||||
callback: function(){
|
||||
settings.blockMode = "fake";
|
||||
}
|
||||
@ -132,22 +133,22 @@
|
||||
}
|
||||
if (blockMode === "fake" && protectedCanvasPart === "input" && settings.rng === "white"){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.fakeInputWithWhiteRng")
|
||||
.replace(/{blockMode}/g, browser.i18n.getMessage("blockMode_options." + blockMode))
|
||||
message: extension.getTranslation("sanitation_error.fakeInputWithWhiteRng")
|
||||
.replace(/{blockMode}/g, extension.getTranslation("blockMode_options." + blockMode))
|
||||
.replace(
|
||||
/{protectedCanvasPart}/g,
|
||||
browser.i18n.getMessage("protectedCanvasPart_options." + settings.protectedCanvasPart)
|
||||
extension.getTranslation("protectedCanvasPart_options." + settings.protectedCanvasPart)
|
||||
),
|
||||
severity: "low",
|
||||
resolutions: [
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.switchToProtectReadout"),
|
||||
label: extension.getTranslation("sanitation_resolution.switchToProtectReadout"),
|
||||
callback: function(){
|
||||
settings.protectedCanvasPart = "readout";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.switchToNonPersistentRng"),
|
||||
label: extension.getTranslation("sanitation_resolution.switchToNonPersistentRng"),
|
||||
callback: function(){
|
||||
settings.rng = "nonPersistent";
|
||||
}
|
||||
@ -157,22 +158,22 @@
|
||||
}
|
||||
if (blockMode === "fake" && protectedCanvasPart === "everything"){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.fakeEverythingInCanvas")
|
||||
.replace(/{blockMode}/g, browser.i18n.getMessage("blockMode_options." + blockMode))
|
||||
message: extension.getTranslation("sanitation_error.fakeEverythingInCanvas")
|
||||
.replace(/{blockMode}/g, extension.getTranslation("blockMode_options." + blockMode))
|
||||
.replace(
|
||||
/{protectedCanvasPart}/g,
|
||||
browser.i18n.getMessage("protectedCanvasPart_options." + settings.protectedCanvasPart)
|
||||
extension.getTranslation("protectedCanvasPart_options." + settings.protectedCanvasPart)
|
||||
),
|
||||
severity: "low",
|
||||
resolutions: [
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.switchToProtectReadout"),
|
||||
label: extension.getTranslation("sanitation_resolution.switchToProtectReadout"),
|
||||
callback: function(){
|
||||
settings.protectedCanvasPart = "readout";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.switchToProtectInput"),
|
||||
label: extension.getTranslation("sanitation_resolution.switchToProtectInput"),
|
||||
callback: function(){
|
||||
settings.protectedCanvasPart = "input";
|
||||
}
|
||||
@ -185,13 +186,13 @@
|
||||
{
|
||||
name: "thresholds",
|
||||
check: function(errorCallback){
|
||||
const setToLabel = browser.i18n.getMessage("sanitation_resolution.setTo");
|
||||
const tooLowLabel = browser.i18n.getMessage("sanitation_error.valueTooLow");
|
||||
const tooHighLabel = browser.i18n.getMessage("sanitation_error.valueTooHigh");
|
||||
const setToLabel = extension.getTranslation("sanitation_resolution.setTo");
|
||||
const tooLowLabel = extension.getTranslation("sanitation_error.valueTooLow");
|
||||
const tooHighLabel = extension.getTranslation("sanitation_error.valueTooHigh");
|
||||
if (settings.minFakeSize > 1e2){
|
||||
errorCallback({
|
||||
message: tooHighLabel
|
||||
.replace(/{setting}/g, browser.i18n.getMessage("minFakeSize_title"))
|
||||
.replace(/{setting}/g, extension.getTranslation("minFakeSize_title"))
|
||||
.replace(/{value}/g, "100"),
|
||||
severity: "high",
|
||||
resolutions: [{
|
||||
@ -205,7 +206,7 @@
|
||||
if (settings.maxFakeSize !== 0 && settings.maxFakeSize < 1e6){
|
||||
errorCallback({
|
||||
message: tooLowLabel
|
||||
.replace(/{setting}/g, browser.i18n.getMessage("maxFakeSize_title"))
|
||||
.replace(/{setting}/g, extension.getTranslation("maxFakeSize_title"))
|
||||
.replace(/{value}/g, "1 000 000"),
|
||||
severity: "high",
|
||||
resolutions: [{
|
||||
@ -219,7 +220,7 @@
|
||||
if (settings.ignoreFrequentColors > 3){
|
||||
errorCallback({
|
||||
message: tooHighLabel
|
||||
.replace(/{setting}/g, browser.i18n.getMessage("ignoreFrequentColors_title"))
|
||||
.replace(/{setting}/g, extension.getTranslation("ignoreFrequentColors_title"))
|
||||
.replace(/{value}/g, "3"),
|
||||
severity: "high",
|
||||
resolutions: [{
|
||||
@ -233,7 +234,7 @@
|
||||
if (settings.minColors > 10){
|
||||
errorCallback({
|
||||
message: tooHighLabel
|
||||
.replace(/{setting}/g, browser.i18n.getMessage("minColors_title"))
|
||||
.replace(/{setting}/g, extension.getTranslation("minColors_title"))
|
||||
.replace(/{value}/g, "10"),
|
||||
severity: "high",
|
||||
resolutions: [{
|
||||
@ -249,14 +250,14 @@
|
||||
{
|
||||
name: "performance",
|
||||
check: function(errorCallback){
|
||||
const disableLabel = browser.i18n.getMessage("sanitation_resolution.disableFlag");
|
||||
const disableLabel = extension.getTranslation("sanitation_resolution.disableFlag");
|
||||
if (settings.storeNotificationData){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.storeNotificationData"),
|
||||
message: extension.getTranslation("sanitation_error.storeNotificationData"),
|
||||
severity: "low",
|
||||
resolutions: [{
|
||||
label: disableLabel
|
||||
.replace(/{flag}/g, browser.i18n.getMessage("storeNotificationData_title")),
|
||||
.replace(/{flag}/g, extension.getTranslation("storeNotificationData_title")),
|
||||
callback: function(){
|
||||
settings.storeNotificationData = false;
|
||||
}
|
||||
@ -264,11 +265,11 @@
|
||||
});
|
||||
if (settings.storeImageForInspection){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.storeImage"),
|
||||
message: extension.getTranslation("sanitation_error.storeImage"),
|
||||
severity: "low",
|
||||
resolutions: [{
|
||||
label: disableLabel
|
||||
.replace(/{flag}/g, browser.i18n.getMessage("storeImageForInspection_title")),
|
||||
.replace(/{flag}/g, extension.getTranslation("storeImageForInspection_title")),
|
||||
callback: function(){
|
||||
settings.storeImageForInspection = false;
|
||||
}
|
||||
@ -283,11 +284,11 @@
|
||||
check: function(errorCallback){
|
||||
if (settings.sharePersistentRndBetweenDomains){
|
||||
errorCallback({
|
||||
message: browser.i18n.getMessage("sanitation_error.doNotSharePersistentRndBetweenDomains"),
|
||||
message: extension.getTranslation("sanitation_error.doNotSharePersistentRndBetweenDomains"),
|
||||
severity: "high",
|
||||
resolutions: [{
|
||||
label: browser.i18n.getMessage("sanitation_resolution.disableFlag")
|
||||
.replace(/{flag}/g, browser.i18n.getMessage("sharePersistentRndBetweenDomains_title")),
|
||||
label: extension.getTranslation("sanitation_resolution.disableFlag")
|
||||
.replace(/{flag}/g, extension.getTranslation("sharePersistentRndBetweenDomains_title")),
|
||||
callback: function(){
|
||||
settings.sharePersistentRndBetweenDomains = false;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="../lib/require.js"></script>
|
||||
<script src="../lib/extension.js"></script>
|
||||
<script src="../lib/logging.js"></script>
|
||||
<script src="../lib/settingDefinitions.js"></script>
|
||||
<script src="../lib/settingContainers.js"></script>
|
||||
|
@ -4,24 +4,25 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const settings = require("../lib/settings");
|
||||
const sanitationRules = require("./sanitationRules");
|
||||
|
||||
var title = document.createElement("h1");
|
||||
title.className = "title";
|
||||
title.textContent = browser.i18n.getMessage("sanitation_title");
|
||||
title.textContent = extension.getTranslation("sanitation_title");
|
||||
document.body.appendChild(title);
|
||||
|
||||
var description = document.createElement("div");
|
||||
description.className = "description";
|
||||
description.textContent = browser.i18n.getMessage("sanitation_description");
|
||||
description.textContent = extension.getTranslation("sanitation_description");
|
||||
document.body.appendChild(description);
|
||||
|
||||
settings.onloaded(function(){
|
||||
const list = document.createElement("ul");
|
||||
sanitationRules.ruleset.forEach(function(ruleset){
|
||||
const rulesetContainer = document.createElement("li");
|
||||
rulesetContainer.textContent = browser.i18n.getMessage("sanitation_ruleset." + ruleset.name);
|
||||
rulesetContainer.textContent = extension.getTranslation("sanitation_ruleset." + ruleset.name);
|
||||
|
||||
const rulesetErrors = document.createElement("ul");
|
||||
let anyComplaint = false;
|
||||
@ -48,7 +49,7 @@
|
||||
if (!anyComplaint){
|
||||
const noComplaints = document.createElement("li");
|
||||
noComplaints.className = "noComplaints";
|
||||
noComplaints.textContent = browser.i18n.getMessage("sanitation_nothingToComplain");
|
||||
noComplaints.textContent = extension.getTranslation("sanitation_nothingToComplain");
|
||||
rulesetErrors.appendChild(noComplaints);
|
||||
}
|
||||
rulesetContainer.appendChild(rulesetErrors);
|
||||
|
@ -47,7 +47,7 @@
|
||||
actions.forEach(function(action, i){
|
||||
var button = document.createElement("button");
|
||||
button.className = action.name + " action";
|
||||
button.title = browser.i18n.getMessage(action.name);
|
||||
button.title = extension.getTranslation(action.name);
|
||||
if (action.isIcon || action.icon){
|
||||
button.classList.add("isIcon");
|
||||
var img = document.createElement("img");
|
||||
|
@ -4,6 +4,7 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
const extension = require("../lib/extension");
|
||||
const settings = require("../lib/settings");
|
||||
const {parseErrorStack} = require("../lib/callingStack");
|
||||
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("../lib/logging");
|
||||
@ -102,8 +103,8 @@
|
||||
domainOrUrlPicker(
|
||||
domain,
|
||||
urls,
|
||||
browser.i18n.getMessage("selectIgnore"),
|
||||
browser.i18n.getMessage("inputIgnoreURL")
|
||||
extension.getTranslation("selectIgnore"),
|
||||
extension.getTranslation("inputIgnoreURL")
|
||||
).then(function(choice){
|
||||
if (choice){
|
||||
settings.set("showNotifications", false, choice).then(function(){
|
||||
@ -123,8 +124,8 @@
|
||||
domainOrUrlPicker(
|
||||
domain,
|
||||
urls,
|
||||
browser.i18n.getMessage("selectWhitelist"),
|
||||
browser.i18n.getMessage("inputWhitelistURL")
|
||||
extension.getTranslation("selectWhitelist"),
|
||||
extension.getTranslation("inputWhitelistURL")
|
||||
).then(function(choice){
|
||||
if (choice){
|
||||
settings.set("blockMode", "allow", choice).then(function(){
|
||||
@ -144,8 +145,8 @@
|
||||
domainOrUrlPicker(
|
||||
domain,
|
||||
urls,
|
||||
browser.i18n.getMessage("selectSessionWhitelist"),
|
||||
browser.i18n.getMessage("inputSessionWhitelistURL")
|
||||
extension.getTranslation("selectSessionWhitelist"),
|
||||
extension.getTranslation("inputSessionWhitelistURL")
|
||||
).then(function(choice){
|
||||
if (choice){
|
||||
lists.appendTo("sessionWhite", choice).then(function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user