diff --git a/lib/main.js b/lib/main.js index a0091f5..c0766ec 100644 --- a/lib/main.js +++ b/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; } diff --git a/locale/de-DE.properties b/locale/de-DE.properties index ca6766a..c664b32 100644 --- a/locale/de-DE.properties +++ b/locale/de-DE.properties @@ -4,6 +4,9 @@ whiteList_description= Domänen oder URLs, die die -API verwenden dürfe blackList_title= Blacklist blackList_description= Domänen oder URLs, die die -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= @@ -42,4 +45,7 @@ fakedReadout = Auslese vorgetäuscht auf {url} settings = Einstellungen displayCallingStack = Aufrufestack anzeigen whitelistURL = erlaube URL -whitelistDomain = erlaube Domain \ No newline at end of file +whitelistDomain = erlaube Domain + +ignorelistURL = ignoriere URL +ignorelistDomain = ignoriere Domain \ No newline at end of file diff --git a/locale/en-US.properties b/locale/en-US.properties index 692fc69..39f329b 100644 --- a/locale/en-US.properties +++ b/locale/en-US.properties @@ -4,6 +4,9 @@ whiteList_description= Domains or URLs where the -API should not be bloc blackList_title= Black list blackList_description= Domains or URLs where the -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= @@ -43,4 +46,7 @@ settings = settings displayCallingStack = display calling stack whitelist = whitelist whitelistURL = whitelist URL -whitelistDomain = whitelist domain \ No newline at end of file +whitelistDomain = whitelist domain + +whitelistURL = ignore URL +whitelistDomain = ignore domain \ No newline at end of file diff --git a/package.json b/package.json index 1c51a66..94c34b5 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,12 @@ "type": "string", "value": "" }, + { + "name": "ignoreList", + "title": "Ignore list", + "type": "string", + "value": "" + }, { "name": "blockMode", "title": "block mode",