From 56ed13df217639ddad0407d4aaec980a48d17089 Mon Sep 17 00:00:00 2001 From: papush Date: Sun, 29 Aug 2021 12:52:51 +0200 Subject: use a proper toolbar button instead of a statusbar one --- chrome/browserOverlay.xul | 42 +++++++++++++++++++++++------------------- chrome/js/browserOverlay.js | 22 +++++++++++++++------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/chrome/browserOverlay.xul b/chrome/browserOverlay.xul index 50e0cde..5859a93 100644 --- a/chrome/browserOverlay.xul +++ b/chrome/browserOverlay.xul @@ -1,4 +1,5 @@ + @@ -8,23 +9,26 @@ - - - - - - - - - - - + + + + + + + + + + + + diff --git a/chrome/js/browserOverlay.js b/chrome/js/browserOverlay.js index bfaff90..39066b8 100644 --- a/chrome/js/browserOverlay.js +++ b/chrome/js/browserOverlay.js @@ -37,17 +37,15 @@ var RedirectorOverlay = { }, changedPrefs : function(prefs) { - var statusImg = document.getElementById('redirector-statusbar-img'); + var button = document.getElementById('redirector-button'); if (prefs.enabled) { - statusImg.src = 'chrome://redirector/content/images/statusactive.png' - statusImg.setAttribute('tooltiptext', this.strings.getString('enabledTooltip')); + button.setAttribute('disabled', true); } else { - statusImg.src = 'chrome://redirector/content/images/statusinactive.png' - statusImg.setAttribute('tooltiptext', this.strings.getString('disabledTooltip')); + button.removeAttribute('disabled'); } - document.getElementById('redirector-status').hidden = !prefs.showStatusBarIcon; + // document.getElementById('redirector-status').hidden = !prefs.showStatusBarIcon; document.getElementById('redirector-context').hidden = !prefs.showContextMenu; }, @@ -72,8 +70,17 @@ var RedirectorOverlay = { this.openSettings(); }, - toggleEnabled : function(event) { + toggleEnabled: function(event) { this.prefs.enabled = !this.prefs.enabled; + let button = document.getElementById("redirector-button"); + let item = document.getElementById("redirector-enabled-item"); + if (this.prefs.enabled) { + button.removeAttribute('disabled'); + item.setAttribute('checked', true); + } else { + button.setAttribute('disabled', 'yes'); + item.setAttribute('checked', false); + } }, openSettings : function() { @@ -81,6 +88,7 @@ var RedirectorOverlay = { }, statusBarClick : function(event) { + Redirector.debug('REDIRECTOR: click'); var LEFT = 0, RIGHT = 2; if (event.button == LEFT) { -- cgit v1.2.3-70-g09d2