| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 (function() | |
|
Sebastian Noack
2015/12/09 17:37:31
Once you made this a proper module the IIFE will b
kzar
2015/12/10 14:28:20
Done.
| |
| 19 { | |
| 20 "use strict"; | |
| 21 | |
| 22 let prefs = require("prefs"); | |
|
Sebastian Noack
2015/12/09 17:37:31
Nit: let {Prefs} = require("prefs");
kzar
2015/12/10 14:28:20
Done.
| |
| 23 | |
| 24 function setUninstallURL() | |
| 25 { | |
| 26 let uninstall_url = "https://adblockplus.org/en/uninstall-abp"; | |
|
Sebastian Noack
2015/12/09 17:37:31
Please use camel-case consistently.
Sebastian Noack
2015/12/09 17:37:31
Please don't hard code the language part of the UR
kzar
2015/12/10 14:28:20
Done. (Opened issue 3403 for the redirection)
kzar
2015/12/10 14:28:20
Done.
| |
| 27 let module_keys = [ | |
| 28 [require("info"), ["addonName", "addonVersion", "application", | |
| 29 "applicationVersion", "platform", "platformVersion"]], | |
| 30 [require("utils").Utils, ["appLocale"]] | |
| 31 ]; | |
| 32 | |
| 33 let search = []; | |
| 34 for (let module_key of module_keys) | |
| 35 for (let key of module_key[1]) | |
| 36 if (key in module_key[0]) | |
|
Sebastian Noack
2015/12/09 17:37:31
I don't see why that check would be necessary.
kzar
2015/12/10 14:28:20
Done.
| |
| 37 search.push(key + "=" + encodeURIComponent(module_key[0][key])); | |
| 38 | |
| 39 let downlCount = prefs.Prefs.notificationdata.downloadCount || 0; | |
| 40 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | |
|
Sebastian Noack
2015/12/09 17:37:31
You could simplify the loop above if you just hand
kzar
2015/12/10 14:28:20
Done.
| |
| 41 | |
| 42 ext.setUninstallURL(uninstall_url + "?" + search.join("&")); | |
| 43 } | |
| 44 | |
| 45 // The uninstall URL contains the notification download count as a parameter, | |
| 46 // therefore we must wait for preferences to be loaded before generating the | |
| 47 // URL. (But we're not sure if they have already been loaded so we have to do | |
| 48 // it immediately too!) We also need to re-generate the URL each time the | |
| 49 // notification data changes | |
| 50 setUninstallURL(); | |
| 51 prefs.Prefs.onLoaded.addListener(setUninstallURL); | |
|
Sebastian Noack
2015/12/09 17:37:31
You should remove the listener once it has been ca
kzar
2015/12/10 14:28:20
Done.
| |
| 52 prefs.Prefs.onChanged.addListener(function(name) | |
| 53 { | |
| 54 if (name == "notificationdata") | |
| 55 setUninstallURL(); | |
| 56 }); | |
| 57 }()); | |
| OLD | NEW |