OLD | NEW |
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 }); |
OLD | NEW |