LEFT | RIGHT |
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 { | 121 { |
122 let subscription = Subscription.fromURL(downloadable.url); | 122 let subscription = Subscription.fromURL(downloadable.url); |
123 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON
D); | 123 subscription.lastCheck = Math.round(downloadable.lastCheck / MILLIS_IN_SECON
D); |
124 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI
S_IN_SECOND); | 124 subscription.softExpiration = Math.round(downloadable.softExpiration / MILLI
S_IN_SECOND); |
125 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE
COND); | 125 subscription.expires = Math.round(downloadable.hardExpiration / MILLIS_IN_SE
COND); |
126 }, | 126 }, |
127 | 127 |
128 _onDownloadStarted: function(downloadable) | 128 _onDownloadStarted: function(downloadable) |
129 { | 129 { |
130 let subscription = Subscription.fromURL(downloadable.url); | 130 let subscription = Subscription.fromURL(downloadable.url); |
131 subscription.downloadStatus = "in_progress"; | 131 FilterNotifier.triggerListeners("subscription.downloading", subscription); |
132 }, | 132 }, |
133 | 133 |
134 _onDownloadSuccess: function(downloadable, responseText, errorCallback, redire
ctCallback) | 134 _onDownloadSuccess: function(downloadable, responseText, errorCallback, redire
ctCallback) |
135 { | 135 { |
136 let lines = responseText.split(/[\r\n]+/); | 136 let lines = responseText.split(/[\r\n]+/); |
137 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(lines[0]); | 137 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(lines[0]); |
138 if (!match) | 138 if (!match) |
139 return errorCallback("synchronize_invalid_data"); | 139 return errorCallback("synchronize_invalid_data"); |
140 let minVersion = match[1]; | 140 let minVersion = match[1]; |
141 | 141 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j
oin("\n"); | 315 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j
oin("\n"); |
316 redirectCallback("data:text/plain," + encodeURIComponent(data)); | 316 redirectCallback("data:text/plain," + encodeURIComponent(data)); |
317 } | 317 } |
318 }, false); | 318 }, false); |
319 request.send(null); | 319 request.send(null); |
320 } | 320 } |
321 } | 321 } |
322 }, | 322 }, |
323 }; | 323 }; |
324 Synchronizer.init(); | 324 Synchronizer.init(); |
LEFT | RIGHT |