mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 03:56:26 +02:00
Added ignore list.
This commit is contained in:
parent
af47ee8d87
commit
475c28483f
4 changed files with 90 additions and 52 deletions
120
lib/main.js
120
lib/main.js
|
@ -40,6 +40,15 @@
|
|||
preferences.on("blackList", function(){
|
||||
updateBlackList();
|
||||
});
|
||||
|
||||
var ignoreList;
|
||||
function updateIgnoreList(){
|
||||
ignoreList = getDomainRegExpList(prefs.ignoreList);
|
||||
}
|
||||
updateIgnoreList();
|
||||
preferences.on("ignoreList", function(){
|
||||
updateIgnoreList();
|
||||
});
|
||||
|
||||
// preferences for injected file
|
||||
var preferencesForInjected = ["showCallingFile", "showCompleteCallingStack"];
|
||||
|
@ -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);
|
||||
|
||||
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;
|
||||
}
|
||||
else {
|
||||
var buttons = [
|
||||
{
|
||||
label: _("displayCallingStack"),
|
||||
accessKey: "",
|
||||
callback: function(){
|
||||
browser.contentWindow.alert(callingStackMsg);
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
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
|
||||
);
|
||||
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
|
||||
notifyBox.appendNotification(
|
||||
message,
|
||||
"fake-readout",
|
||||
"chrome://browser/skin/Info.png",
|
||||
priority,
|
||||
buttons
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue