| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // The icon might be added already, make sure its state is correct | 402 // The icon might be added already, make sure its state is correct |
| 403 this.updateState(); | 403 this.updateState(); |
| 404 | 404 |
| 405 // Listen for pref and filters changes | 405 // Listen for pref and filters changes |
| 406 Prefs.addListener(function(name) | 406 Prefs.addListener(function(name) |
| 407 { | 407 { |
| 408 if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaul
tstatusbaraction") | 408 if (name == "enabled" || name == "defaulttoolbaraction" || name == "defaul
tstatusbaraction") |
| 409 this.updateState(); | 409 this.updateState(); |
| 410 else if (name == "showinstatusbar") | 410 else if (name == "showinstatusbar") |
| 411 { | 411 { |
| 412 for (let window in this.applicationWindows) | 412 for (let window of this.applicationWindows) |
| 413 this.updateStatusbarIcon(window); | 413 this.updateStatusbarIcon(window); |
| 414 } | 414 } |
| 415 }.bind(this)); | 415 }.bind(this)); |
| 416 FilterNotifier.addListener(function(action) | 416 FilterNotifier.addListener(function(action) |
| 417 { | 417 { |
| 418 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") | 418 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio
n) || action == "load") |
| 419 this.updateState(); | 419 this.updateState(); |
| 420 }.bind(this)); | 420 }.bind(this)); |
| 421 | 421 |
| 422 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); | 422 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 let {defaultToolbarPosition} = require("appSupport"); | 1078 let {defaultToolbarPosition} = require("appSupport"); |
| 1079 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition
.parent); | 1079 CustomizableUI.addWidgetToArea("abp-toolbarbutton", defaultToolbarPosition
.parent); |
| 1080 } | 1080 } |
| 1081 }, | 1081 }, |
| 1082 | 1082 |
| 1083 /** | 1083 /** |
| 1084 * Updates Adblock Plus icon state for all windows. | 1084 * Updates Adblock Plus icon state for all windows. |
| 1085 */ | 1085 */ |
| 1086 updateState: function() | 1086 updateState: function() |
| 1087 { | 1087 { |
| 1088 for (let window in this.applicationWindows) | 1088 for (let window of this.applicationWindows) |
| 1089 { | 1089 { |
| 1090 this.updateIconState(window, window.document.getElementById("abp-status"))
; | 1090 this.updateIconState(window, window.document.getElementById("abp-status"))
; |
| 1091 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); | 1091 this.updateIconState(window, window.document.getElementById("abp-toolbarbu
tton")); |
| 1092 } | 1092 } |
| 1093 }, | 1093 }, |
| 1094 | 1094 |
| 1095 /** | 1095 /** |
| 1096 * Updates Adblock Plus icon state for a single application window. | 1096 * Updates Adblock Plus icon state for a single application window. |
| 1097 */ | 1097 */ |
| 1098 updateIconState: function(/**Window*/ window, /**Element*/ icon) | 1098 updateIconState: function(/**Window*/ window, /**Element*/ icon) |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], | 1959 ["abp-command-togglesync", "command", UI.toggleSync.bind(UI)], |
| 1960 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], | 1960 ["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)], |
| 1961 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], | 1961 ["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showi
nstatusbar")], |
| 1962 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], | 1962 ["abp-command-enable", "command", UI.togglePref.bind(UI, "enabled")], |
| 1963 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], | 1963 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], |
| 1964 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] | 1964 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] |
| 1965 ]; | 1965 ]; |
| 1966 | 1966 |
| 1967 onShutdown.add(function() | 1967 onShutdown.add(function() |
| 1968 { | 1968 { |
| 1969 for (let window in UI.applicationWindows) | 1969 for (let window of UI.applicationWindows) |
| 1970 if (UI.isBottombarOpen(window)) | 1970 if (UI.isBottombarOpen(window)) |
| 1971 UI.toggleBottombar(window); | 1971 UI.toggleBottombar(window); |
| 1972 }); | 1972 }); |
| OLD | NEW |