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

Side by Side Diff: background.js

Issue 29333819: Issue 2375 - Implement "Blocking lists" section in new options page (Closed)
Patch Set: Created Jan. 18, 2016, 9:50 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
« no previous file with comments | « no previous file | locale/en-US/options.json » ('j') | locale/en-US/options.json » ('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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 this.downloadStatus = "synchronize_ok";
75 }, 76 },
76 77
77 SpecialSubscription: function(url) 78 SpecialSubscription: function(url)
78 { 79 {
79 this.url = url; 80 this.url = url;
80 this.disabled = false; 81 this.disabled = false;
81 this.filters = knownFilters.slice(); 82 this.filters = knownFilters.slice();
82 } 83 }
83 }; 84 };
84 modules.subscriptionClasses.Subscription.fromURL = function(url) 85 modules.subscriptionClasses.Subscription.fromURL = function(url)
85 { 86 {
87 if (url in knownSubscriptions)
88 return knownSubscriptions[url];
89
86 if (/^https?:\/\//.test(url)) 90 if (/^https?:\/\//.test(url))
87 return new modules.subscriptionClasses.Subscription(url); 91 return new modules.subscriptionClasses.Subscription(url);
88 else 92 else
89 return new modules.subscriptionClasses.SpecialSubscription(url); 93 return new modules.subscriptionClasses.SpecialSubscription(url);
90 }; 94 };
91 modules.subscriptionClasses.DownloadableSubscription = modules.subscriptionCla sses.Subscription; 95 modules.subscriptionClasses.DownloadableSubscription = modules.subscriptionCla sses.Subscription;
92 96
93 modules.filterStorage = { 97 modules.filterStorage = {
94 FilterStorage: { 98 FilterStorage: {
95 get subscriptions() 99 get subscriptions()
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return { 181 return {
178 filters: text.split("\n") 182 filters: text.split("\n")
179 .filter(function(filter) {return !!filter;}) 183 .filter(function(filter) {return !!filter;})
180 .map(modules.filterClasses.Filter.fromText), 184 .map(modules.filterClasses.Filter.fromText),
181 errors: [] 185 errors: []
182 }; 186 };
183 } 187 }
184 }; 188 };
185 189
186 modules.synchronizer = { 190 modules.synchronizer = {
187 Synchronizer: {} 191 Synchronizer: {
192 execute: function(subscription, manual)
193 {
194 subscription.lastDownload = Date.now() / 1000;
195 modules.filterNotifier.FilterNotifier.triggerListeners("subscription.upd ated", subscription);
Thomas Greiner 2016/01/19 11:27:26 Since you added error messages as part of this rev
saroyanm 2016/01/22 09:55:03 Done.
196 }
197 }
188 }; 198 };
189 199
190 modules.matcher = { 200 modules.matcher = {
191 defaultMatcher: { 201 defaultMatcher: {
192 matchesAny: function(url, requestType, docDomain, thirdParty) 202 matchesAny: function(url, requestType, docDomain, thirdParty)
193 { 203 {
194 var blocked = params.blockedURLs.split(","); 204 var blocked = params.blockedURLs.split(",");
195 if (blocked.indexOf(url) >= 0) 205 if (blocked.indexOf(url) >= 0)
196 return new modules.filterClasses.BlockingFilter(); 206 return new modules.filterClasses.BlockingFilter();
197 else 207 else
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 type: "message", 309 type: "message",
300 payload: { 310 payload: {
301 title: "Custom subscription", 311 title: "Custom subscription",
302 url: "http://example.com/custom.txt", 312 url: "http://example.com/custom.txt",
303 type: "add-subscription" 313 type: "add-subscription"
304 } 314 }
305 }, "*"); 315 }, "*");
306 }, 1000); 316 }, 1000);
307 } 317 }
308 })(this); 318 })(this);
OLDNEW
« no previous file with comments | « no previous file | locale/en-US/options.json » ('j') | locale/en-US/options.json » ('J')

Powered by Google App Engine
This is Rietveld