| OLD | NEW |
| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(line); | 186 let match = /\[Adblock(?:\s*Plus\s*([\d\.]+)?)?\]/i.exec(line); |
| 187 if (match) | 187 if (match) |
| 188 { | 188 { |
| 189 let warning = E("backupButton").getAttribute("_restoreCustomWarning"
); | 189 let warning = E("backupButton").getAttribute("_restoreCustomWarning"
); |
| 190 let minVersion = match[1]; | 190 let minVersion = match[1]; |
| 191 if (minVersion && Utils.versionComparator.compare(minVersion, Utils.
addonVersion) > 0) | 191 if (minVersion && Utils.versionComparator.compare(minVersion, Utils.
addonVersion) > 0) |
| 192 warning += "\n\n" + E("backupButton").getAttribute("_restoreVersio
nWarning"); | 192 warning += "\n\n" + E("backupButton").getAttribute("_restoreVersio
nWarning"); |
| 193 | 193 |
| 194 if (Utils.confirm(window, warning, E("backupButton").getAttribute("_
restoreDialogTitle"))) | 194 if (Utils.confirm(window, warning, E("backupButton").getAttribute("_
restoreDialogTitle"))) |
| 195 { | 195 { |
| 196 let subscriptions = FilterStorage.subscriptions.filter(function(s)
s instanceof SpecialSubscription); | 196 let subscriptions = FilterStorage.subscriptions.filter(s => s inst
anceof SpecialSubscription); |
| 197 for (let i = 0; i < subscriptions.length; i++) | 197 for (let i = 0; i < subscriptions.length; i++) |
| 198 FilterStorage.removeSubscription(subscriptions[i]); | 198 FilterStorage.removeSubscription(subscriptions[i]); |
| 199 | 199 |
| 200 return; | 200 return; |
| 201 } | 201 } |
| 202 else | 202 else |
| 203 throw Cr.NS_BASE_STREAM_WOULD_BLOCK; | 203 throw Cr.NS_BASE_STREAM_WOULD_BLOCK; |
| 204 } | 204 } |
| 205 else | 205 else |
| 206 throw new Error("Invalid file"); | 206 throw new Error("Invalid file"); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 backupAllData: function(/**nsIFile*/ file) | 283 backupAllData: function(/**nsIFile*/ file) |
| 284 { | 284 { |
| 285 FilterStorage.saveToDisk(file); | 285 FilterStorage.saveToDisk(file); |
| 286 }, | 286 }, |
| 287 | 287 |
| 288 /** | 288 /** |
| 289 * Writes user's custom filters to a file. | 289 * Writes user's custom filters to a file. |
| 290 */ | 290 */ |
| 291 backupCustomFilters: function(/**nsIFile*/ file) | 291 backupCustomFilters: function(/**nsIFile*/ file) |
| 292 { | 292 { |
| 293 let subscriptions = FilterStorage.subscriptions.filter(function(s) s instanc
eof SpecialSubscription); | 293 let subscriptions = FilterStorage.subscriptions.filter(s => s instanceof Spe
cialSubscription); |
| 294 let minVersion = "2.0" | 294 let minVersion = "2.0" |
| 295 let list = []; | 295 let list = []; |
| 296 for (let i = 0; i < subscriptions.length; i++) | 296 for (let i = 0; i < subscriptions.length; i++) |
| 297 { | 297 { |
| 298 let subscription = subscriptions[i]; | 298 let subscription = subscriptions[i]; |
| 299 let typeAddition = ""; | 299 let typeAddition = ""; |
| 300 if (subscription.defaults) | 300 if (subscription.defaults) |
| 301 typeAddition = "/" + subscription.defaults.join("/"); | 301 typeAddition = "/" + subscription.defaults.join("/"); |
| 302 list.push("! [" + subscription.title + "]" + typeAddition); | 302 list.push("! [" + subscription.title + "]" + typeAddition); |
| 303 for (let j = 0; j < subscription.filters.length; j++) | 303 for (let j = 0; j < subscription.filters.length; j++) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b
ackupButton").getAttribute("_backupDialogTitle")); | 339 Utils.alert(window, E("backupButton").getAttribute("_backupError"), E("b
ackupButton").getAttribute("_backupDialogTitle")); |
| 340 } | 340 } |
| 341 }); | 341 }); |
| 342 } | 342 } |
| 343 }; | 343 }; |
| 344 | 344 |
| 345 window.addEventListener("load", function() | 345 window.addEventListener("load", function() |
| 346 { | 346 { |
| 347 Backup.init(); | 347 Backup.init(); |
| 348 }, false); | 348 }, false); |
| OLD | NEW |