Adding support for ALT+n to select the nth tab.
git-svn-id: svn://10.0.0.236/trunk@132273 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -382,6 +382,8 @@ function delayedStartup(aElt)
|
||||
|
||||
gBrowser.addEventListener("load", function(evt) { setTimeout(loadEventHandlers, 0, evt); }, true);
|
||||
|
||||
window.addEventListener("keypress", altNumberTabSelection, true);
|
||||
|
||||
if (gMustLoadSidebar) {
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
sidebar.setAttribute("src", window.opener.document.getElementById("sidebar").getAttribute("src"));
|
||||
@@ -455,6 +457,33 @@ function Shutdown()
|
||||
appCore.close();
|
||||
}
|
||||
|
||||
function altNumberTabSelection(event)
|
||||
{
|
||||
if (!event.altKey)
|
||||
return;
|
||||
|
||||
var index = event.charCode - 49;
|
||||
if (index == -1)
|
||||
index = 9;
|
||||
if (index < 0 || index > 9)
|
||||
return false;
|
||||
|
||||
if (index >= gBrowser.mTabContainer.childNodes.length)
|
||||
return false;
|
||||
|
||||
var oldTab = gBrowser.selectedTab;
|
||||
var newTab = gBrowser.mTabContainer.childNodes[index];
|
||||
if (newTab != oldTab) {
|
||||
oldTab.selected = false;
|
||||
gBrowser.selectedTab = newTab;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
event.preventBubble();
|
||||
event.preventCapture();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function gotoHistoryIndex(aEvent)
|
||||
{
|
||||
var index = aEvent.target.getAttribute("index");
|
||||
|
||||
Reference in New Issue
Block a user