Checking in a patch for Antoine Labour, Open Link in New Tab, r=bryner, sr=hyatt, bug #101487

This commit is contained in:
hyatt%netscape.com 2001-09-28 00:19:32 +00:00
Родитель 3fd6b28dcb
Коммит 4179bab7e4
4 изменённых файлов: 30 добавлений и 1 удалений

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

@ -49,6 +49,10 @@
label="&openLinkCmd.label;"
accesskey="&openLinkCmd.accesskey;"
oncommand="gContextMenu.openLink();"/>
<menuitem id="context-openlinkintab"
label="&openLinkCmdInTab.label;"
accesskey="&openLinkCmdInTab.accesskey;"
oncommand="gContextMenu.openLinkInTab();"/>
<!-- XXX - DEPENDENT ON PRESENCE OF EDITOR!! - XXX -->
<menuitem id="context-editlink"
label="&editLinkCmd.label;"

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

@ -76,6 +76,23 @@
newWin.saveFileAndPos = true;
}
function openNewTabWith(url) {
urlSecurityCheck(url, document);
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
// set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window...
if (window && (wintype == "navigator:browser")) {
var browser=getBrowser();
browser.selectedTab = browser.addTab(url);
}
// Fix new window.
newWin.saveFileAndPos = true;
}
function savePage(url)
{
var postData = null; // No post data, usually.

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

@ -79,6 +79,7 @@ nsContextMenu.prototype = {
initOpenItems : function () {
// Remove open/edit link if not applicable.
this.showItem( "context-openlink", this.onSaveableLink || ( this.inDirList && this.onLink ) );
this.showItem( "context-openlinkintab", this.onSaveableLink || ( this.inDirList && this.onLink ) );
this.showItem( "context-editlink", this.onSaveableLink && !this.inDirList );
// Remove open frame if not applicable.
@ -427,6 +428,11 @@ nsContextMenu.prototype = {
// Determine linked-to URL.
openNewWindowWith( this.linkURL() );
},
// Open linked-to URL in a new tab.
openLinkInTab : function () {
// Determine linked-to URL.
openNewTabWith( this.linkURL() );
},
// Edit linked-to URL in a new window.
editLink : function () {
urlSecurityCheck( this.linkURL(), window.document );

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

@ -1,6 +1,8 @@
<!-- Context Menu -->
<!ENTITY openLinkCmd.label "Open in New Window">
<!ENTITY openLinkCmd.accesskey "o">
<!ENTITY openLinkCmdInTab.label "Open in New Tab">
<!ENTITY openLinkCmdInTab.accesskey "t">
<!ENTITY openLinkInWindowCmd.label "Open">
<!ENTITY openLinkInWindowCmd.accesskey "p">
<!ENTITY editLinkCmd.label "Edit Link in Composer">
@ -65,4 +67,4 @@
<!ENTITY deleteCmd.label "Delete">
<!ENTITY deleteCmd.accesskey "D">
<!ENTITY undoCmd.label "Undo">
<!ENTITY undoCmd.accesskey "U">
<!ENTITY undoCmd.accesskey "U">