| 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-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 | 
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  243    * @param {number} key |  243    * @param {number} key | 
|  244    * @return {Filter} |  244    * @return {Filter} | 
|  245    */ |  245    */ | 
|  246   getFilterByKey(key) |  246   getFilterByKey(key) | 
|  247   { |  247   { | 
|  248     return (key in filterByKey ? filterByKey[key] : null); |  248     return (key in filterByKey ? filterByKey[key] : null); | 
|  249   }, |  249   }, | 
|  250  |  250  | 
|  251   /** |  251   /** | 
|  252    * Returns a list of all selectors as a nested map. On first level, the keys |  252    * Returns a list of all selectors as a nested map. On first level, the keys | 
|  253    * are all values of `ElemHideBase.selectorDomain` (domains on which these |  253    * are all values of `ElemHideBase.selectorDomains` (domains on which these | 
|  254    * selectors should apply, ignoring exceptions). The values are maps again, |  254    * selectors should apply, ignoring exceptions). The values are maps again, | 
|  255    * with the keys being selectors and values the corresponding filter keys. |  255    * with the keys being selectors and values the corresponding filter keys. | 
|  256    * @returns {Map.<String,Map<String,String>>} |  256    * @returns {Map.<String,Map<String,String>>} | 
|  257    */ |  257    */ | 
|  258   getSelectors() |  258   getSelectors() | 
|  259   { |  259   { | 
|  260     let domains = new Map(); |  260     let map = new Map(); | 
|  261     for (let key in filterByKey) |  261     for (let key in filterByKey) | 
|  262     { |  262     { | 
|  263       let filter = filterByKey[key]; |  263       let filter = filterByKey[key]; | 
|  264       if (!filter.selector) |  264       if (!filter.selector) | 
|  265         continue; |  265         continue; | 
|  266  |  266  | 
|  267       let domain = filter.selectorDomain || ""; |  267       let domains = filter.selectorDomains || ""; | 
|  268  |  268  | 
|  269       if (!domains.has(domain)) |  269       if (!map.has(domains)) | 
|  270         domains.set(domain, new Map()); |  270         map.set(domains, new Map()); | 
|  271       domains.get(domain).set(filter.selector, key); |  271       map.get(domains).set(filter.selector, key); | 
|  272     } |  272     } | 
|  273  |  273  | 
|  274     return domains; |  274     return map; | 
|  275   }, |  275   }, | 
|  276  |  276  | 
|  277   /** |  277   /** | 
|  278    * Returns a list of selectors that apply on each website unconditionally. |  278    * Returns a list of selectors that apply on each website unconditionally. | 
|  279    * @returns {string[]} |  279    * @returns {string[]} | 
|  280    */ |  280    */ | 
|  281   getUnconditionalSelectors() |  281   getUnconditionalSelectors() | 
|  282   { |  282   { | 
|  283     if (!unconditionalSelectors) |  283     if (!unconditionalSelectors) | 
|  284       unconditionalSelectors = Object.keys(filterKeyBySelector); |  284       unconditionalSelectors = Object.keys(filterKeyBySelector); | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  381  |  381  | 
|  382       let nextDot = currentDomain.indexOf("."); |  382       let nextDot = currentDomain.indexOf("."); | 
|  383       currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); |  383       currentDomain = nextDot == -1 ? "" : currentDomain.substr(nextDot + 1); | 
|  384     } |  384     } | 
|  385  |  385  | 
|  386     if (provideFilterKeys) |  386     if (provideFilterKeys) | 
|  387       return [selectors, filterKeys]; |  387       return [selectors, filterKeys]; | 
|  388     return selectors; |  388     return selectors; | 
|  389   } |  389   } | 
|  390 }; |  390 }; | 
| OLD | NEW |