Note: This page is archived and maintained mainly as a histrical document. Please see the Mozilla Add-ons page and the GitHub repository for latest information.
IMPORTANT SECURITY NOTE: All versions MTH 2.x and MTH 3.x older than MTH 3.0.7 had a data disclosure problem via API for other addons. Sensitive tab information including private window tabs were unintentionally exposed to untrusted addons, regardless they were not have permissions to access those information via WebExtensions API. I strongly recommend you to update to MTH 3.0.7 and later. Please see detailed information also.
This provides features to handle multiple tabs at once, for example, close them, reload them, and so on. When you press the mouse button and drag in the popup panel, they are selected. After you release the button, the popup to choose command will be shown. Of course, you can toggle selection by Ctrl-click on each tab and call features from the context menu. Yes, the behavior looks like Excel. And you can also close multiple tabs directly by dragging on closeboxes.
By the way, this includes "Copy URL" and "Save Tab to File" features.
Moreover, this addon is designed to work with Tree Style Tab. If you install both addons, you can select tabs in the sidebar by dragging . (Note that you need to long-press on a tab to start selection. Otherwise - if you start dragging immediately, it just moves the tab.)
This is developed under a project to restructure TBE for Firefox 2.
If you see any problem, see FAQ at first. If there is no solution, post a report to the issue tracker on the GitHub please.
Released version 0.x includes following language packs:
This section describes about old version 0.x. For latest information, see Mozilla Add-ons website.
Select tabs, and choose a command. This is the simple usecase. If you want tabs to be rearranged, please drag the favicon of tabs.
If you don't like the behavior of tabs, you can change it. "Move tab (Firefox default)", "select tab (Multiple Tab Handler default)" or "switch tab (iRider compatible)" is available.
You can select/unselect tabs by ctrl-click or shift-click, like as cells of Excel.
Selecting of closeboxes can close tabs directly. (iRider compatibility)
This includes "Close Left Tabs" and "Close Right Tabs" features. You can use them from the context menu of tabs.
With version 0.4 or later, you can add custom formats for the feature "copy URIs of selected tabs". For example:
<li><a href="%URL_HTMLIFIED%">%TITLE_HTMLIFIED%</a></li>
[%TITLE_HTMLIFIED%](%URL_HTMLIFIED% "%TITLE_HTMLIFIED%")
* [%TITLE_HTMLIFIED%](%URL_HTMLIFIED% "%TITLE_HTMLIFIED%")
((<%TITLE_HTMLIFIED%|URL:%URL_HTMLIFIED%>))
* ((<%TITLE_HTMLIFIED%|URL:%URL_HTMLIFIED%>))
[url=%URL%]%TITLE%[/url]
[list][url=%URL%]%TITLE%[/url][/list]
This section describes about APIs in old versions. For latest information, see API document on GitHub Wiki.
*Following methods are work for single "tabbrowser" element. If you wish to operate multiple "tabbrowser" elements, you have to do for each element.
MultipleTabService.closeTabs(in Array aTabs)
MultipleTabService.reloadTabs(in Array aTabs)
MultipleTabService.addBookmarkFor(in Array aTabs)
MultipleTabService.duplicateTabs(in Array aTabs)
MultipleTabService.splitWindowFromTabs(in Array aTabs)
MultipleTabService.hasSelection([in Node aTabBrowser])
MultipleTabService.isSelected(in Node aTab)
MultipleTabService.setSelection(in Node aTab, in boolean aNewSelectionState)
MultipleTabService.toggleSelection(in Node aTab)
MultipleTabService.clearSelection([in Node aTabBrowser])
MultipleTabService.getSelectedTabs([in Node aTabBrowser])
MultipleTabService.getLeftTabsOf(in Node aTab)
MultipleTabService.getRightTabsOf(in Node aTab)
Multiple Tab Handler supports drag and drop of multiple tabs. You can receive all of dropped tabs by MTH's API like following samples.
On 0.6 or later, you can get dragged tabs via the data transfer object of HTML5 Drag and Drop events.In this case the first data (index == 0) is not leftmost tab but the tab you start the dragging.
onDrop : function(aEvent) {
var tabs = [];
var dt = aEvent.dataTransfer;
for (let i = 0, maxi = dt.mozItemCount; i < maxi; i++) {
tabs.push(dt.mozGetDataAt(TAB_DROP_TYPE, i));
}
tabs.sort(function(aA, aB) { return aA._tPos - aB._tPos; });
...
},
You can get just same result by the utility method MultipleTabService.getSelectedTabs()
, if you give the drop event to the method.
onDrop : function(aEvent) {
var tabs = MultipleTabService.getSelectedTabs(aEvent);
},
Moreover, old API compatible to 0.5 or older is available too.
MultipleTabService.getBundledTabsOf()
method returns an array of selected (drag-and-dropped) tabs if you hand one of them to him. If there is no selection or you hand any object not a tab, he returns a blank array. For example, this shows an URI list of dropped tabs:
onDrop : function(aEvent, aData, aSession) {
var tab = aSession.sourceNode;
if ('MultipleTabService' in window) {
var tabs = MultipleTabService.getBundledTabsOf(tab);
if (tabs.length) {
// When multiple tabs are dropped,
// show URIs of all tabs.
alert(
tabs.map(function(aTab) {
return aTab.linkedBrowser.currentURI.spec;
}).join('\n')
);
return;
}
}
// Normal operation
alert(tab.linkedBrowser.currentURI.spec);
},
If you hand an object to MultipleTabService.getBundledTabsOf()
method as the second argument, you can get the <tabbrowser/> element which is the owner of dragged tabs, and the owner window (DOMWindow) of the <tabbrowser/>. For example, this codes removes original dragged tabs if they are dropped to another window:
onDrop : function(aEvent, aData, aSession) {
var tab = aSession.sourceNode;
if ('MultipleTabService' in window) {
var info = {};
var tabs = MultipleTabService.getBundledTabsOf(tab, info);
if (tabs.length) {
var uris = tabs.map(function(aTab) {
return aTab.linkedBrowser.currentURI.spec;
}).join('\n');
if (info.sourceWindow != window)
tabs.forEach(function(aTab) {
info.sourceBrowser.removeTab(aTab);
});
}
...
return;
}
}
...
},
When you select multiple tabs and start to drag one of them, then Multiple Tab Handler detects the operation and process your action as "drag and drop of multiple tabs". If you want to cancel this behavior and you want to define custom operations for dragging of multiple tabs, you have to cancel a custom event "MultipleTabHandler:TabsDragStart" which is fired by Multiple Tab Handler.
var listener = function function(aEvent) {
switch (aEvent.type) {
case "MultipleTabHandler:TabsDragStart":
return aEvent.preventDefault();
case "dragstart":
// custom operations to start dragging of multiple tabs
return;
}
};
gBrowser.mTabContainer.addEventListener(
"MultipleTabHandler:TabsDragStart", listener, false);
/* To handle dragstart events before Firefox's default handler
cancels it, you have to register the listener for the
capturing phase. */
gBrowser.mTabContainer.addEventListener(
"dragstart", listener, true);
You can specify special labels for each menuitems.
If the tabs are shown horizontally (normal), the value of label-horizontal
attribute will be shown as its label. If the tab becomes vertically, the value of label-vertical
attribute will be used.
<menuitem id="context-item-feature4"
label-horizontal="Feature 4, do it for Left Tabs"
label-vertical="Feature 4, do it for Upper Tabs"/>
Setting a new boolean value extensions.multipletab.show.<the id of the menuitem inserted to those popups>
controls the appearance of the item.
This extension doesn't include an UI to customize extra menu items inserted by other extensions. If you want to control it in GUI, use an overlay to the resource chrome://multipletab/content/config.xul.
Moreover, you can also control visibility or accessibility of the menuitems dynamically, by their multipletab-available
attribute or multipletab-enabled
attribute. Values of those attributes are evaluated as JavaScript expressions. The menuitem becomes shown if the value of multipletab-available
attribute equals true
, otherwise it becomes hidden. The menuitem becomes enabled if multipletab-enabled
equals true
, otherwise disabled.
<menuitem id="context-item-myservice-feature"
label="A feature for 3 or more selected tabs"
multipletab-available="MyService.available()"
multipletab-enabled="selectedTabs.length > 3"/>
The menuitem in the sample above will be shown when the returned value of MyService.available()
equals true
, and it will be enabled when three or more tabs are selected. You can use following variables in expressions:
tabbrowser
gBrowser
.tabs
Array.slice(gBrowser.mTabContainer.childNodes)
.selectedTabs
MultipleTabService.getSelectedTabs(gBrowser)
.Visibility of menuitems is controlled by both extensions.multipletab.show.id
(default=true
) and multipletab-available
(default=true
). The menuitem will be shown when both equal true
. In other words, the item will be hidden when one or all of them equals false
.
zh_CN
locale by NightSharp. Thanks!zh_CN
locale by NightSharp. Thanks!zh_CN
locale by NightSharp. Thanks!title
, url
, favIconUrl
and cookieStoreId
to API responses.windowId
for tab-selection-command
type messages.remove-all-selected-tab-commands
for other addons.svg.context-properties.content.enabled
= true
.about:
pages.keydown
. This behavior is same to native UI.%TST_INDENT(...)%
when tree of tabs are partially selected.%TST_INDENT(...)%
placeholder for the "Copy to Clipboard" command.config.useEffectiveTLD.enabled
(thanks to Ulf Rompe!)%20
to not break URIs copied from tabs (by Infocatcher. Thanks!)ru
locale is updated (by Infocatcher. Thanks!)ru
locale is updated by Netanyahu. Thanks!ru
locale is updated by Infocatcher. Thanks!extensions.multipletab.tabdrag.delay
preference. (By Infocatcher. Thanks!)dom.compartment_per_addon
=true
.-1
=use "browser.tabs.warnOnClose", 0
=no warning, 1
=show warning)%AUTHOR%
, %AUTHOR_HTMLIFIED%
, %DESCRIPTION%
, %DESCRIPTION_HTMLIFIED%
, %KEYWORDS%
, and %KEYWORDS_HTMLIFIED%
.getData()
from events fired with old names (without "nsDOM" prefix).aEvent.getData(property name)
to get the value from the event object.)MultipleTabHandlerTabsClosing
DOM event is fired when multiple tabs are being closed, and MultipleTabHandlerTabsClosed
DOM event is fired just after tabs are closed.multipletab-insertbefore
but also multipletab-insertafter
.multipletab-insertbefore
or multipletab-insertafter
.