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

Unified Diff: lib/api.js

Issue 10171027: Compile subscriptions.xml into the libadblockplus build and make itusable (Closed)
Patch Set: Created April 19, 2013, 7:59 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: lib/api.js
===================================================================
--- a/lib/api.js
+++ b/lib/api.js
@@ -110,16 +110,35 @@ var API = (function()
getListedSubscriptions: function()
{
return FilterStorage.subscriptions.filter(function(s)
{
return !(s instanceof SpecialSubscription)
});
},
+ getRecommendedSubscriptions: function()
+ {
+ var subscriptions = require("subscriptions.xml");
+ var result = [];
+ for (var i = 0; i < subscriptions.length; i++)
+ {
+ var subscription = Subscription.fromURL(subscriptions[i].url);
+ subscription.title = subscriptions[i].title;
+ subscription.homepage = subscriptions[i].homepage;
+
+ // These aren't normally properties of a Subscription object
+ subscription.author = subscriptions[i].author;
+ subscription.prefixes = subscriptions[i].prefixes;
+ subscription.specialization = subscriptions[i].specialization;
+ result.push(subscription);
+ }
+ return result;
+ },
+
checkFilterMatch: function(url, contentType, documentUrl)
{
// TODO: set thirdParty properly
var thirdParty = false;
return defaultMatcher.matchesAny(url, contentType, documentUrl, thirdParty);
},
getElementHidingSelectors: function(domain)

Powered by Google App Engine
This is Rietveld