Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/ui.js

Issue 6526453483044864: Issue 2193 - Added notification opt-out (Firefox) (Closed)
Left Patch Set: Rebased to 5434ef6e1545 Created June 24, 2015, 4:19 p.m.
Right Patch Set: Created June 26, 2015, 3:29 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/skin/overlay.css ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 { 123 {
124 UI.toggleSaveStats(doc.defaultView); 124 UI.toggleSaveStats(doc.defaultView);
125 this.value = Prefs.savestats; 125 this.value = Prefs.savestats;
126 }); 126 });
127 127
128 hideElement("adblockplus-shownotifications", !Prefs.notifications_showui); 128 hideElement("adblockplus-shownotifications", !Prefs.notifications_showui);
129 setChecked("adblockplus-shownotifications", Prefs.notifications_ignoredcat egories.indexOf("*") == -1); 129 setChecked("adblockplus-shownotifications", Prefs.notifications_ignoredcat egories.indexOf("*") == -1);
130 addCommandHandler("adblockplus-shownotifications", function() 130 addCommandHandler("adblockplus-shownotifications", function()
131 { 131 {
132 Notification.toggleIgnoreCategory("*"); 132 Notification.toggleIgnoreCategory("*");
133 this.value = (Prefs.notifications_ignoredcategories.indexOf("*") == -1); 133 this.value = (Prefs.notifications_ignoredcategories.indexOf("*") == -1);
Wladimir Palant 2015/06/26 13:13:09 Nit: toggleIgnoreCategory() should really return t
Thomas Greiner 2015/06/26 15:32:48 Totally makes sense. I created #2727 for that now
134 }); 134 });
135 135
136 let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription && 136 let hasAcceptableAds = FilterStorage.subscriptions.some((subscription) => subscription instanceof DownloadableSubscription &&
137 subscription.url == Prefs.subscriptions_exceptionsurl); 137 subscription.url == Prefs.subscriptions_exceptionsurl);
138 setChecked("adblockplus-acceptableAds", hasAcceptableAds); 138 setChecked("adblockplus-acceptableAds", hasAcceptableAds);
139 addCommandHandler("adblockplus-acceptableAds", function() 139 addCommandHandler("adblockplus-acceptableAds", function()
140 { 140 {
141 this.value = UI.toggleAcceptableAds(); 141 this.value = UI.toggleAcceptableAds();
142 }); 142 });
143 143
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 let notificationPanel = window.document.getElementById("abp-notification"); 598 let notificationPanel = window.document.getElementById("abp-notification");
599 notificationPanel.addEventListener("command", function(event) 599 notificationPanel.addEventListener("command", function(event)
600 { 600 {
601 switch (event.target.id) 601 switch (event.target.id)
602 { 602 {
603 case "abp-notification-close": 603 case "abp-notification-close":
604 notificationPanel.classList.add("abp-closing"); 604 notificationPanel.classList.add("abp-closing");
605 break; 605 break;
606 case "abp-notification-optout": 606 case "abp-notification-optout":
607 Notification.toggleIgnoreCategory("*", true); 607 Notification.toggleIgnoreCategory("*", true);
Wladimir Palant 2015/06/26 13:13:09 I'm not a huge fan of fallthrough in switch statem
Thomas Greiner 2015/06/26 15:32:48 Done. I guess it would make sense to add this to h
608 /* FALL THROUGH */
608 case "abp-notification-hide": 609 case "abp-notification-hide":
609 notificationPanel.hidePopup(); 610 notificationPanel.hidePopup();
610 break; 611 break;
611 } 612 }
612 }, true); 613 }, false);
Wladimir Palant 2015/06/26 13:13:09 Why true? We don't usually add capturing event lis
Thomas Greiner 2015/06/26 15:32:48 Done.
613 614
614 // First-run actions? 615 // First-run actions?
615 this.firstRunActions(window); 616 this.firstRunActions(window);
616 617
617 // Some people actually switch off browser.frames.enabled and are surprised 618 // Some people actually switch off browser.frames.enabled and are surprised
618 // that things stop working... 619 // that things stop working...
619 window.QueryInterface(Ci.nsIInterfaceRequestor) 620 window.QueryInterface(Ci.nsIInterfaceRequestor)
620 .getInterface(Ci.nsIWebNavigation) 621 .getInterface(Ci.nsIWebNavigation)
621 .QueryInterface(Ci.nsIDocShell) 622 .QueryInterface(Ci.nsIDocShell)
622 .allowSubframes = true; 623 .allowSubframes = true;
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)], 1979 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)],
1979 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)] 1980 ["abp-command-toggleshownotifications", "command", Notification.toggleIgnoreCa tegory.bind(Notification, "*", null)]
1980 ]; 1981 ];
1981 1982
1982 onShutdown.add(function() 1983 onShutdown.add(function()
1983 { 1984 {
1984 for (let window of UI.applicationWindows) 1985 for (let window of UI.applicationWindows)
1985 if (UI.isBottombarOpen(window)) 1986 if (UI.isBottombarOpen(window))
1986 UI.toggleBottombar(window); 1987 UI.toggleBottombar(window);
1987 }); 1988 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld