Closed BrontoRed closed 7 years ago
Hey there, MouseControl is designed so you can do set up whatever you like. The code to close tabs to the right is this:
Close all Tabs to Right
{
__exec__() {
var win = Services.wm.getMostRecentWindow('navigator:browser');
if (!win) return;
var gbrowser = win.gBrowser;
var targettabs = [];
var tabs = gbrowser.visibleTabs;
var foundself = false;
var selftab = gbrowser.selectedTab;
for (var tab of tabs) {
if (foundself && !tab.pinned) gbrowser.removeTab(tab, { animated:true })
if (tab == selftab) foundself = true;
}
}
}
I'll take a screencast for you.
Here's the screencast -
Close Tabs to Left
{
__exec__() {
var win = Services.wm.getMostRecentWindow('navigator:browser');
if (!win) return;
var gbrowser = win.gBrowser;
var targettabs = [];
var tabs = gbrowser.visibleTabs;
var foundself = false;
var selftab = gbrowser.selectedTab;
for (var tab of tabs) {
if (tab == selftab) break;
else gbrowser.removeTab(tab, { animated:true })
}
}
}
Close All Other Tabs
{
__exec__() {
var win = Services.wm.getMostRecentWindow('navigator:browser');
if (!win) return;
var gbrowser = win.gBrowser;
var targettabs = [];
var tabs = gbrowser.visibleTabs;
var selftab = gbrowser.selectedTab;
for (var tab of tabs) {
if (tab != selftab && !tab.pinned) gbrowser.removeTab(tab, { animated:true })
}
}
}
Wow, thanks! I'm not a programmer and can't write my own code for different actions. I think, that users like me would appreciate if there would be some kind of repository with additional actions (something like "Code" - "Action"). P.s. 1. Screencast returns "Non-Image content-type returned". Nothing there.
Oops here's the fixed screencast - https://www.youtube.com/watch?v=bi5ARPmKDXk
That's a good idea I created this wiki page and linked to it from the main listing page here -
I want to make a built in browsing system in the addon. But first I need to work on getting this back to AMO so people don't have to come to github to download it :)
I'll put up a sign saying if they are not a programmer they can come here and request the scirpt and I can help them write it :) If you have any other requests please let me know :)
Hey, you're fast! Enough commands for me. Thank you! Just consider the issue with actions set to triple and double clicking of RMB.
Ohh I see that 2x click intereferes with 3x click. This is something I we can workd around by not baking the first thing 2x
but itsead a 2x + wait
. The wait
waits to see if another click comes in, if it doesnt then it does that action. I'll implement that wait
feature :)
Thanks. This topic can be closed.
Would be great to add such actions as "Close tabs to the right" (right mouse button down + tilting mouse wheel to the right), "Close tabs to the left" (right mouse button down + tilting mouse wheel to the left), "Close other tabs" (3x clicking right mouse button).