Fix for 102120, ability to load tabs in background, r=bryner, sr=hewitt

This commit is contained in:
hyatt%netscape.com 2006-07-29 05:38:08 +00:00
Родитель b677339aa8
Коммит 91ddf610f3
2 изменённых файлов: 24 добавлений и 9 удалений

Просмотреть файл

@ -152,9 +152,20 @@
switch (event.button) { switch (event.button) {
case 0: // if left button clicked case 0: // if left button clicked
if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down
openNewWindowWith(href); // open link in new window if (pref && pref.GetBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser &&
event.preventBubble(); getBrowser() && getBrowser().localName == "tabbrowser") {
return true; var t = getBrowser().addTab(href); // open link in new tab
if (!event.shiftKey && !pref.GetBoolPref("browser.tabs.loadInBackground"))
getBrowser().selectedTab = t;
event.preventBubble();
return true;
}
if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) {
openNewWindowWith(href); // open link in new window
event.preventBubble();
return true;
}
} }
var saveModifier = true; var saveModifier = true;
if (pref) { if (pref) {
@ -177,11 +188,13 @@
if (pref && pref.GetBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser && if (pref && pref.GetBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser &&
getBrowser() && getBrowser().localName == "tabbrowser") { getBrowser() && getBrowser().localName == "tabbrowser") {
var t = getBrowser().addTab(href); // open link in new tab var t = getBrowser().addTab(href); // open link in new tab
getBrowser().selectedTab = t; if (!event.shiftKey && !pref.GetBoolPref("browser.tabs.loadInBackground"))
getBrowser().selectedTab = t;
event.preventBubble(); event.preventBubble();
return true; return true;
} }
else if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) {
if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) {
openNewWindowWith(href); // open link in new window openNewWindowWith(href); // open link in new window
event.preventBubble(); event.preventBubble();
return true; return true;

Просмотреть файл

@ -92,17 +92,19 @@
function openNewTabWith(url) { function openNewTabWith(url) {
urlSecurityCheck(url, document); urlSecurityCheck(url, document);
var wintype = document.firstChild.getAttribute('windowtype'); var wintype = document.firstChild.getAttribute('windowtype');
// if and only if the current window is a browser window and it has a document with a character // if and only if the current window is a browser window and it has a document with a character
// set, then extract the current charset menu setting from the current document and use it to // set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window... // initialize the new browser window...
if (window && (wintype == "navigator:browser")) { if (window && (wintype == "navigator:browser")) {
var browser=getBrowser(); var browser=getBrowser();
browser.selectedTab = browser.addTab(url); var t = browser.addTab(url); // open link in new tab
if (pref && !pref.GetBoolPref("browser.tabs.loadInBackground"))
browser.selectedTab = t;
} }
// Fix new window. // Fix new window.
newWin.saveFileAndPos = true; newWin.saveFileAndPos = true;
} }