mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-18 09:28:52 +01:00
Added ignore list.
This commit is contained in:
parent
af47ee8d87
commit
475c28483f
118
lib/main.js
118
lib/main.js
@ -41,6 +41,15 @@
|
||||
updateBlackList();
|
||||
});
|
||||
|
||||
var ignoreList;
|
||||
function updateIgnoreList(){
|
||||
ignoreList = getDomainRegExpList(prefs.ignoreList);
|
||||
}
|
||||
updateIgnoreList();
|
||||
preferences.on("ignoreList", function(){
|
||||
updateIgnoreList();
|
||||
});
|
||||
|
||||
// preferences for injected file
|
||||
var preferencesForInjected = ["showCallingFile", "showCompleteCallingStack"];
|
||||
preferencesForInjected.forEach(function(name){
|
||||
@ -130,58 +139,69 @@
|
||||
case "fake":
|
||||
|
||||
var contentURL = new URL(worker.contentURL);
|
||||
var url = contentURL.href;
|
||||
var domain = contentURL.hostname;
|
||||
var message = _("fakedReadout").replace(/\{url\}/g, url);
|
||||
if (!ignoreList.match(contentURL)){
|
||||
var url = contentURL.href;
|
||||
var domain = contentURL.hostname;
|
||||
var message = _("fakedReadout").replace(/\{url\}/g, url);
|
||||
|
||||
var tab = tabUtils.getTabForId(worker.tab.id);
|
||||
var tabBrowser = tabUtils.getTabBrowserForTab(tab);
|
||||
var browser = tabUtils.getBrowserForTab(tab);
|
||||
var tab = tabUtils.getTabForId(worker.tab.id);
|
||||
var tabBrowser = tabUtils.getTabBrowserForTab(tab);
|
||||
var browser = tabUtils.getBrowserForTab(tab);
|
||||
|
||||
var notifyBox = tabBrowser.getNotificationBox(browser);
|
||||
var notification = notifyBox.getNotificationWithValue("fake-readout");
|
||||
if (notification){
|
||||
notification.label = message;
|
||||
var notifyBox = tabBrowser.getNotificationBox(browser);
|
||||
var notification = notifyBox.getNotificationWithValue("fake-readout");
|
||||
if (notification){
|
||||
notification.label = message;
|
||||
}
|
||||
else {
|
||||
var buttons = [
|
||||
{
|
||||
label: _("displayCallingStack"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
browser.contentWindow.alert(callingStackMsg);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: _("ignorelistDomain"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
prefs.ignoreList += "," + domain;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.ignoreList", prefs.ignoreList);
|
||||
updateIgnoreList();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: _("whitelistURL"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
prefs.whiteList += "," + url;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.whiteList", prefs.whiteList);
|
||||
updateWhiteList();
|
||||
workers.forEach(checkWorker);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: _("whitelistDomain"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
prefs.whiteList += "," + domain;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.whiteList", prefs.whiteList);
|
||||
updateWhiteList();
|
||||
workers.forEach(checkWorker);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
|
||||
notifyBox.appendNotification(
|
||||
message,
|
||||
"fake-readout",
|
||||
"chrome://browser/skin/Info.png",
|
||||
priority,
|
||||
buttons
|
||||
);
|
||||
}
|
||||
else {
|
||||
var buttons = [
|
||||
{
|
||||
label: _("displayCallingStack"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
browser.contentWindow.alert(callingStackMsg);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: _("whitelistURL"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
prefs.whiteList += "," + url;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.whiteList", prefs.whiteList);
|
||||
updateWhiteList();
|
||||
workers.forEach(checkWorker);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: _("whitelistDomain"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
prefs.whiteList += "," + domain;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.whiteList", prefs.whiteList);
|
||||
updateWhiteList();
|
||||
workers.forEach(checkWorker);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
|
||||
notifyBox.appendNotification(
|
||||
message,
|
||||
"fake-readout",
|
||||
"chrome://browser/skin/Info.png",
|
||||
priority,
|
||||
buttons
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ whiteList_description= Domänen oder URLs, die die <canvas>-API verwenden dürfe
|
||||
blackList_title= Blacklist
|
||||
blackList_description= Domänen oder URLs, die die <canvas>-API niemals verwenden dürfen. Mehrere Einträge müssen durch ein Komma getrennt weren.
|
||||
|
||||
ignoreList_title= Ignorierliste
|
||||
ignoreList_description= Domänen oder URLs, bei denen keine Benachrichtgung angezeigt werden. Mehrere Einträge müssen durch ein Komma getrennt weren.
|
||||
|
||||
blockMode_title= Blockiermodus
|
||||
blockMode_description=
|
||||
|
||||
@ -43,3 +46,6 @@ settings = Einstellungen
|
||||
displayCallingStack = Aufrufestack anzeigen
|
||||
whitelistURL = erlaube URL
|
||||
whitelistDomain = erlaube Domain
|
||||
|
||||
ignorelistURL = ignoriere URL
|
||||
ignorelistDomain = ignoriere Domain
|
@ -4,6 +4,9 @@ whiteList_description= Domains or URLs where the <canvas>-API should not be bloc
|
||||
blackList_title= Black list
|
||||
blackList_description= Domains or URLs where the <canvas>-API should always be blocked. To add multiple entries seperate them by comma.
|
||||
|
||||
ignoreList_title= Ignore list
|
||||
ignoreList_description= Domains or URLs where no notifications will be shown. To add multiple entries seperate them by comma.
|
||||
|
||||
blockMode_title= Block mode
|
||||
blockMode_description=
|
||||
|
||||
@ -44,3 +47,6 @@ displayCallingStack = display calling stack
|
||||
whitelist = whitelist
|
||||
whitelistURL = whitelist URL
|
||||
whitelistDomain = whitelist domain
|
||||
|
||||
whitelistURL = ignore URL
|
||||
whitelistDomain = ignore domain
|
@ -16,6 +16,12 @@
|
||||
"type": "string",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"name": "ignoreList",
|
||||
"title": "Ignore list",
|
||||
"type": "string",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"name": "blockMode",
|
||||
"title": "block mode",
|
||||
|
Loading…
x
Reference in New Issue
Block a user