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-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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return commonStyleSheet; | 220 return commonStyleSheet; |
221 } | 221 } |
222 | 222 |
223 /** | 223 /** |
224 * Returns the domain-specific style sheet that applies on a given domain. | 224 * Returns the domain-specific style sheet that applies on a given domain. |
225 * @param {string} domain | 225 * @param {string} domain |
226 * @returns {string} | 226 * @returns {string} |
227 */ | 227 */ |
228 function getDomainSpecificStyleSheet(domain) | 228 function getDomainSpecificStyleSheet(domain) |
229 { | 229 { |
230 let styleSheet = styleSheetCache.read(domain); | 230 let styleSheet = styleSheetCache.get(domain); |
231 | 231 |
232 if (typeof styleSheet == "undefined") | 232 if (typeof styleSheet == "undefined") |
233 { | 233 { |
234 styleSheet = createStyleSheet(getConditionalSelectors(domain, false)); | 234 styleSheet = createStyleSheet(getConditionalSelectors(domain, false)); |
235 styleSheetCache.save(domain, styleSheet); | 235 styleSheetCache.set(domain, styleSheet); |
236 } | 236 } |
237 | 237 |
238 return styleSheet; | 238 return styleSheet; |
239 } | 239 } |
240 | 240 |
241 ElemHideExceptions.on("added", ({domains, selector}) => | 241 ElemHideExceptions.on("added", ({domains, selector}) => |
242 { | 242 { |
243 styleSheetCache.clear(); | 243 styleSheetCache.clear(); |
244 commonStyleSheet = null; | 244 commonStyleSheet = null; |
245 | 245 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
LEFT | RIGHT |