Index: lib/ui.js |
=================================================================== |
--- a/lib/ui.js |
+++ b/lib/ui.js |
@@ -125,6 +125,14 @@ |
this.value = Prefs.savestats; |
}); |
+ hideElement("adblockplus-shownotifications", !Prefs.notifications_showui); |
+ setChecked("adblockplus-shownotifications", Prefs.notifications_ignoredcategories.indexOf("*") == -1); |
+ addCommandHandler("adblockplus-shownotifications", function() |
+ { |
+ Notification.toggleIgnoreCategory("*"); |
+ this.value = (Prefs.notifications_ignoredcategories.indexOf("*") == -1); |
+ }); |
+ |
let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription && |
subscription.url == Prefs.subscriptions_exceptionsurl); |
setChecked("adblockplus-acceptableAds", hasAcceptableAds); |
@@ -587,9 +595,21 @@ |
}.bind(this)); |
addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); |
- window.document.getElementById("abp-notification-close").addEventListener("command", function(event) |
+ let notificationPanel = window.document.getElementById("abp-notification"); |
+ notificationPanel.addEventListener("command", function(event) |
{ |
- window.document.getElementById("abp-notification").hidePopup(); |
+ switch (event.target.id) |
+ { |
+ case "abp-notification-close": |
+ notificationPanel.classList.add("abp-closing"); |
+ break; |
+ case "abp-notification-optout": |
+ Notification.toggleIgnoreCategory("*", true); |
+ /* FALL THROUGH */ |
+ case "abp-notification-hide": |
+ notificationPanel.hidePopup(); |
+ break; |
+ } |
}, false); |
// First-run actions? |
@@ -1563,10 +1583,12 @@ |
let hasStatusBar = statusbarPosition; |
hideElement(prefix + "showintoolbar", !hasToolbar || prefix == "abp-toolbar-"); |
hideElement(prefix + "showinstatusbar", !hasStatusBar); |
+ hideElement(prefix + "shownotifications", !Prefs.notifications_showui); |
hideElement(prefix + "iconSettingsSeparator", (prefix == "abp-toolbar-" || !hasToolbar) && !hasStatusBar); |
setChecked(prefix + "showintoolbar", this.isToolbarIconVisible()); |
setChecked(prefix + "showinstatusbar", Prefs.showinstatusbar); |
+ setChecked(prefix + "shownotifications", Prefs.notifications_ignoredcategories.indexOf("*") == -1); |
let {Sync} = require("sync"); |
let syncEngine = Sync.getEngine(); |
@@ -1954,7 +1976,8 @@ |
["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showinstatusbar")], |
["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |
["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
- ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
+ ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], |
+ ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCategory.bind(Notification, "*", null)] |
]; |
onShutdown.add(function() |