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

Delta Between Two Patch Sets: background.js

Issue 29321198: Issue 2376 - Implement custom filters in new options page (Closed)
Left Patch Set: Small fixes Created July 15, 2015, 12:04 p.m.
Right Patch Set: Nit fixes Created July 15, 2015, 2:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « README.md ('k') | locale/en-US/options.json » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 20 matching lines...) Expand all
31 } 31 }
32 } 32 }
33 33
34 var params = { 34 var params = {
35 blockedURLs: "", 35 blockedURLs: "",
36 seenDataCorruption: false, 36 seenDataCorruption: false,
37 filterlistsReinitialized: false, 37 filterlistsReinitialized: false,
38 addSubscription: false, 38 addSubscription: false,
39 filterError: false 39 filterError: false
40 }; 40 };
41 updateFromURL(params); 41 updateFromURL(params);
Sebastian Noack 2015/07/15 14:30:08 Nit: There should be an empty line below.
saroyanm 2015/07/15 14:36:05 Done.
42
42 var modules = {}; 43 var modules = {};
43 global.require = function(module) 44 global.require = function(module)
44 { 45 {
45 return modules[module]; 46 return modules[module];
46 }; 47 };
47 48
48 modules.utils = { 49 modules.utils = {
49 Utils: { 50 Utils: {
50 getDocLink: function(link) 51 getDocLink: function(link)
51 { 52 {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 { 161 {
161 return new modules.filterClasses.Filter(text); 162 return new modules.filterClasses.Filter(text);
162 }; 163 };
163 164
164 modules.filterValidation = 165 modules.filterValidation =
165 { 166 {
166 parseFilter: function(text) 167 parseFilter: function(text)
167 { 168 {
168 169
169 if (params.filterError) 170 if (params.filterError)
170 return {error: "filter-parsing-error"}; 171 return {error: "Invalid filter"};
Sebastian Noack 2015/07/15 14:30:08 Nit: This is human readable text. So no need for d
saroyanm 2015/07/15 14:36:05 Done.
171 return {filter: modules.filterClasses.Filter.fromText(text)}; 172 return {filter: modules.filterClasses.Filter.fromText(text)};
172 }, 173 },
173 parseFilters: function(text) 174 parseFilters: function(text)
174 { 175 {
175 if (params.filterError) 176 if (params.filterError)
176 return {errors: ["filter-parsing-error"]}; 177 return {errors: ["Invalid filter"]};
177 return {filters: 178 return {filters:
178 text.split("\n").map(modules.filterClasses.Filter.fromText)}; 179 text.split("\n").map(modules.filterClasses.Filter.fromText)};
179 } 180 }
180 }; 181 };
181 182
182 modules.synchronizer = { 183 modules.synchronizer = {
183 Synchronizer: {} 184 Synchronizer: {}
184 }; 185 };
185 186
186 modules.matcher = { 187 modules.matcher = {
(...skipping 28 matching lines...) Expand all
215 triggerListeners: function() 216 triggerListeners: function()
216 { 217 {
217 var args = Array.prototype.slice.apply(arguments); 218 var args = Array.prototype.slice.apply(arguments);
218 var listeners = notifierListeners.slice(); 219 var listeners = notifierListeners.slice();
219 for (var i = 0; i < listeners.length; i++) 220 for (var i = 0; i < listeners.length; i++)
220 listeners[i].apply(null, args); 221 listeners[i].apply(null, args);
221 } 222 }
222 } 223 }
223 }; 224 };
224 225
225 modules.info = { 226 modules.info = {
saroyanm 2015/07/15 12:06:53 I can't find if we are using it somewhere. Do we
Thomas Greiner 2015/07/15 12:29:35 Yes, this is being used for the first-run page. Yo
saroyanm 2015/07/15 12:34:58 Got it.
226 platform: "gecko", 227 platform: "gecko",
227 platformVersion: "34.0", 228 platformVersion: "34.0",
228 application: "firefox", 229 application: "firefox",
229 applicationVersion: "34.0", 230 applicationVersion: "34.0",
230 addonName: "adblockplus", 231 addonName: "adblockplus",
231 addonVersion: "2.6.7" 232 addonVersion: "2.6.7"
232 }; 233 };
233 updateFromURL(modules.info); 234 updateFromURL(modules.info);
234 235
235 global.Services = { 236 global.Services = {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 type: "message", 290 type: "message",
290 payload: { 291 payload: {
291 title: "Custom subscription", 292 title: "Custom subscription",
292 url: "http://example.com/custom.txt", 293 url: "http://example.com/custom.txt",
293 type: "add-subscription" 294 type: "add-subscription"
294 } 295 }
295 }, "*"); 296 }, "*");
296 }, 1000); 297 }, 1000);
297 } 298 }
298 })(this); 299 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld