rejlan givens wrote:Hi everyone,
The functions for closing all tabs, left tabs and right tabs do not work without the TabMix add-on installed:
gBrowser.closeLeftTabs(gBrowser.mCurrentTab);
gBrowser.closeRightTabs(gBrowser.mCurrentTab);
gBrowser.closeAllTabs();
I wonder if it is possible for these to work without having to instal TabMix or any other additional add-on? Or is it possible to make at least "Close other tabs" and "Close tabs to the right" from the Firefox tab context menu work without installing TabMix?
Thank you for the help.
Try these:
Close Right Tabs
Code: Select all
var n = gBrowser.mCurrentTab._tPos;
var i = gBrowser.mTabContainer.childNodes.length - 1;
while (i > n)
{ var tab = gBrowser.mTabs[i];
gBrowser.removeTab(tab);
i = i - 1; }
Close Left Tabs
Code: Select all
var i = gBrowser.mCurrentTab._tPos - 1;
while (i >= 0)
{ var tab = gBrowser.mTabs[i];
gBrowser.removeTab(tab);
i = i - 1; }
Close All Tabs
Code: Select all
var i = gBrowser.mTabContainer.childNodes.length - 1;
while (i >= 0)
{ var tab = gBrowser.mTabs[i];
gBrowser.removeTab(tab);
i = i - 1; }
Close Other Tabs
Code: Select all
var n = gBrowser.mCurrentTab._tPos;
var i = gBrowser.mTabContainer.childNodes.length - 1;
while (i >= 0)
{ var tab = gBrowser.mTabs[i];
if (i != n)
{ gBrowser.removeTab(tab); }
i = i - 1; }