1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 12:36:37 +02:00

Simplified translations in inject.js

This commit is contained in:
kkapsner 2015-04-24 01:04:14 +02:00
parent 48e2966d61
commit 7ce54a25c9
3 changed files with 21 additions and 16 deletions

View file

@ -84,11 +84,24 @@
}
var workers = [];
var workerTranslations = {
sourceOutput: _("sourceOutput"),
stackEntryOutput: _("stackEntryOutput")
};
["", "Readout"].forEach(function(type){
["", "Visible", "Invisible"].forEach(function(visibility){
var text = "askFor" + visibility + type + "Permission";
workerTranslations[text] = _(text);
});
});
var workerOptions = {
blockMode: checkURL(),
whiteList: prefs.whiteList,
blackList: prefs.blackList,
askOnce: prefs.askOnce
askOnce: prefs.askOnce,
translations: workerTranslations
};
preferences.on("blockMode", function(){
workerOptions.blockMode = checkURL();
@ -118,14 +131,6 @@
worker.on("detach", function(){
array.remove(workers, this);
});
["", "Readout"].forEach(function(type){
["", "Visible", "Invisible"].forEach(function(visibility){
var text = "askFor" + visibility + type + "Permission";
worker.port.emit("setTranslation", text, _(text));
});
});
worker.port.emit("setTranslation", "sourceOutput", _("sourceOutput"));
worker.port.emit("setTranslation", "stackEntryOutput", _("stackEntryOutput"));
preferencesForInjected.forEach(function(name){
worker.port.emit("set", name, prefs[name]);
@ -160,6 +165,8 @@
accessKey: "",
callback: function(){
browser.contentWindow.alert(callingStackMsg);
// only way to prevent closing... see https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Method/appendNotification#Notification_box_events
throw new Error("Do not close notification.");
}
},
{
@ -194,14 +201,14 @@
];
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
notifyBox.appendNotification(
notification = notifyBox.appendNotification(
message,
"fake-readout",
"chrome://browser/skin/Info.png",
priority,
buttons
);
}
}
}
break;
}