Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: adblockplus/Api.jsm

Issue 29322610: Issue 2720 - [Adblocking settings] Add the other filter lists category (Closed)
Patch Set: Mostly naming Created July 28, 2015, 10:58 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: adblockplus/Api.jsm
diff --git a/adblockplus/Api.jsm b/adblockplus/Api.jsm
index 73a832f84b01831af6f649e760a465f46e9ac477..4d0de801f630c90cb78a8bd25ecbfcbac01bf5eb 100644
--- a/adblockplus/Api.jsm
+++ b/adblockplus/Api.jsm
@@ -94,7 +94,8 @@ var AdblockPlusApi =
addSubscription: function(url, title)
{
let subscription = Subscription.fromURL(url);
- subscription.title = title;
+ if (title)
+ subscription.title = title;
FilterStorage.addSubscription(subscription);
if (!subscription.lastDownload)
{
@@ -106,6 +107,16 @@ var AdblockPlusApi =
FilterStorage.removeSubscription(
FilterStorage.knownSubscriptions[url]);
},
+ getActiveSubscriptions: function()
+ {
+ let subscriptions = [];
+ for (let i = 0; i < FilterStorage.subscriptions.length; i++)
+ {
+ let subscription = FilterStorage.subscriptions[i];
+ subscriptions.push({"title": subscription.title, "url": subscription.url});
+ }
+ return subscriptions;
+ },
isLocal: function(url)
{
let uriObject = Services.io.newURI(url, null, null);
@@ -169,6 +180,8 @@ var AdblockPlusApi =
break;
case "getSubscriptionsXml":
return {"success": true, "value": this.subscriptionsXml};
+ case "getActiveSubscriptions":
+ return {"success": true, "value": this.getActiveSubscriptions()};
case "isSubscriptionListed":
if ("url" in data)
{
@@ -177,7 +190,7 @@ var AdblockPlusApi =
}
break;
case "addSubscription":
- if ("url" in data && "title" in data)
+ if ("url" in data)
{
this.addSubscription(data["url"], data["title"]);
return {"success": true};

Powered by Google App Engine
This is Rietveld