aboutsummaryrefslogtreecommitdiff
path: root/chrome/js/browserOverlay.js
diff options
context:
space:
mode:
authorpapush2021-08-29 14:35:04 +0200
committerpapush2021-08-29 14:35:04 +0200
commit35050a40d1336f162041c328f4f589fe1adebf0e (patch)
tree2b0a4613efb33b690342131c9ea0e6e2ec756a3e /chrome/js/browserOverlay.js
parent56ed13df217639ddad0407d4aaec980a48d17089 (diff)
add a refreshUI method to RedirectorOverlay to update the UI state
Diffstat (limited to 'chrome/js/browserOverlay.js')
-rw-r--r--chrome/js/browserOverlay.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/chrome/js/browserOverlay.js b/chrome/js/browserOverlay.js
index 39066b8..2767d7b 100644
--- a/chrome/js/browserOverlay.js
+++ b/chrome/js/browserOverlay.js
@@ -38,15 +38,8 @@ var RedirectorOverlay = {
changedPrefs : function(prefs) {
var button = document.getElementById('redirector-button');
-
- if (prefs.enabled) {
- button.setAttribute('disabled', true);
- } else {
- button.removeAttribute('disabled');
- }
-
- // document.getElementById('redirector-status').hidden = !prefs.showStatusBarIcon;
document.getElementById('redirector-context').hidden = !prefs.showContextMenu;
+ this.refreshUI();
},
showContextMenu : function(event) {
@@ -70,8 +63,7 @@ var RedirectorOverlay = {
this.openSettings();
},
- toggleEnabled: function(event) {
- this.prefs.enabled = !this.prefs.enabled;
+ refreshUI: function() {
let button = document.getElementById("redirector-button");
let item = document.getElementById("redirector-enabled-item");
if (this.prefs.enabled) {
@@ -83,6 +75,11 @@ var RedirectorOverlay = {
}
},
+ toggleEnabled: function(event) {
+ this.prefs.enabled = !this.prefs.enabled;
+ this.refreshUI();
+ },
+
openSettings : function() {
gBrowser.selectedTab = gBrowser.addTab("chrome://redirector/content/redirector.html");
},