| Left: | ||
| Right: |
| 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 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 function setUninstallURL() | 24 function setUninstallURL() |
| 25 { | 25 { |
| 26 let search = []; | 26 let search = []; |
| 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", | 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", |
| 28 "platform", "platformVersion"]; | 28 "platform", "platformVersion"]; |
| 29 for (let key of keys) | 29 for (let key of keys) |
| 30 search.push(key + "=" + encodeURIComponent(info[key])); | 30 search.push(key + "=" + encodeURIComponent(info[key])); |
| 31 | 31 |
| 32 let downlCount = Prefs.notificationdata.downloadCount || 0; | 32 let downlCount = Prefs.notificationdata.downloadCount || 0; |
| 33 if (typeof(downlCount) == "number" && downlCount > 3) | 33 |
|
Sebastian Noack
2016/02/11 14:31:24
In the downloader module, it's only truncated abov
Sebastian Noack
2016/02/11 14:31:24
Nit: Mind adding a comment that this code is matte
Sebastian Noack
2016/02/11 14:31:24
Nit: typeof is a keyword not a function, so please
kzar
2016/02/11 14:45:20
Done.
kzar
2016/02/11 14:45:20
Done.
kzar
2016/02/11 14:45:20
Acknowledged.
| |
| 34 // FIXME - Once the changes for issue #3650 land and are included we should | |
| 35 // remove this check. (The number will be already truncated for us.) | |
| 36 if (downlCount > 4) | |
| 34 downlCount = "4+"; | 37 downlCount = "4+"; |
| 38 | |
| 35 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | 39 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); |
| 36 | 40 |
| 37 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + | 41 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + |
| 38 search.join("&")); | 42 search.join("&")); |
| 39 } | 43 } |
| 40 | 44 |
| 41 // The uninstall URL contains the notification download count as a parameter, | 45 // The uninstall URL contains the notification download count as a parameter, |
| 42 // therefore we must wait for preferences to be loaded before generating the | 46 // therefore we must wait for preferences to be loaded before generating the |
| 43 // URL and we need to re-generate it each time the notification data changes. | 47 // URL and we need to re-generate it each time the notification data changes. |
| 44 if ("setUninstallURL" in chrome.runtime) | 48 if ("setUninstallURL" in chrome.runtime) |
| 45 { | 49 { |
| 46 Prefs.isLoaded.then(setUninstallURL); | 50 Prefs.isLoaded.then(setUninstallURL); |
| 47 Prefs.onChanged.addListener(function(name) | 51 Prefs.onChanged.addListener(function(name) |
| 48 { | 52 { |
| 49 if (name == "notificationdata") | 53 if (name == "notificationdata") |
| 50 setUninstallURL(); | 54 setUninstallURL(); |
| 51 }); | 55 }); |
| 52 } | 56 } |
| LEFT | RIGHT |