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

Side by Side Diff: lib/elemHide.js

Issue 5434053851348992: Issue 1282 - Let user-defined filters override filter lists (Closed)
Patch Set: Created Dec. 9, 2014, 1:12 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 | lib/filterClasses.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 * Checks whether an exception rule is registered for a filter on a particular 175 * Checks whether an exception rule is registered for a filter on a particular
176 * domain. 176 * domain.
177 */ 177 */
178 getException: function(/**Filter*/ filter, /**String*/ docDomain) /**ElemHideE xception*/ 178 getException: function(/**Filter*/ filter, /**String*/ docDomain) /**ElemHideE xception*/
179 { 179 {
180 if (!(filter.selector in exceptions)) 180 if (!(filter.selector in exceptions))
181 return null; 181 return null;
182 182
183 let list = exceptions[filter.selector]; 183 let list = exceptions[filter.selector];
184 for (let i = list.length - 1; i >= 0; i--) 184 for (let i = list.length - 1; i >= 0; i--)
185 if (list[i].isActiveOnDomain(docDomain)) 185 {
186 return list[i]; 186 let exception = list[i];
187 if (exception.isActiveOnDomain(docDomain) && (!filter.isUserDefined || exc eption.isUserDefined))
188 return exception;
189 }
187 190
188 return null; 191 return null;
189 }, 192 },
190 193
191 /** 194 /**
192 * Will be set to true if apply() is running (reentrance protection). 195 * Will be set to true if apply() is running (reentrance protection).
193 * @type Boolean 196 * @type Boolean
194 */ 197 */
195 _applying: false, 198 _applying: false,
196 199
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 let filter = filterByKey[key]; 386 let filter = filterByKey[key];
384 if (specificOnly && (!filter.domains || filter.domains[""])) 387 if (specificOnly && (!filter.domains || filter.domains[""]))
385 continue; 388 continue;
386 389
387 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) 390 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain))
388 result.push(filter.selector); 391 result.push(filter.selector);
389 } 392 }
390 return result; 393 return result;
391 } 394 }
392 }; 395 };
OLDNEW
« no previous file with comments | « no previous file | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld