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() |
| 19 { |
| 20 "use strict"; |
| 21 |
| 22 let prefs = require("prefs"); |
| 23 |
| 24 function setUninstallURL() |
| 25 { |
| 26 let uninstall_url = "https://adblockplus.org/en/uninstall-abp"; |
| 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]) |
| 37 search.push(key + "=" + encodeURIComponent(module_key[0][key])); |
| 38 |
| 39 let downlCount = prefs.Prefs.notificationdata.downloadCount || 0; |
| 40 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); |
| 41 |
| 42 chrome.runtime.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); |
| 52 prefs.Prefs.onChanged.addListener(function(name) |
| 53 { |
| 54 if (name == "notificationdata") |
| 55 setUninstallURL(); |
| 56 }); |
| 57 }()); |
OLD | NEW |