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: Mockup simplification and validation update Created July 14, 2015, 6:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | locale/en-US/options.json » ('j') | messageResponder.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 modules.filterValidation =
157 {
158 parseFilter: function(text)
159 {
160 var filterError = {filterError: false};
161 updateFromURL(filterError);
Thomas Greiner 2015/07/15 08:32:35 Add this parameter to the README.
saroyanm 2015/07/15 10:47:08 Done.
162 if (filterError)
Sebastian Noack 2015/07/15 09:00:44 This will always be true. It should be |filterErro
saroyanm 2015/07/15 10:47:11 Done.
163 return {error: "Filter-parsing-error-occurred"};
Thomas Greiner 2015/07/15 08:32:36 I'd suggest to use all lower-case for consistency
saroyanm 2015/07/15 10:47:08 Done.
164 return {filter: modules.filterClasses.Filter.fromText(text)};
165 },
166 parseFilters: function(text)
167 {
168 return {filters: text.split("\n").map(modules.filterClasses.Filter.fromTex t)};
Thomas Greiner 2015/07/15 08:32:35 This line exceeds the 80 characters limit.
Sebastian Noack 2015/07/15 09:00:44 You don't consider the filter filterError URL para
saroyanm 2015/07/15 10:47:09 Done.
saroyanm 2015/07/15 10:47:11 Done.
169 }
170 };
171
156 modules.synchronizer = { 172 modules.synchronizer = {
157 Synchronizer: {} 173 Synchronizer: {}
158 }; 174 };
159 175
160 modules.matcher = { 176 modules.matcher = {
161 defaultMatcher: { 177 defaultMatcher: {
162 matchesAny: function(url, requestType, docDomain, thirdParty) 178 matchesAny: function(url, requestType, docDomain, thirdParty)
163 { 179 {
164 var params = {blockedURLs: ""}; 180 var params = {blockedURLs: ""};
165 updateFromURL(params); 181 updateFromURL(params);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 { 230 {
215 return parseFloat(v1) - parseFloat(v2); 231 return parseFloat(v1) - parseFloat(v2);
216 } 232 }
217 } 233 }
218 }; 234 };
219 235
220 var filters = [ 236 var filters = [
221 "@@||alternate.de^$document", 237 "@@||alternate.de^$document",
222 "@@||der.postillion.com^$document", 238 "@@||der.postillion.com^$document",
223 "@@||taz.de^$document", 239 "@@||taz.de^$document",
224 "@@||amazon.de^$document" 240 "@@||amazon.de^$document",
241 "||biglemon.am/bg_poster/banner.jpg",
242 "winfuture.de###header_logo_link",
243 "###WerbungObenRechts10_GesamtDIV",
244 "###WerbungObenRechts8_GesamtDIV",
245 "###WerbungObenRechts9_GesamtDIV",
246 "###WerbungUntenLinks4_GesamtDIV",
247 "###WerbungUntenLinks7_GesamtDIV",
248 "###WerbungUntenLinks8_GesamtDIV",
249 "###WerbungUntenLinks9_GesamtDIV",
250 "###Werbung_Sky",
251 "###Werbung_Wide",
252 "###__ligatus_placeholder__",
253 "###ad-bereich1-08",
254 "###ad-bereich1-superbanner",
255 "###ad-bereich2-08",
256 "###ad-bereich2-skyscrapper"
225 ]; 257 ];
226 var knownFilters = filters.map(modules.filterClasses.Filter.fromText); 258 var knownFilters = filters.map(modules.filterClasses.Filter.fromText);
227 259
228 var subscriptions = [ 260 var subscriptions = [
229 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", 261 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt",
230 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", 262 "https://easylist-downloads.adblockplus.org/exceptionrules.txt",
231 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", 263 "https://easylist-downloads.adblockplus.org/fanboy-social.txt",
232 "~user~786254" 264 "~user~786254"
233 ]; 265 ];
234 var knownSubscriptions = Object.create(null); 266 var knownSubscriptions = Object.create(null);
(...skipping 18 matching lines...) Expand all
253 type: "message", 285 type: "message",
254 payload: { 286 payload: {
255 title: "Custom subscription", 287 title: "Custom subscription",
256 url: "http://example.com/custom.txt", 288 url: "http://example.com/custom.txt",
257 type: "add-subscription" 289 type: "add-subscription"
258 } 290 }
259 }, "*"); 291 }, "*");
260 }, 1000); 292 }, 1000);
261 } 293 }
262 })(this); 294 })(this);
OLDNEW
« no previous file with comments | « no previous file | locale/en-US/options.json » ('j') | messageResponder.js » ('J')

Powered by Google App Engine
This is Rietveld