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

Side by Side Diff: lib/elemHide.js

Issue 30009560: Noissue - Rename lib/domain.js to lib/url.js (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add tests for domainSuffixes Created Feb. 19, 2019, 2:36 a.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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 "use strict"; 18 "use strict";
19 19
20 /** 20 /**
21 * @fileOverview Element hiding implementation. 21 * @fileOverview Element hiding implementation.
22 */ 22 */
23 23
24 const {ElemHideExceptions} = require("./elemHideExceptions"); 24 const {ElemHideExceptions} = require("./elemHideExceptions");
25 const {filterNotifier} = require("./filterNotifier"); 25 const {filterNotifier} = require("./filterNotifier");
26 const {normalizeHostname, suffixes} = require("./domain"); 26 const {normalizeHostname, domainSuffixes} = require("./url");
27 const {Cache} = require("./caching"); 27 const {Cache} = require("./caching");
28 28
29 /** 29 /**
30 * The maximum number of selectors in a CSS rule. This is used by 30 * The maximum number of selectors in a CSS rule. This is used by
31 * <code>{@link createStyleSheet}</code> to split up a long list of selectors 31 * <code>{@link createStyleSheet}</code> to split up a long list of selectors
32 * into multiple rules. 32 * into multiple rules.
33 * @const {number} 33 * @const {number}
34 * @default 34 * @default
35 */ 35 */
36 const selectorGroupSize = 1024; 36 const selectorGroupSize = 1024;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 * be included. 159 * be included.
160 * 160 *
161 * @returns {Array.<string>} The list of selectors. 161 * @returns {Array.<string>} The list of selectors.
162 */ 162 */
163 function getConditionalSelectors(domain, specificOnly) 163 function getConditionalSelectors(domain, specificOnly)
164 { 164 {
165 let selectors = []; 165 let selectors = [];
166 166
167 let excluded = new Set(); 167 let excluded = new Set();
168 168
169 for (let currentDomain of suffixes(domain, !specificOnly)) 169 for (let currentDomain of domainSuffixes(domain, !specificOnly))
170 { 170 {
171 let filters = filtersByDomain.get(currentDomain); 171 let filters = filtersByDomain.get(currentDomain);
172 if (filters) 172 if (filters)
173 { 173 {
174 for (let [filter, isIncluded] of filters) 174 for (let [filter, isIncluded] of filters)
175 { 175 {
176 if (!isIncluded) 176 if (!isIncluded)
177 { 177 {
178 excluded.add(filter); 178 excluded.add(filter);
179 } 179 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 { 494 {
495 let styleSheet = ""; 495 let styleSheet = "";
496 496
497 for (let selectorGroup of splitSelectors(selectors)) 497 for (let selectorGroup of splitSelectors(selectors))
498 styleSheet += createRule(selectorGroup); 498 styleSheet += createRule(selectorGroup);
499 499
500 return styleSheet; 500 return styleSheet;
501 } 501 }
502 502
503 exports.createStyleSheet = createStyleSheet; 503 exports.createStyleSheet = createStyleSheet;
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