| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 /** | 384 /** |
| 385 * Retrieves an element hiding filter by the corresponding protocol key | 385 * Retrieves an element hiding filter by the corresponding protocol key |
| 386 */ | 386 */ |
| 387 getFilterByKey: function(/**String*/ key) /**Filter*/ | 387 getFilterByKey: function(/**String*/ key) /**Filter*/ |
| 388 { | 388 { |
| 389 return (key in filterByKey ? filterByKey[key] : null); | 389 return (key in filterByKey ? filterByKey[key] : null); |
| 390 }, | 390 }, |
| 391 | 391 |
| 392 /** | 392 /** |
| 393 * Returns a list of all selectors active on a particular domain (currently | 393 * Returns a list of all selectors active on a particular domain (currently |
| 394 * used only in Chrome). | 394 * used only in Chrome, Opera and Safari). |
| 395 */ | 395 */ |
| 396 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) | 396 getSelectorsForDomain: function(/**String*/ domain, /**Boolean*/ specificOnly) |
| 397 { | 397 { |
| 398 let result = []; | 398 let result = []; |
| 399 for (let key in filterByKey) | 399 for (let key in filterByKey) |
| 400 { | 400 { |
| 401 let filter = filterByKey[key]; | 401 let filter = filterByKey[key]; |
| 402 if (specificOnly && (!filter.domains || filter.domains[""])) | 402 let domains = filter.domains; // it is important to always access filter.d omains |
| 403 // here, even if it isn't used, in order to | |
| 404 // workaround WebKit bug 132872, also see #4 19 | |
|
Wladimir Palant
2014/05/14 06:17:37
Nit: Please always put comments with more than two
Sebastian Noack
2014/05/14 06:40:19
Done.
| |
| 405 | |
| 406 if (specificOnly && (!domains || domains[""])) | |
| 403 continue; | 407 continue; |
| 404 | 408 |
| 405 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) | 409 if (filter.isActiveOnDomain(domain) && !this.getException(filter, domain)) |
| 406 result.push(filter.selector); | 410 result.push(filter.selector); |
| 407 } | 411 } |
| 408 return result; | 412 return result; |
| 409 } | 413 } |
| 410 }; | 414 }; |
| OLD | NEW |