[Pkg-mozext-commits] [adblock-plus] 40/74: Issue 2193 - Added notification opt-out UI
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 12:07:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 42341418ca1ec12579ed65cc3030b789cd71d41b
Author: Thomas Greiner <thomas at adblockplus.org>
Date: Mon Jun 29 15:15:45 2015 +0200
Issue 2193 - Added notification opt-out UI
---
chrome/content/ui/overlay.xul | 24 +++++++++++++++++-------
chrome/content/ui/settings.xul | 1 +
chrome/locale/en-US/overlay.dtd | 3 +++
chrome/skin/overlay.css | 23 ++++++++++++++++++++---
lib/ui.js | 29 ++++++++++++++++++++++++++---
5 files changed, 67 insertions(+), 13 deletions(-)
diff --git a/chrome/content/ui/overlay.xul b/chrome/content/ui/overlay.xul
index b02a809..54c88a9 100644
--- a/chrome/content/ui/overlay.xul
+++ b/chrome/content/ui/overlay.xul
@@ -61,6 +61,7 @@
<menuitem id="abp-status-frameobjects" label="&objecttabs.label;" type="checkbox" command="abp-command-toggleobjtabs"/>
<menuitem id="abp-status-savestats" label="&counthits.label;" type="checkbox" command="abp-command-togglesavestats"/>
<menuitem id="abp-status-sync" label="&sync.label;" type="checkbox" command="abp-command-togglesync"/>
+ <menuitem id="abp-status-shownotifications" label="&shownotifications.label;" type="checkbox" command="abp-command-toggleshownotifications"/>
<menuseparator id="abp-status-iconSettingsSeparator"/>
<menuitem id="abp-status-showintoolbar" label="&showintoolbar.label;" type="checkbox" command="abp-command-toggleshowintoolbar"/>
<menuitem id="abp-status-showinstatusbar" label="&showinstatusbar.label;" type="checkbox" command="abp-command-toggleshowinstatusbar"/>
@@ -93,6 +94,7 @@
<command id="abp-command-enable" oncommand="//"/>
<command id="abp-command-contribute"/>
<command id="abp-command-contribute-hide"/>
+ <command id="abp-command-toggleshownotifications"/>
</commandset>
<statusbarpanel id="abp-status" class="statusbarpanel-iconic"
@@ -121,12 +123,20 @@
<!-- Notification panel -->
<panel id="abp-notification" type="arrow" orient="vertical"
xmlns:html="http://www.w3.org/1999/xhtml">
- <label id="abp-notification-title" class="header"/>
- <html:p id="abp-notification-message"/>
- <hbox id="abp-notification-question">
- <button id="abp-notification-yes" label="¬ification.button.yes;"/>
- <button id="abp-notification-no" label="¬ification.button.no;"/>
- <toolbarbutton id="abp-notification-close" label="¬ification.button.close;"></toolbarbutton>
- </hbox>
+ <vbox id="abp-notification-content">
+ <toolbar align="start">
+ <label id="abp-notification-title" class="header" flex="1" crop="end"/>
+ <toolbarbutton id="abp-notification-close" tooltiptext="¬ification.button.close;"/>
+ </toolbar>
+ <html:p id="abp-notification-message"/>
+ <hbox id="abp-notification-question">
+ <button id="abp-notification-yes" label="¬ification.button.yes;"/>
+ <button id="abp-notification-no" label="¬ification.button.no;"/>
+ </hbox>
+ </vbox>
+ <vbox id="abp-notification-close-content">
+ <toolbarbutton id="abp-notification-hide" label="¬ification.closing.button.hide;"/>
+ <toolbarbutton id="abp-notification-optout" label="¬ification.closing.button.optout;"/>
+ </vbox>
</panel>
</overlay>
diff --git a/chrome/content/ui/settings.xul b/chrome/content/ui/settings.xul
index 4bfbd69..66d03f7 100644
--- a/chrome/content/ui/settings.xul
+++ b/chrome/content/ui/settings.xul
@@ -31,6 +31,7 @@
<setting pref="extensions.adblockplus.frameobjects" type="bool" title="&objecttabs.label;"/>
<setting id="adblockplus-savestats" type="bool" title="&counthits.label;"/>
<setting id="adblockplus-sync" type="bool" title="&sync.label;"/>
+ <setting id="adblockplus-shownotifications" type="bool" title="&shownotifications.label;"/>
<setting id="adblockplus-showintoolbar" type="bool" title="&showintoolbar.label;"/>
<setting id="adblockplus-showinstatusbar" pref="extensions.adblockplus.showinstatusbar" type="bool" title="&showinstatusbar.label;"/>
</window>
diff --git a/chrome/locale/en-US/overlay.dtd b/chrome/locale/en-US/overlay.dtd
index d005af2..a3cab3a 100644
--- a/chrome/locale/en-US/overlay.dtd
+++ b/chrome/locale/en-US/overlay.dtd
@@ -31,9 +31,12 @@
<!ENTITY objecttabs.label "Show &tabs on Flash and Java">
<!ENTITY counthits.label "Count filter &hits">
<!ENTITY sync.label "Syn&c Adblock Plus settings">
+<!ENTITY shownotifications.label "Show useful ¬ifications">
<!ENTITY objecttab.title "Block">
<!ENTITY objecttab.tooltip "Click here to block this object with Adblock Plus">
<!ENTITY notification.button.yes "&Yes">
<!ENTITY notification.button.no "&No">
<!ENTITY notification.button.close "&Close">
+<!ENTITY notification.closing.button.hide "Close t&his notification">
+<!ENTITY notification.closing.button.optout "&Stop showing notifications">
diff --git a/chrome/skin/overlay.css b/chrome/skin/overlay.css
index dca1b46..1eeb153 100644
--- a/chrome/skin/overlay.css
+++ b/chrome/skin/overlay.css
@@ -148,7 +148,9 @@ toolbar[mode="full"] #abp-toolbarbutton[type="menu"]
visibility: visible !important;
}
-#abp-bottombar-close {
+#abp-bottombar-close,
+#abp-notification-close
+{
padding: 4px 2px;
border-style: none !important;
-moz-user-focus: normal;
@@ -157,11 +159,15 @@ toolbar[mode="full"] #abp-toolbarbutton[type="menu"]
-moz-image-region: rect(0px, 14px, 14px, 0px);
}
-#abp-bottombar-close:hover {
+#abp-bottombar-close:hover,
+#abp-notification-close:hover
+{
-moz-image-region: rect(0px, 28px, 14px, 14px);
}
-#abp-bottombar-close:hover:active {
+#abp-bottombar-close:hover:active,
+#abp-notification-close:hover:active
+{
-moz-image-region: rect(0px, 42px, 14px, 28px);
}
@@ -224,3 +230,14 @@ toolbar[mode="full"] #abp-toolbarbutton[type="menu"]
{
text-decoration: underline;
}
+
+#abp-notification.abp-closing #abp-notification-content,
+#abp-notification:not(.abp-closing) #abp-notification-close-content
+{
+ display: none;
+}
+
+#abp-notification-close-content toolbarbutton label
+{
+ text-align: left;
+}
diff --git a/lib/ui.js b/lib/ui.js
index dda122b..761256b 100644
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -125,6 +125,14 @@ let optionsObserver =
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 @@ let UI = exports.UI =
}.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 UI = exports.UI =
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 @@ let eventHandlers = [
["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()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list