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

Delta Between Two Patch Sets: background.js

Issue 29329095: Issue 2747 - Added empty state for tables in options page (Closed)
Left Patch Set: Created Oct. 13, 2015, 2:24 p.m.
Right Patch Set: Created Dec. 11, 2015, 4:48 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 | « no previous file | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 56 {
57 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); 57 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
58 } 58 }
59 } 59 }
60 }; 60 };
61 61
62 modules.prefs = { 62 modules.prefs = {
63 Prefs: { 63 Prefs: {
64 "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org /exceptionrules.txt" 64 "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org /exceptionrules.txt"
65 } 65 }
66 } 66 };
67 67
68 modules.subscriptionClasses = { 68 modules.subscriptionClasses = {
69 Subscription: function(url) 69 Subscription: function(url)
70 { 70 {
71 this.url = url; 71 this.url = url;
72 this.title = "Subscription " + url; 72 this.title = "Subscription " + url;
73 this.disabled = false; 73 this.disabled = false;
74 this.lastDownload = 1234; 74 this.lastDownload = 1234;
75 }, 75 },
76 76
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 this.disabled = false; 157 this.disabled = false;
158 } 158 }
159 }; 159 };
160 modules.filterClasses.Filter.fromText = function(text) 160 modules.filterClasses.Filter.fromText = function(text)
161 { 161 {
162 return new modules.filterClasses.Filter(text); 162 return new modules.filterClasses.Filter(text);
163 }; 163 };
164 164
165 modules.filterValidation = 165 modules.filterValidation =
166 { 166 {
167 parseFilter: function(text) 167 parseFilter: function(text)
168 { 168 {
169
170 if (params.filterError) 169 if (params.filterError)
171 return {error: "Invalid filter"}; 170 return {error: "Invalid filter"};
172 return {filter: modules.filterClasses.Filter.fromText(text)}; 171 return {filter: modules.filterClasses.Filter.fromText(text)};
173 }, 172 },
174 parseFilters: function(text) 173 parseFilters: function(text)
175 { 174 {
176 if (params.filterError) 175 if (params.filterError)
177 return {errors: ["Invalid filter"]}; 176 return {errors: ["Invalid filter"]};
178 return { 177 return {
179 filters: text.split("\n") 178 filters: text.split("\n")
180 .filter(function(filter) {return !!filter;}) 179 .filter(function(filter) {return !!filter;})
saroyanm 2015/11/30 11:24:21 nice.
181 .map(modules.filterClasses.Filter.fromText), 180 .map(modules.filterClasses.Filter.fromText),
182 errors: [] 181 errors: []
183 }; 182 };
184 } 183 }
185 }; 184 };
186 185
187 modules.synchronizer = { 186 modules.synchronizer = {
188 Synchronizer: {} 187 Synchronizer: {}
189 }; 188 };
190 189
191 modules.matcher = { 190 modules.matcher = {
192 defaultMatcher: { 191 defaultMatcher: {
193 matchesAny: function(url, requestType, docDomain, thirdParty) 192 matchesAny: function(url, requestType, docDomain, thirdParty)
194 { 193 {
195 var blocked = params.blockedURLs.split(","); 194 var blocked = params.blockedURLs.split(",");
196 if (blocked.indexOf(url) >= 0) 195 if (blocked.indexOf(url) >= 0)
197 return new modules.filterClasses.BlockingFilter(); 196 return new modules.filterClasses.BlockingFilter();
198 else 197 else
199 return null; 198 return null;
200 } 199 }
201 } 200 }
202 }; 201 };
203 202
203 modules.cssRules = {
204 CSSRules: {
205 getRulesForDomain: function(domain) { }
206 }
207 };
208
204 var notifierListeners = []; 209 var notifierListeners = [];
205 modules.filterNotifier = { 210 modules.filterNotifier = {
206 FilterNotifier: { 211 FilterNotifier: {
207 addListener: function(listener) 212 addListener: function(listener)
208 { 213 {
209 if (notifierListeners.indexOf(listener) < 0) 214 if (notifierListeners.indexOf(listener) < 0)
210 notifierListeners.push(listener); 215 notifierListeners.push(listener);
211 }, 216 },
212 217
213 removeListener: function(listener) 218 removeListener: function(listener)
(...skipping 27 matching lines...) Expand all
241 vc: { 246 vc: {
242 compare: function(v1, v2) 247 compare: function(v1, v2)
243 { 248 {
244 return parseFloat(v1) - parseFloat(v2); 249 return parseFloat(v1) - parseFloat(v2);
245 } 250 }
246 } 251 }
247 }; 252 };
248 253
249 var filters = [ 254 var filters = [
250 "@@||alternate.de^$document", 255 "@@||alternate.de^$document",
251 "@@||der.postillion.com^$document", 256 "@@||der.postillion.com^$document",
252 "@@||taz.de^$document", 257 "@@||taz.de^$document",
253 "@@||amazon.de^$document", 258 "@@||amazon.de^$document",
254 "||biglemon.am/bg_poster/banner.jpg", 259 "||biglemon.am/bg_poster/banner.jpg",
255 "winfuture.de###header_logo_link", 260 "winfuture.de###header_logo_link",
256 "###WerbungObenRechts10_GesamtDIV", 261 "###WerbungObenRechts10_GesamtDIV",
257 "###WerbungObenRechts8_GesamtDIV", 262 "###WerbungObenRechts8_GesamtDIV",
258 "###WerbungObenRechts9_GesamtDIV", 263 "###WerbungObenRechts9_GesamtDIV",
259 "###WerbungUntenLinks4_GesamtDIV", 264 "###WerbungUntenLinks4_GesamtDIV",
260 "###WerbungUntenLinks7_GesamtDIV", 265 "###WerbungUntenLinks7_GesamtDIV",
261 "###WerbungUntenLinks8_GesamtDIV", 266 "###WerbungUntenLinks8_GesamtDIV",
(...skipping 14 matching lines...) Expand all
276 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", 281 "https://easylist-downloads.adblockplus.org/fanboy-social.txt",
277 "~user~786254" 282 "~user~786254"
278 ]; 283 ];
279 var knownSubscriptions = Object.create(null); 284 var knownSubscriptions = Object.create(null);
280 for (var subscriptionUrl of subscriptions) 285 for (var subscriptionUrl of subscriptions)
281 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl); 286 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl);
282 var customSubscription = knownSubscriptions["~user~786254"]; 287 var customSubscription = knownSubscriptions["~user~786254"];
283 288
284 global.seenDataCorruption = params.seenDataCorruption; 289 global.seenDataCorruption = params.seenDataCorruption;
285 global.filterlistsReinitialized = params.filterlistsReinitialized; 290 global.filterlistsReinitialized = params.filterlistsReinitialized;
286 291
287 if (params.addSubscription) 292 if (params.addSubscription)
288 { 293 {
289 // We don't know how long it will take for the page to fully load 294 // We don't know how long it will take for the page to fully load
290 // so we'll post the message after one second 295 // so we'll post the message after one second
291 setTimeout(function() 296 setTimeout(function()
292 { 297 {
293 window.postMessage({ 298 window.postMessage({
294 type: "message", 299 type: "message",
295 payload: { 300 payload: {
296 title: "Custom subscription", 301 title: "Custom subscription",
297 url: "http://example.com/custom.txt", 302 url: "http://example.com/custom.txt",
298 type: "add-subscription" 303 type: "add-subscription"
299 } 304 }
300 }, "*"); 305 }, "*");
301 }, 1000); 306 }, 1000);
302 } 307 }
303 })(this); 308 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld