Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 exports.composeFilters = function(details) | 83 exports.composeFilters = function(details) |
84 { | 84 { |
85 let filters = []; | 85 let filters = []; |
86 let selectors = []; | 86 let selectors = []; |
87 | 87 |
88 let page = details.page; | 88 let page = details.page; |
89 let frame = details.frame; | 89 let frame = details.frame; |
90 | 90 |
91 if (!isFrameWhitelisted(page, frame, RegExpFilter.typeMap.DOCUMENT)) | 91 if (!isFrameWhitelisted(page, frame, RegExpFilter.typeMap.DOCUMENT)) |
92 { | 92 { |
93 let typeMask = RegExpFilter.typeMap[details.type]; | |
93 let docDomain = extractHostFromFrame(frame); | 94 let docDomain = extractHostFromFrame(frame); |
94 let typeMask = RegExpFilter.typeMap[details.type]; | |
Sebastian Noack
2015/07/13 16:41:50
Nit: I'd declare the variables here in the order t
kzar
2015/07/14 09:22:23
Done.
| |
95 | 95 |
96 // Add a blocking filter for each URL of the element that can be blocked | 96 // Add a blocking filter for each URL of the element that can be blocked |
97 for (let url of details.urls) | 97 for (let url of details.urls) |
98 { | 98 { |
99 let urlObj = new URL(url, details.baseURL); | 99 let urlObj = new URL(url, details.baseURL); |
100 url = stringifyURL(urlObj); | 100 url = stringifyURL(urlObj); |
101 | 101 |
102 let filter = defaultMatcher.whitelist.matchesAny( | 102 let filter = defaultMatcher.whitelist.matchesAny( |
103 url, typeMask, docDomain, | 103 url, typeMask, docDomain, |
104 isThirdParty(urlObj, docDomain), | 104 isThirdParty(urlObj, docDomain), |
(...skipping 30 matching lines...) Expand all Loading... | |
135 selectors.push(escapeCSS(details.tagName) + "[style=" + quoteCSS(details .style) + "]"); | 135 selectors.push(escapeCSS(details.tagName) + "[style=" + quoteCSS(details .style) + "]"); |
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 }; |
LEFT | RIGHT |