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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of the Adblock Plus extension, 2 * This file is part of the Adblock Plus extension,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 }, 108 },
109 109
110 getListedSubscriptions: function() 110 getListedSubscriptions: function()
111 { 111 {
112 return FilterStorage.subscriptions.filter(function(s) 112 return FilterStorage.subscriptions.filter(function(s)
113 { 113 {
114 return !(s instanceof SpecialSubscription) 114 return !(s instanceof SpecialSubscription)
115 }); 115 });
116 }, 116 },
117 117
118 getRecommendedSubscriptions: function()
119 {
120 var subscriptions = require("subscriptions.xml");
121 var result = [];
122 for (var i = 0; i < subscriptions.length; i++)
123 {
124 var subscription = Subscription.fromURL(subscriptions[i].url);
125 subscription.title = subscriptions[i].title;
126 subscription.homepage = subscriptions[i].homepage;
127
128 // These aren't normally properties of a Subscription object
129 subscription.author = subscriptions[i].author;
130 subscription.prefixes = subscriptions[i].prefixes;
131 subscription.specialization = subscriptions[i].specialization;
132 result.push(subscription);
133 }
134 return result;
135 },
136
118 checkFilterMatch: function(url, contentType, documentUrl) 137 checkFilterMatch: function(url, contentType, documentUrl)
119 { 138 {
120 // TODO: set thirdParty properly 139 // TODO: set thirdParty properly
121 var thirdParty = false; 140 var thirdParty = false;
122 return defaultMatcher.matchesAny(url, contentType, documentUrl, thirdParty ); 141 return defaultMatcher.matchesAny(url, contentType, documentUrl, thirdParty );
123 }, 142 },
124 143
125 getElementHidingSelectors: function(domain) 144 getElementHidingSelectors: function(domain)
126 { 145 {
127 return ElemHide.getSelectorsForDomain(domain, false); 146 return ElemHide.getSelectorsForDomain(domain, false);
128 } 147 }
129 }; 148 };
130 })(); 149 })();
OLDNEW

Powered by Google App Engine
This is Rietveld