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

Delta Between Two Patch Sets: lib/notificationHelper.js

Issue 29536764: Issue 5587, 5748 - Use mobile options page on Firefox for Android (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Update title, add defer attribute, coding style Created Sept. 19, 2017, 7:40 p.m.
Right Patch Set: Remove workaround for FOUC issue and update adblockplusui dependency Created Oct. 5, 2017, 1:24 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « ext/background.js ('k') | lib/options.js » ('j') | options.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /** @module notificationHelper */ 18 /** @module notificationHelper */
19 19
20 "use strict"; 20 "use strict";
21 21
22 const {startIconAnimation, stopIconAnimation} = require("icon"); 22 const {startIconAnimation, stopIconAnimation} = require("icon");
23 const {Utils} = require("utils"); 23 const {Utils} = require("utils");
24 const {Notification: NotificationStorage} = require("notification"); 24 const {Notification: NotificationStorage} = require("notification");
25 const {stringifyURL} = require("url"); 25 const {stringifyURL} = require("url");
26 const {initAntiAdblockNotification} = require("antiadblockInit"); 26 const {initAntiAdblockNotification} = require("antiadblockInit");
27 const {Prefs} = require("prefs"); 27 const {Prefs} = require("prefs");
28 const {showOptions} = require("options");
28 29
29 let activeNotification = null; 30 let activeNotification = null;
30 let activeButtons = null; 31 let activeButtons = null;
31 let defaultDisplayMethods = ["popup"]; 32 let defaultDisplayMethods = ["popup"];
32 let displayMethods = Object.create(null); 33 let displayMethods = Object.create(null);
33 displayMethods.critical = ["icon", "notification", "popup"]; 34 displayMethods.critical = ["icon", "notification", "popup"];
34 displayMethods.question = ["notification"]; 35 displayMethods.question = ["notification"];
35 displayMethods.normal = ["notification"]; 36 displayMethods.normal = ["notification"];
36 displayMethods.relentless = ["notification"]; 37 displayMethods.relentless = ["notification"];
37 displayMethods.information = ["icon", "popup"]; 38 displayMethods.information = ["icon", "popup"];
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 switch (activeButtons[buttonIndex].type) 117 switch (activeButtons[buttonIndex].type)
117 { 118 {
118 case "link": 119 case "link":
119 ext.pages.open(Utils.getDocLink(activeNotification.links[buttonIndex])); 120 ext.pages.open(Utils.getDocLink(activeNotification.links[buttonIndex]));
120 break; 121 break;
121 case "open-all": 122 case "open-all":
122 openNotificationLinks(); 123 openNotificationLinks();
123 break; 124 break;
124 case "configure": 125 case "configure":
125 Prefs.notifications_showui = true; 126 Prefs.notifications_showui = true;
126 ext.showOptions(page => 127 showOptions(page =>
127 { 128 {
128 page.sendMessage({ 129 page.sendMessage({
129 type: "app.respond", 130 type: "app.respond",
130 action: "focusSection", 131 action: "focusSection",
131 args: ["notifications"] 132 args: ["notifications"]
132 }); 133 });
133 }); 134 });
134 break; 135 break;
135 case "question": 136 case "question":
136 NotificationStorage.triggerQuestionListeners(activeNotification.id, 137 NotificationStorage.triggerQuestionListeners(activeNotification.id,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 let methods = displayMethods[notificationType] || defaultDisplayMethods; 273 let methods = displayMethods[notificationType] || defaultDisplayMethods;
273 return methods.includes(method); 274 return methods.includes(method);
274 }; 275 };
275 276
276 ext.pages.onLoading.addListener(page => 277 ext.pages.onLoading.addListener(page =>
277 { 278 {
278 NotificationStorage.showNext(stringifyURL(page.url)); 279 NotificationStorage.showNext(stringifyURL(page.url));
279 }); 280 });
280 281
281 NotificationStorage.addShowListener(showNotification); 282 NotificationStorage.addShowListener(showNotification);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld