Index: lib/elemHideEmulation.js |
=================================================================== |
--- a/lib/elemHideEmulation.js |
+++ b/lib/elemHideEmulation.js |
@@ -16,65 +16,35 @@ |
*/ |
"use strict"; |
/** |
* @fileOverview Element hiding emulation implementation. |
*/ |
+const {ElemHideTemplate} = require("./elemHide"); |
const {ElemHideExceptions} = require("./elemHideExceptions"); |
-const {Filter} = require("./filterClasses"); |
- |
-let filters = new Set(); |
/** |
* Container for element hiding emulation filters |
* @class |
*/ |
-let ElemHideEmulation = { |
- /** |
- * Removes all known filters |
- */ |
- clear() |
- { |
- filters.clear(); |
- }, |
- |
- /** |
- * Add a new element hiding emulation filter |
- * @param {ElemHideEmulationFilter} filter |
- */ |
- add(filter) |
- { |
- filters.add(filter.text); |
- }, |
- |
- /** |
- * Removes an element hiding emulation filter |
- * @param {ElemHideEmulationFilter} filter |
- */ |
- remove(filter) |
- { |
- filters.delete(filter.text); |
- }, |
- |
+exports.ElemHideEmulation = Object.assign(new ElemHideTemplate(), { |
Manish Jethani
2018/05/17 05:51:54
ElemHideEmulation is now just like ElemHide, but w
|
/** |
* Returns a list of all rules active on a particular domain |
* @param {string} domain |
* @return {ElemHideEmulationFilter[]} |
*/ |
getRulesForDomain(domain) |
{ |
let result = []; |
- for (let text of filters.values()) |
+ for (let filter of this._knownFilters) |
Manish Jethani
2018/05/17 05:51:54
Note: I am not yet taking advantage of the optimiz
|
{ |
- let filter = Filter.fromText(text); |
if (filter.isActiveOnDomain(domain) && |
!ElemHideExceptions.getException(filter, domain)) |
{ |
result.push(filter); |
} |
} |
return result; |
} |
-}; |
-exports.ElemHideEmulation = ElemHideEmulation; |
+}); |