Index: background.js |
=================================================================== |
--- a/background.js |
+++ b/background.js |
@@ -34,7 +34,14 @@ |
var subscriptions =[ |
"https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", |
"https://easylist-downloads.adblockplus.org/exceptionrules.txt", |
- "https://easylist-downloads.adblockplus.org/fanboy-social.txt" |
+ "https://easylist-downloads.adblockplus.org/fanboy-social.txt", |
+ "~user~786254" |
+ ]; |
+ var filters = [ |
+ {text: "@@||alternate.de^$document"}, |
+ {text: "@@||der.postillion.com^$document"}, |
+ {text: "@@||taz.de^$document"}, |
+ {text: "@@||amazon.de^$document"} |
]; |
var modules = {}; |
@@ -52,6 +59,12 @@ |
} |
}; |
+ modules.prefs = { |
+ Prefs: { |
+ "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org/exceptionrules.txt" |
+ } |
+ } |
+ |
modules.subscriptionClasses = { |
Subscription: function(url) |
{ |
@@ -61,11 +74,18 @@ |
this.lastDownload = 1234; |
}, |
- SpecialSubscription: function() {} |
+ SpecialSubscription: function(url) { |
+ this.url = url; |
+ this.disabled = false; |
+ this.filters = filters.slice(); |
+ } |
}; |
modules.subscriptionClasses.Subscription.fromURL = function(url) |
{ |
- return new modules.subscriptionClasses.Subscription(url); |
+ if (/^https?:\/\//.test(url)) |
+ return new modules.subscriptionClasses.Subscription(url); |
+ else |
+ return new modules.subscriptionClasses.SpecialSubscription(url); |
}; |
modules.subscriptionClasses.DownloadableSubscription = modules.subscriptionClasses.Subscription; |
@@ -102,12 +122,43 @@ |
subscriptions.splice(index, 1); |
modules.filterNotifier.FilterNotifier.triggerListeners("subscription.removed", subscription); |
} |
+ }, |
+ |
+ addFilter: function(filter) |
+ { |
+ var subscription = Subscription.fromURL("~user~786254"); |
saroyanm
2015/01/26 19:44:06
Subscription is not defined here, this needs to be
Thomas Greiner
2015/01/27 13:01:07
Done.
|
+ var index = subscription.filters.indexOf(filter); |
+ if (index < 0) |
+ { |
+ subscription.filters.push(filter); |
+ modules.filterNotifier.FilterNotifier.triggerListeners("filter.added", filter); |
+ } |
+ }, |
+ |
+ removeFilter: function(filter) |
+ { |
+ var subscription = Subscription.fromURL("~user~786254"); |
saroyanm
2015/01/26 19:44:06
Subscription is not defined here, this needs to be
Thomas Greiner
2015/01/27 13:01:07
Done.
|
+ var index = subscription.filters.indexOf(filter); |
+ if (index >= 0) |
+ { |
+ subscription.filters.splice(index, 1); |
+ modules.filterNotifier.FilterNotifier.triggerListeners("filter.removed", filter); |
+ } |
} |
} |
}; |
modules.filterClasses = { |
- BlockingFilter: function() {} |
+ BlockingFilter: function() {}, |
+ Filter: function(text) |
+ { |
+ this.text = text; |
+ this.disabled = false; |
+ } |
+ }; |
+ modules.filterClasses.Filter.fromText = function(text) |
+ { |
+ return new modules.filterClasses.Filter(text); |
}; |
modules.synchronizer = { |