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

Side by Side Diff: lib/init.js

Issue 10862008: Automatically add default filter subscription when necessary. (Closed)
Patch Set: Created May 27, 2013, 2:12 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 | « include/AdblockPlus/JsEngine.h ('k') | lib/utils.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 require("filterNotifier").FilterNotifier.addListener(function(action) 1 require("filterNotifier").FilterNotifier.addListener(function(action)
2 { 2 {
3 if (action === "load") 3 if (action === "load")
4 {
5 let {FilterStorage} = require("filterStorage");
6 if (FilterStorage.subscriptions.length == 0)
7 {
8 // No data, must be a new user or someone with corrupted data - initialize
9 // with default settings
10 let {Subscription, DownloadableSubscription} = require("subscriptionClasse s");
11 let {Synchronizer} = require("synchronizer");
12 let {Prefs} = require("prefs");
13 let {Utils} = require("utils");
14
15 // Choose default subscription and add it
16 let subscriptions = require("subscriptions.xml");
17 let node = Utils.chooseFilterSubscription(subscriptions);
18 if (node)
19 {
20 let subscription = Subscription.fromURL(node.url);
21 FilterStorage.addSubscription(subscription);
22 subscription.disabled = false;
23 subscription.title = node.title;
24 subscription.homepage = node.homepage;
25 if (subscription instanceof DownloadableSubscription && !subscription.la stDownload)
26 Synchronizer.execute(subscription);
27 }
28 }
29
4 _triggerEvent("init"); 30 _triggerEvent("init");
31 }
5 }); 32 });
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | lib/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld