| 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 /** @module uninstall */ | |
| 19 | |
| 20 let {Prefs} = require("prefs"); | |
| 21 | |
| 22 function setUninstallURL() | |
| 23 { | |
| 24 let info = require("info"); | |
| 25 let search = []; | |
| 26 for (let key of ["addonName", "addonVersion", "application", | |
|
Sebastian Noack
2015/12/12 13:43:27
I just rembered that jshydra generates quite crapp
kzar
2015/12/12 14:13:43
Done.
| |
| 27 "applicationVersion", "platform", "platformVersion"]) | |
| 28 search.push(key + "=" + encodeURIComponent(info[key])); | |
| 29 | |
| 30 let downlCount = Prefs.notificationdata.downloadCount || 0; | |
| 31 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | |
| 32 | |
| 33 chrome.runtime.setUninstallURL( | |
| 34 require("utils").Utils.getDocLink("uninstall-abp") + "&" + search.join("&") | |
|
Sebastian Noack
2015/12/12 13:43:27
As mentioned in the issue, I think we should just
Sebastian Noack
2015/12/12 13:43:27
I'd rather keep imports at the top, even if only u
kzar
2015/12/12 14:13:43
Done.
kzar
2015/12/12 14:13:43
Done. (Provisionally, if they disagree on the issu
| |
| 35 ); | |
| 36 } | |
| 37 | |
| 38 function onPrefsLoaded() | |
| 39 { | |
| 40 Prefs.onLoaded.removeListener(onPrefsLoaded); | |
| 41 setUninstallURL(); | |
| 42 } | |
| 43 | |
| 44 // The uninstall URL contains the notification download count as a parameter, | |
| 45 // therefore we must wait for preferences to be loaded before generating the | |
| 46 // URL and we need to re-generate it each time the notification data changes. | |
| 47 Prefs.onLoaded.addListener(onPrefsLoaded); | |
| 48 Prefs.onChanged.addListener(function(name) | |
| 49 { | |
| 50 if (name == "notificationdata") | |
| 51 setUninstallURL(); | |
| 52 }); | |
| OLD | NEW |