| OLD | NEW |
| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 /** @module filterComposer */ |
| 19 |
| 18 let {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); | 20 let {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); |
| 19 let {getKey, isFrameWhitelisted} = require("whitelisting"); | 21 let {getKey, isFrameWhitelisted} = require("whitelisting"); |
| 20 let {defaultMatcher} = require("matcher"); | 22 let {defaultMatcher} = require("matcher"); |
| 21 | 23 |
| 22 function escapeChar(chr) | 24 function escapeChar(chr) |
| 23 { | 25 { |
| 24 let code = chr.charCodeAt(0); | 26 let code = chr.charCodeAt(0); |
| 25 | 27 |
| 26 // Control characters and leading digits must be escaped based on | 28 // Control characters and leading digits must be escaped based on |
| 27 // their char code in CSS. Moreover, curly brackets aren't allowed | 29 // their char code in CSS. Moreover, curly brackets aren't allowed |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 136 |
| 135 // Add an element hiding filter for each generated CSS selector | 137 // Add an element hiding filter for each generated CSS selector |
| 136 for (let selector of selectors) | 138 for (let selector of selectors) |
| 137 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); | 139 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); |
| 138 } | 140 } |
| 139 } | 141 } |
| 140 | 142 |
| 141 return {filters: filters, selectors: selectors}; | 143 return {filters: filters, selectors: selectors}; |
| 142 } | 144 } |
| 143 exports.composeFilters = composeFilters; | 145 exports.composeFilters = composeFilters; |
| OLD | NEW |