diff options
-rw-r--r-- | chrome/browserOverlay.xul | 42 | ||||
-rw-r--r-- | 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 @@ <?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet href="chrome://redirector/skin/browser.css" type="text/css"?> <!DOCTYPE overlay SYSTEM "chrome://redirector/locale/browserOverlay.dtd"> <overlay id="redirector-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> @@ -8,23 +9,26 @@ <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/> </stringbundleset> - <menupopup id="menu_ToolsPopup"> - <menuitem id="redirector-menuitem" label="&RedirectorMenuItem.label;" - accesskey="&RedirectorMenuItem.accesskey;" - oncommand="RedirectorOverlay.onMenuItemCommand(event);"/> - </menupopup> - <popup id="contentAreaContextMenu"> - <menuitem id="redirector-context" label="&RedirectorContext.label;" - accesskey="&RedirectorContext.accesskey;" - insertafter="context-stop" - oncommand="RedirectorOverlay.onContextMenuCommand(event)"/> - </popup> - <statusbar id="status-bar"> - <statusbarpanel id="redirector-status"> - <image id="redirector-statusbar-img" src="chrome://redirector/content/images/statusactive.png" - tooltiptext="URL Rewriter is enabled;" - style="width:16px; height:16px;" - onclick="RedirectorOverlay.statusBarClick(event);" /> - </statusbarpanel> - </statusbar> + <commandset> + <command id="redirector-toggle" + label="Toggle" + oncommand="RedirectorOverlay.toggleEnabled();"/> + </commandset> + + <toolbarpalette id="BrowserToolbarPalette"> + <toolbarbutton id="redirector-button" + label="URL Rewriter" + command="redirector-toggle" + class="toolbarbutton-1" + type="menu-button"> + <menupopup> + <menuitem id="redirector-enabled-item" + type="checkbox" + command="redirector-toggle"/> + <menuitem id="redirector-settings-item" + label="Settings" + oncommand="RedirectorOverlay.openSettings();"/> + </menupopup> + </toolbarbutton> + </toolbarpalette> </overlay> 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) { |