diff options
author | papush | 2021-08-29 14:36:42 +0200 |
---|---|---|
committer | papush | 2021-08-29 14:36:42 +0200 |
commit | e17cb4e48ae0d691f92d78ca01efc98213eb9b77 (patch) | |
tree | ba4dea1af1f73448f3d814c8de9c7d697021846f | |
parent | 35050a40d1336f162041c328f4f589fe1adebf0e (diff) |
add a tooltip and fix the labels
-rw-r--r-- | chrome/browserOverlay.xul | 25 | ||||
-rw-r--r-- | chrome/js/browserOverlay.js | 8 |
2 files changed, 24 insertions, 9 deletions
diff --git a/chrome/browserOverlay.xul b/chrome/browserOverlay.xul index 5859a93..8a97546 100644 --- a/chrome/browserOverlay.xul +++ b/chrome/browserOverlay.xul @@ -3,31 +3,40 @@ <!DOCTYPE overlay SYSTEM "chrome://redirector/locale/browserOverlay.dtd"> <overlay id="redirector-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <script src="chrome://redirector/content/js/browserOverlay.js"/> + <script src="chrome://redirector/content/js/browserOverlay.js" /> <stringbundleset id="stringbundleset"> - <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/> + <stringbundle id="redirector-strings" + src="chrome://redirector/locale/redirector.properties" /> </stringbundleset> <commandset> <command id="redirector-toggle" - label="Toggle" - oncommand="RedirectorOverlay.toggleEnabled();"/> + oncommand="RedirectorOverlay.toggleEnabled();" /> </commandset> + <popupset> + <tooltip id="redirector-tooltip" + onpopupshowing="RedirectorOverlay.updateTooltip(event);"> + <label class="redirector-tooltip-version" /> + </tooltip> + </popupset> + <toolbarpalette id="BrowserToolbarPalette"> <toolbarbutton id="redirector-button" - label="URL Rewriter" command="redirector-toggle" class="toolbarbutton-1" - type="menu-button"> + type="menu-button" + label="URL Rewriter" + tooltip="redirector-tooltip"> <menupopup> <menuitem id="redirector-enabled-item" type="checkbox" - command="redirector-toggle"/> + command="redirector-toggle" + label="Enable" /> <menuitem id="redirector-settings-item" label="Settings" - oncommand="RedirectorOverlay.openSettings();"/> + oncommand="RedirectorOverlay.openSettings();" /> </menupopup> </toolbarbutton> </toolbarpalette> diff --git a/chrome/js/browserOverlay.js b/chrome/js/browserOverlay.js index 2767d7b..d833ccf 100644 --- a/chrome/js/browserOverlay.js +++ b/chrome/js/browserOverlay.js @@ -93,8 +93,14 @@ var RedirectorOverlay = { } else if (event.button == RIGHT) { this.openSettings(); } - } + }, + updateTooltip: function(event) { + AddonManager.getAddonByID("url-rewriter@papush", (addon) => { + let label = event.target.getElementsByClassName("redirector-tooltip-version")[0]; + label.setAttribute("value", "URL Rewriter " + addon.version); + }); + } }; window.addEventListener("load", function(event) { RedirectorOverlay.onLoad(event); }, false); window.addEventListener("unload", function(event) { RedirectorOverlay.onUnload(event); }, false); |