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

Side by Side Diff: background.js

Issue 29321198: Issue 2376 - Implement custom filters in new options page (Closed)
Patch Set: Added param to readme and some fixes Created July 15, 2015, 10:36 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 Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 { 146 {
147 this.text = text; 147 this.text = text;
148 this.disabled = false; 148 this.disabled = false;
149 } 149 }
150 }; 150 };
151 modules.filterClasses.Filter.fromText = function(text) 151 modules.filterClasses.Filter.fromText = function(text)
152 { 152 {
153 return new modules.filterClasses.Filter(text); 153 return new modules.filterClasses.Filter(text);
154 }; 154 };
155 155
156 var validation = {filterError: false};
Sebastian Noack 2015/07/15 11:20:00 I wonder whether it would make more sense meanwhil
Thomas Greiner 2015/07/15 11:31:40 They're all globally accessible anyway and don't c
saroyanm 2015/07/15 12:06:52 Done.
157 updateFromURL(validation);
158 modules.filterValidation =
159 {
160 parseFilter: function(text)
161 {
162
163 if (validation.filterError)
164 return {error: "filter-parsing-error"};
165 return {filter: modules.filterClasses.Filter.fromText(text)};
166 },
167 parseFilters: function(text)
168 {
169 if (validation.filterError)
170 return {errors: ["filter-parsing-error"]};
171 return {filters:
172 text.split("\n").map(modules.filterClasses.Filter.fromText)};
173 }
174 };
175
156 modules.synchronizer = { 176 modules.synchronizer = {
157 Synchronizer: {} 177 Synchronizer: {}
158 }; 178 };
159 179
160 modules.matcher = { 180 modules.matcher = {
161 defaultMatcher: { 181 defaultMatcher: {
162 matchesAny: function(url, requestType, docDomain, thirdParty) 182 matchesAny: function(url, requestType, docDomain, thirdParty)
163 { 183 {
164 var params = {blockedURLs: ""}; 184 var params = {blockedURLs: ""};
165 updateFromURL(params); 185 updateFromURL(params);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 { 234 {
215 return parseFloat(v1) - parseFloat(v2); 235 return parseFloat(v1) - parseFloat(v2);
216 } 236 }
217 } 237 }
218 }; 238 };
219 239
220 var filters = [ 240 var filters = [
221 "@@||alternate.de^$document", 241 "@@||alternate.de^$document",
222 "@@||der.postillion.com^$document", 242 "@@||der.postillion.com^$document",
223 "@@||taz.de^$document", 243 "@@||taz.de^$document",
224 "@@||amazon.de^$document" 244 "@@||amazon.de^$document",
245 "||biglemon.am/bg_poster/banner.jpg",
246 "winfuture.de###header_logo_link",
247 "###WerbungObenRechts10_GesamtDIV",
248 "###WerbungObenRechts8_GesamtDIV",
249 "###WerbungObenRechts9_GesamtDIV",
250 "###WerbungUntenLinks4_GesamtDIV",
251 "###WerbungUntenLinks7_GesamtDIV",
252 "###WerbungUntenLinks8_GesamtDIV",
253 "###WerbungUntenLinks9_GesamtDIV",
254 "###Werbung_Sky",
255 "###Werbung_Wide",
256 "###__ligatus_placeholder__",
257 "###ad-bereich1-08",
258 "###ad-bereich1-superbanner",
259 "###ad-bereich2-08",
260 "###ad-bereich2-skyscrapper"
225 ]; 261 ];
226 var knownFilters = filters.map(modules.filterClasses.Filter.fromText); 262 var knownFilters = filters.map(modules.filterClasses.Filter.fromText);
227 263
228 var subscriptions = [ 264 var subscriptions = [
229 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", 265 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt",
230 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", 266 "https://easylist-downloads.adblockplus.org/exceptionrules.txt",
231 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", 267 "https://easylist-downloads.adblockplus.org/fanboy-social.txt",
232 "~user~786254" 268 "~user~786254"
233 ]; 269 ];
234 var knownSubscriptions = Object.create(null); 270 var knownSubscriptions = Object.create(null);
(...skipping 18 matching lines...) Expand all
253 type: "message", 289 type: "message",
254 payload: { 290 payload: {
255 title: "Custom subscription", 291 title: "Custom subscription",
256 url: "http://example.com/custom.txt", 292 url: "http://example.com/custom.txt",
257 type: "add-subscription" 293 type: "add-subscription"
258 } 294 }
259 }, "*"); 295 }, "*");
260 }, 1000); 296 }, 1000);
261 } 297 }
262 })(this); 298 })(this);
OLDNEW
« README.md ('K') | « README.md ('k') | locale/en-US/options.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld