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

Side by Side Diff: lib/notificationHelper.js

Issue 29522601: Noissue - Use includes instead of indexOf (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Aug. 21, 2017, 11:16 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterComposer.js ('k') | options.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 let maxButtons = (notificationType == "critical") ? 2 : 1; 80 let maxButtons = (notificationType == "critical") ? 2 : 1;
81 if (buttons.length > maxButtons) 81 if (buttons.length > maxButtons)
82 { 82 {
83 buttons = [ 83 buttons = [
84 { 84 {
85 type: "open-all", 85 type: "open-all",
86 title: ext.i18n.getMessage("notification_open_all") 86 title: ext.i18n.getMessage("notification_open_all")
87 } 87 }
88 ]; 88 ];
89 } 89 }
90 if (["critical", "relentless"].indexOf(notificationType) == -1) 90 if (!["critical", "relentless"].includes(notificationType))
91 { 91 {
92 buttons.push({ 92 buttons.push({
93 type: "configure", 93 type: "configure",
94 title: ext.i18n.getMessage("notification_configure") 94 title: ext.i18n.getMessage("notification_configure")
95 }); 95 });
96 } 96 }
97 } 97 }
98 98
99 return buttons; 99 return buttons;
100 } 100 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 * Determines whether a given display method should be used for a 263 * Determines whether a given display method should be used for a
264 * specified notification type. 264 * specified notification type.
265 * 265 *
266 * @param {string} method Display method: icon, notification or popup 266 * @param {string} method Display method: icon, notification or popup
267 * @param {string} notificationType 267 * @param {string} notificationType
268 * @return {boolean} 268 * @return {boolean}
269 */ 269 */
270 exports.shouldDisplay = (method, notificationType) => 270 exports.shouldDisplay = (method, notificationType) =>
271 { 271 {
272 let methods = displayMethods[notificationType] || defaultDisplayMethods; 272 let methods = displayMethods[notificationType] || defaultDisplayMethods;
273 return methods.indexOf(method) > -1; 273 return methods.includes(method);
274 }; 274 };
275 275
276 ext.pages.onLoading.addListener(page => 276 ext.pages.onLoading.addListener(page =>
277 { 277 {
278 NotificationStorage.showNext(stringifyURL(page.url)); 278 NotificationStorage.showNext(stringifyURL(page.url));
279 }); 279 });
280 280
281 NotificationStorage.addShowListener(showNotification); 281 NotificationStorage.addShowListener(showNotification);
OLDNEW
« no previous file with comments | « lib/filterComposer.js ('k') | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld