diff options
| author | teramako | 2013-07-11 11:37:49 -0700 | 
|---|---|---|
| committer | teramako | 2013-07-11 11:37:49 -0700 | 
| commit | 7e13e160743058bcd83a7398299862b5e53fbb8f (patch) | |
| tree | fb2b99192e8e5f302dbe4ebce7f6769a14ac7098 | |
| parent | b9447991aa530a1ef07091d3ad4a23cf48891438 (diff) | |
| parent | 6deea7b8b8c19133a990dae6094e41fe4f26b534 (diff) | |
| download | vimperator-plugins-7e13e160743058bcd83a7398299862b5e53fbb8f.tar.bz2 | |
Merge pull request #49 from monkey413/master
unload-tab.js, unload all tab and set tab title opacity 
| -rw-r--r-- | unload-tab.js | 35 | 
1 files changed, 28 insertions, 7 deletions
| diff --git a/unload-tab.js b/unload-tab.js index 1bee8f4..cba9610 100644 --- a/unload-tab.js +++ b/unload-tab.js @@ -3,6 +3,13 @@   * unload[tab] num   */ +/*  +   Thu, 11 Jul 2013 01:55:46 +0800 +   unload[tab] negative_number  +   for unload all tab without seleted tab  +   set tab title opacity when unload or restore +*/ +  var INFO = xml`  <plugin name="unloadTab"          version="0.3" @@ -45,14 +52,23 @@ function unloadTab (aTab) {  commands.addUserCommand(["unload[tab]"], "Unload Tabs",    function action (args) { -    var str = args[0]; -    var m = str.match(/^(\d+):?/); +    var str = args[0];  +    var m = str.match(/^(-?\d+):?/);  +      if (!m)        return; -      var tab = gBrowser.tabs[m[1]]; -    if (tab && !tab.selected && !tab.linkedBrowser.__SS_restoreState) -      unloadTab(tab); +	if (tab && !tab.selected && !tab.linkedBrowser.__SS_restoreState) +		unloadTab(tab), tab.style.opacity = 0.5 ; + +	// unload other tabs  +	if (m[1] < 0)  +	    for each(tab in Array.slice(gBrowser.tabs)) +			if(tab && !tab.selected){ +				if(!tab.linkedBrowser.__SS_restoreState) unloadTab(tab); +				tab.style.opacity = 0.5 ;  +			} +    }, {      literal: 0,      completer: function (context, args) { @@ -64,5 +80,10 @@ commands.addUserCommand(["unload[tab]"], "Unload Tabs",        ];      }    }, true); - - +// the listener for recovering opacity +gBrowser.tabContainer.addEventListener('SSTabRestored',  +	function tabRestored(event){ +		var tab = event.originalTarget ; +		tab.style.opacity = 1 ; +	} +, true); | 
