Changes

Jump to: navigation, search
The 'What': change the way new tabs get created in Firefox
'''overlay.js'''
var AddTabBeside = {
// State info on the last tab to be selected.
mPreviousIndex: 0,
var container = gBrowser.tabContainer;
container.addEventListener("TabOpen", this.onTabOpen, false);
// Also add a listener for TabSelect so we know when focus changes to a new tab
container.addEventListener("TabSelect", this.onTabSelect, false);
// Finally, add a listener for shutdown
window.addEventListener("unload", this.onUnload, false);
onUnload: function() {
var container = gBrowser.tabContainer; container.removeEventListener("TabOpen", this.onTabOpen, false); container.removeEventListener("TabSelect", this.onTabSelect, false);
},
onTabSelect: function (e) {
// when a different tab is selected, remember which one. This is // necessary because when a new tab is created, it will get pushed // to the end of the list, but we need to know where to put it. this.mPreviousIndex = gBrowser.tabContainer.selectedIndex;
},
onTabOpen: function (e) {
// Get the newly created tab, which will be last in the list var newTab = e.target; // Move this new tab to the right of the previously selected tab, // checking to see how many tabs there are currently. By default // there is 1 tab, and the first time onTabOpen is called, there will // be 2 (the default plus the newly created tab). In this case, don't // move the new tab, since it is already in the right spot. In all // other cases, move the tab to the right of the current tab. if (gBrowser.tabContainer.childNodes.length > 2) { gBrowser.moveTabTo(newTab, this.mPreviousIndex + 1); }
},
};
window.addEventListener("load", function(e) { AddTabBeside.onLoad(e); }, false);
 
 
 
 
 
 
 
 
 
 
=The 'Where': finding the right spot to make the changes=

Navigation menu