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

Side by Side Diff: lib/antiadblockInit.js

Issue 5230613363687424: Issue 2592 - Adapt filters generated for anti-adblock notification to new syntax (Closed)
Patch Set: Created June 5, 2015, 11:30 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 | « 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-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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 function addAntiAdblockNotification(subscription) 45 function addAntiAdblockNotification(subscription)
46 { 46 {
47 let urlFilters = []; 47 let urlFilters = [];
48 for (let filter of subscription.filters) 48 for (let filter of subscription.filters)
49 { 49 {
50 if (filter instanceof ActiveFilter) 50 if (filter instanceof ActiveFilter)
51 { 51 {
52 for (let domain in filter.domains) 52 for (let domain in filter.domains)
53 { 53 {
54 let urlFilter = "||" + domain + "^"; 54 let urlFilter = "||" + domain + "^$document";
55 if (domain && filter.domains[domain] && urlFilters.indexOf(urlFilter) == -1) 55 if (domain && filter.domains[domain] && urlFilters.indexOf(urlFilter) == -1)
56 urlFilters.push(urlFilter); 56 urlFilters.push(urlFilter);
57 } 57 }
58 } 58 }
59 } 59 }
60 notification.urlFilters = urlFilters; 60 notification.urlFilters = urlFilters;
61 Notification.addNotification(notification); 61 Notification.addNotification(notification);
62 Notification.addQuestionListener(notification.id, notificationListener); 62 Notification.addQuestionListener(notification.id, notificationListener);
63 } 63 }
64 64
(...skipping 11 matching lines...) Expand all
76 { 76 {
77 if (!/^subscription\.(updated|removed|disabled)$/.test(action) || value.url != Prefs.subscriptions_antiadblockurl) 77 if (!/^subscription\.(updated|removed|disabled)$/.test(action) || value.url != Prefs.subscriptions_antiadblockurl)
78 return; 78 return;
79 79
80 if (action == "subscription.updated") 80 if (action == "subscription.updated")
81 addAntiAdblockNotification(value); 81 addAntiAdblockNotification(value);
82 else if (action == "subscription.removed" || (action == "subscription.disabl ed" && !value.disabled)) 82 else if (action == "subscription.removed" || (action == "subscription.disabl ed" && !value.disabled))
83 removeAntiAdblockNotification(); 83 removeAntiAdblockNotification();
84 }); 84 });
85 } 85 }
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