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

Delta Between Two Patch Sets: lib/antiadblockInit.js

Issue 29643698: Issue 6201 - Fix the "Hide targeted messages?" notification (Closed)
Left Patch Set: Created Dec. 18, 2017, 3:32 p.m.
Right Patch Set: Addressed Wladimir's feedback Created Dec. 19, 2017, 12:25 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 | « no previous file | 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-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
(...skipping 30 matching lines...) Expand all
41 subscription.disabled = !approved; 41 subscription.disabled = !approved;
42 } 42 }
43 43
44 function addAntiAdblockNotification(subscription) 44 function addAntiAdblockNotification(subscription)
45 { 45 {
46 let urlFilters = []; 46 let urlFilters = [];
47 for (let filter of subscription.filters) 47 for (let filter of subscription.filters)
48 { 48 {
49 if (filter instanceof ActiveFilter && filter.domains) 49 if (filter instanceof ActiveFilter && filter.domains)
50 { 50 {
51 for (let domain of filter.domains.keys()) 51 for (let [domain, included] of filter.domains)
Wladimir Palant 2017/12/19 11:36:05 You need the value as well, so better: for (let
kzar 2017/12/19 12:28:00 Done.
52 { 52 {
53 let urlFilter = "||" + domain + "^$document"; 53 let urlFilter = "||" + domain + "^$document";
54 if (domain && filter.domains.has(domain) && 54 if (domain && included && urlFilters.indexOf(urlFilter) == -1)
Wladimir Palant 2017/12/19 11:36:05 That's pointless, you already know that domain exi
kzar 2017/12/19 12:28:00 Whoops, Done.
55 urlFilters.indexOf(urlFilter) == -1)
56 urlFilters.push(urlFilter); 55 urlFilters.push(urlFilter);
57 } 56 }
58 } 57 }
59 } 58 }
60 notification.urlFilters = urlFilters; 59 notification.urlFilters = urlFilters;
61 Notification.addNotification(notification); 60 Notification.addNotification(notification);
62 Notification.addQuestionListener(notification.id, notificationListener); 61 Notification.addQuestionListener(notification.id, notificationListener);
63 } 62 }
64 63
65 function removeAntiAdblockNotification() 64 function removeAntiAdblockNotification()
(...skipping 17 matching lines...) Expand all
83 if (url in FilterStorage.knownSubscriptions && subscription.disabled) 82 if (url in FilterStorage.knownSubscriptions && subscription.disabled)
84 addAntiAdblockNotification(subscription); 83 addAntiAdblockNotification(subscription);
85 else 84 else
86 removeAntiAdblockNotification(); 85 removeAntiAdblockNotification();
87 } 86 }
88 87
89 FilterNotifier.on("subscription.updated", onSubscriptionChange); 88 FilterNotifier.on("subscription.updated", onSubscriptionChange);
90 FilterNotifier.on("subscription.removed", onSubscriptionChange); 89 FilterNotifier.on("subscription.removed", onSubscriptionChange);
91 FilterNotifier.on("subscription.disabled", onSubscriptionChange); 90 FilterNotifier.on("subscription.disabled", onSubscriptionChange);
92 }; 91 };
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld