aboutsummaryrefslogtreecommitdiffstats
path: root/unload-tab.js
diff options
context:
space:
mode:
authormonkey4132013-07-12 01:26:25 +0800
committermonkey4132013-07-12 01:26:25 +0800
commit6deea7b8b8c19133a990dae6094e41fe4f26b534 (patch)
treefb2b99192e8e5f302dbe4ebce7f6769a14ac7098 /unload-tab.js
parentb9447991aa530a1ef07091d3ad4a23cf48891438 (diff)
downloadvimperator-plugins-6deea7b8b8c19133a990dae6094e41fe4f26b534.tar.bz2
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
Diffstat (limited to 'unload-tab.js')
-rw-r--r--unload-tab.js35
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);