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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 function quoteCSS(value) | 56 function quoteCSS(value) |
57 { | 57 { |
58 return '"' + value.replace(/["\\\{\}\x00-\x1F\x7F]/g, escapeChar) + '"'; | 58 return '"' + value.replace(/["\\\{\}\x00-\x1F\x7F]/g, escapeChar) + '"'; |
59 } | 59 } |
60 exports.quoteCSS = quoteCSS; | 60 exports.quoteCSS = quoteCSS; |
61 | 61 |
62 /** | 62 /** |
63 * Generates filters to block an element. | 63 * Generates filters to block an element. |
64 * @param {Object} details | 64 * @param {Object} details |
65 * @param {string} details.tagName The element's tag name | 65 * @param {string} details.tagName The element's tag name |
66 * @param {string} detials.id The element's "id" attribute | 66 * @param {string} details.id The element's "id" attribute |
67 * @param {string} details.src The element's "src" attribute | 67 * @param {string} details.src The element's "src" attribute |
68 * @param {string} details.style The element's "style" attribute | 68 * @param {string} details.style The element's "style" attribute |
69 * @param {string[]} details.classes The classes given by the element's "class"
attribute | 69 * @param {string[]} details.classes The classes given by the element's "class"
attribute |
70 * @param {string[]} details.urls The URLs considered when loading the eleme
nt | 70 * @param {string[]} details.urls The URLs considered when loading the eleme
nt |
71 * @param {string} details.type The request type (will be ignored if there
are no URLs) | 71 * @param {string} details.type The request type (will be ignored if there
are no URLs) |
72 * @param {string} details.baseURL The URL of the document containing the ele
ment | 72 * @param {string} details.baseURL The URL of the document containing the ele
ment |
73 * @param {Page} details.page The page containing the element | 73 * @param {Page} details.page The page containing the element |
74 * @param {Frame} details.frame The frame containing the element | 74 * @param {Frame} details.frame The frame containing the element |
75 * | 75 * |
76 * @return {object} An object holding the list of generated filters and | 76 * @return {object} An object holding the list of generated filters and |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 // Add an element hiding filter for each generated CSS selector | 137 // Add an element hiding filter for each generated CSS selector |
138 for (let selector of selectors) | 138 for (let selector of selectors) |
139 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); | 139 filters.push(docDomain.replace(/^www\./, "") + "##" + selector); |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 return {filters: filters, selectors: selectors}; | 143 return {filters: filters, selectors: selectors}; |
144 } | 144 } |
145 exports.composeFilters = composeFilters; | 145 exports.composeFilters = composeFilters; |
OLD | NEW |