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

Side by Side Diff: lib/notification.js

Issue 29501607: Issue 5459 - Add support to show a notification based on the number of ads blocked (Closed)
Patch Set: Created July 31, 2017, 3:05 p.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 | « no previous file | no next file » | 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 checkTarget(target, "platform", platform, platformVersion)) 297 checkTarget(target, "platform", platform, platformVersion))
298 { 298 {
299 match = true; 299 match = true;
300 break; 300 break;
301 } 301 }
302 } 302 }
303 if (!match) 303 if (!match)
304 continue; 304 continue;
305 } 305 }
306 306
307 if (typeof notification.blocked_total_min == 'number' &&
308 (typeof Prefs.blocked_total != 'number' ||
wspee 2017/07/31 15:16:22 NOTE: Prefs.blocked_total only exists on webext ba
309 notification.blocked_total_min > Prefs.blocked_total))
310 continue
311
312 if (typeof notification.blocked_total_max == 'number' &&
313 (typeof Prefs.blocked_total != 'number' ||
314 notification.blocked_total_max < Prefs.blocked_total))
315 continue
316
307 if (!notificationToShow || 317 if (!notificationToShow ||
308 getNumericalSeverity(notification) > 318 getNumericalSeverity(notification) >
309 getNumericalSeverity(notificationToShow)) 319 getNumericalSeverity(notificationToShow))
310 notificationToShow = notification; 320 notificationToShow = notification;
311 } 321 }
312 322
313 return notificationToShow; 323 return notificationToShow;
314 }, 324 },
315 325
316 /** 326 /**
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 else if (index != -1 && forceValue !== true) 476 else if (index != -1 && forceValue !== true)
467 categories.splice(index, 1); 477 categories.splice(index, 1);
468 478
469 // HACK: JSON values aren't saved unless they are assigned a 479 // HACK: JSON values aren't saved unless they are assigned a
470 // different object. 480 // different object.
471 Prefs.notifications_ignoredcategories = 481 Prefs.notifications_ignoredcategories =
472 JSON.parse(JSON.stringify(categories)); 482 JSON.parse(JSON.stringify(categories));
473 } 483 }
474 }; 484 };
475 Notification.init(); 485 Notification.init();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld