Index: lib/filterListener.js |
=================================================================== |
--- a/lib/filterListener.js |
+++ b/lib/filterListener.js |
@@ -27,17 +27,17 @@ |
const {filterStorage} = require("./filterStorage"); |
const {filterNotifier} = require("./filterNotifier"); |
const {ElemHide} = require("./elemHide"); |
const {ElemHideEmulation} = require("./elemHideEmulation"); |
const {ElemHideExceptions} = require("./elemHideExceptions"); |
const {Snippets} = require("./snippets"); |
const {defaultMatcher} = require("./matcher"); |
-const {ActiveFilter, RegExpFilter, |
+const {Filter, ActiveFilter, RegExpFilter, |
ElemHideBase, ElemHideFilter, ElemHideEmulationFilter, |
SnippetFilter} = require("./filterClasses"); |
const {SpecialSubscription} = require("./subscriptionClasses"); |
const {Prefs} = require("prefs"); |
/** |
* Increases on filter changes, filters will be saved if it exceeds 1. |
* @type {number} |
@@ -218,63 +218,63 @@ |
} |
function onSubscriptionAdded(subscription) |
{ |
FilterListener.setDirty(1); |
if (!subscription.disabled) |
{ |
- for (let filter of subscription.filters()) |
- addFilter(filter); |
+ for (let text of subscription.filterText()) |
+ addFilter(Filter.fromText(text)); |
} |
} |
function onSubscriptionRemoved(subscription) |
{ |
FilterListener.setDirty(1); |
if (!subscription.disabled) |
{ |
- for (let filter of subscription.filters()) |
- removeFilter(filter); |
+ for (let text of subscription.filterText()) |
+ removeFilter(Filter.fromText(text)); |
} |
} |
function onSubscriptionDisabled(subscription, newValue) |
{ |
FilterListener.setDirty(1); |
if (filterStorage.knownSubscriptions.has(subscription.url)) |
{ |
if (newValue == false) |
{ |
- for (let filter of subscription.filters()) |
- addFilter(filter); |
+ for (let text of subscription.filterText()) |
+ addFilter(Filter.fromText(text)); |
} |
else |
{ |
- for (let filter of subscription.filters()) |
- removeFilter(filter); |
+ for (let text of subscription.filterText()) |
+ removeFilter(Filter.fromText(text)); |
} |
} |
} |
-function onSubscriptionUpdated(subscription, oldFilters) |
+function onSubscriptionUpdated(subscription, oldFilterText) |
{ |
FilterListener.setDirty(1); |
if (!subscription.disabled && |
filterStorage.knownSubscriptions.has(subscription.url)) |
{ |
- for (let filter of oldFilters) |
- removeFilter(filter); |
+ for (let text of oldFilterText) |
+ removeFilter(Filter.fromText(text)); |
- for (let filter of subscription.filters()) |
- addFilter(filter); |
+ for (let text of subscription.filterText()) |
+ addFilter(Filter.fromText(text)); |
} |
} |
function onFilterHitCount(filter, newValue) |
{ |
if (newValue == 0) |
FilterListener.setDirty(0); |
else |
@@ -326,18 +326,18 @@ |
ElemHideEmulation.clear(); |
ElemHideExceptions.clear(); |
Snippets.clear(); |
for (let subscription of filterStorage.subscriptions()) |
{ |
if (!subscription.disabled) |
{ |
- for (let filter of subscription.filters()) |
- addFilter(filter); |
+ for (let text of subscription.filterText()) |
+ addFilter(Filter.fromText(text)); |
} |
} |
} |
function onSave() |
{ |
isDirty = 0; |
} |