From: Adrian Bak Date: Fri, 8 Aug 2008 21:03:28 +0000 (+0200) Subject: Added the posibility to go into "statusbar mode" X-Git-Url: https://git.jkkn.net/?a=commitdiff_plain;h=2ddc6e54df43df1976ca7ab6a2c10737fc010ccd;p=tv2developer Added the posibility to go into "statusbar mode" --- diff --git a/content/browser_overlay.xul b/content/browser_overlay.xul index ce8e101..19cc76a 100644 --- a/content/browser_overlay.xul +++ b/content/browser_overlay.xul @@ -21,7 +21,6 @@ oncommand="window.openDialog('chrome://tv2developer/content/about.xul','tv2about','modal,centerscreen,chrome,resizable=no')" /> - - + + + + + diff --git a/content/options.js b/content/options.js index c581a11..52e1333 100644 --- a/content/options.js +++ b/content/options.js @@ -5,6 +5,10 @@ var TV2Options = { _prefBranch: null, _hackEnabled: false, init: function() { + + // the status bar thingy. + document.getElementById('statusbarmode').checked = TV2Util.getPref('useStatusBarMode', false); + var hacks = document.getElementById('mac-hacks'); var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService); this._keyBranch = prefs.getBranch('ui.key.'); @@ -23,6 +27,7 @@ var TV2Options = { this.php4sitesFillIn(TV2Util.getPref('php4sites', '')); document.getElementById('php4auto').selectedIndex = (TV2Util.hasPref('php4sites') ? 1 : 0); + }, /* fill in list */ @@ -117,10 +122,17 @@ var TV2Options = { TV2Util.clearPref('php4sites'); } } + + // Save the statusbar thing + var statusbar = document.getElementById('statusbarmode').checked; + TV2Util.setPref('useStatusBarMode', statusbar); + }, update: function() { - var instantApply = this._prefBranch.getBoolPref("instantApply", false); + if(this._prefBranch != null) { // sometimes it's null on my mac (adba) + var instantApply = this._prefBranch.getBoolPref("instantApply", false); + } if (instantApply) this.save(); } diff --git a/content/options.xul b/content/options.xul index 60157bd..951b196 100644 --- a/content/options.xul +++ b/content/options.xul @@ -45,6 +45,12 @@ oncommand="TV2Options.update()" tooltiptext="&optionsDialog.mac.accesskeys.tooltiptext;"/> + + + + diff --git a/content/tv2developer.js b/content/tv2developer.js index 5962028..385b119 100644 --- a/content/tv2developer.js +++ b/content/tv2developer.js @@ -34,10 +34,29 @@ var TV2Developer = { _lastAction: null, - + _statusBarIconEnabled: false, + + /* toggle between statusbar/toolbar mode */ + enableStatusBarIcon: function( enabled ) { + this._statusBarIconEnabled = enabled; + var statusbutton = document.getElementById('tv2developer_statusbutton'); + var swapbutton = document.getElementById('tv2-swap-button'); + var popupmenu = document.getElementById('tv2developer-popupmenu'); + + statusbutton.hidden = !enabled; + swapbutton.hidden = enabled; + + statusbutton.setAttribute('context', 'tv2developer-contextmenu'); // Add the rightclick menu. + if(enabled) { + statusbutton.appendChild(popupmenu); + } else { + swapbutton.appendChild(popupmenu); + } + }, + /* method for initialize, reading properties, adding icon at firstrun, added keyshortcuts */ init: function() { - // init + // init this._lastAction = TV2Util.getPref('lastaction-linktype'); // add shortcuts depending on platform var shortcuts = document.getElementById('mainKeyset'); @@ -87,6 +106,9 @@ var TV2Developer = { } catch(e) { } } + + // initializes the statusbar icon. + this.enableStatusBarIcon(TV2Util.getPref('useStatusBarMode', false)); }, /* utility function to create shortcut object */ @@ -551,7 +573,8 @@ var TV2Developer = { /* shortcut to open menu */ handleKeyShortcut: function(event) { - document.getElementById('tv2-swap-button').open = true; + var popupmenu = document.getElementById('tv2developer-popupmenu'); + popupmenu.showPopup(); }, /* utility function to go to a link */ diff --git a/locale/da-DK/tv2developer.dtd b/locale/da-DK/tv2developer.dtd index 06e513c..7eb570a 100644 --- a/locale/da-DK/tv2developer.dtd +++ b/locale/da-DK/tv2developer.dtd @@ -10,6 +10,10 @@ + + + + diff --git a/locale/en-US/tv2developer.dtd b/locale/en-US/tv2developer.dtd index b1d628e..4d3350e 100644 --- a/locale/en-US/tv2developer.dtd +++ b/locale/en-US/tv2developer.dtd @@ -10,6 +10,9 @@ + + +