зеркало из https://github.com/mozilla/gecko-dev.git
108099, 75338 - overhaul of main menu and context menus. r=ben sr=hewitt a=asa/brendan
This commit is contained in:
Родитель
72dcb00c30
Коммит
62a8660b0e
|
@ -45,25 +45,52 @@
|
|||
<popup id="contentAreaContextMenu"
|
||||
onpopupshowing="gContextMenu = new nsContextMenu( this ); return gContextMenu.shouldDisplay;"
|
||||
onpopuphiding="gContextMenu = null;">
|
||||
<!-- Open ==================================== -->
|
||||
<menuitem id="context-openlinkintab"
|
||||
label="&openLinkCmdInTab.label;"
|
||||
accesskey="&openLinkCmdInTab.accesskey;"
|
||||
oncommand="gContextMenu.openLinkInTab();"/>
|
||||
<menuitem id="context-openlink"
|
||||
label="&openLinkCmd.label;"
|
||||
accesskey="&openLinkCmd.accesskey;"
|
||||
oncommand="gContextMenu.openLink();"/>
|
||||
<menuitem id="context-openlinkintab"
|
||||
label="&openLinkCmdInTab.label;"
|
||||
accesskey="&openLinkCmdInTab.accesskey;"
|
||||
oncommand="gContextMenu.openLinkInTab();"/>
|
||||
<menuitem id="context-openframe"
|
||||
label="&openFrameCmd.label;"
|
||||
accesskey="&openFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.openFrame();"/>
|
||||
<menuitem id="context-showonlythisframe"
|
||||
label="&showOnlyThisFrameCmd.label;"
|
||||
accesskey="&showOnlyThisFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.showOnlyThisFrame();"/>
|
||||
<menuseparator id="context-sep-open"/>
|
||||
<!-- Navigation ============================== -->
|
||||
<menuitem id="context-bookmarklink"
|
||||
label="&bookmarkLinkCmd.label;"
|
||||
accesskey="&bookmarkLinkCmd.accesskey;"
|
||||
oncommand="BookmarksUtils.addBookmark(gContextMenu.linkURL(),
|
||||
gContextMenu.linkText(),
|
||||
undefined, false);"/>
|
||||
<menuitem id="context-savelink"
|
||||
label="&saveLinkCmd.label;"
|
||||
accesskey="&saveLinkCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveLink();"/>
|
||||
<menuitem id="context-copyemail"
|
||||
label="©EmailCmd.label;"
|
||||
accesskey="©EmailCmd.accesskey;"
|
||||
oncommand="gContextMenu.copyEmail();"/>
|
||||
<menuitem id="context-copylink"
|
||||
label="©LinkCmd.label;"
|
||||
accesskey="©LinkCmd.accesskey;"
|
||||
command="cmd_copyLink"/>
|
||||
<menuseparator id="context-sep-copylink"/>
|
||||
<menuitem id="context-viewimage"
|
||||
label="&viewImageCmd.label;"
|
||||
accesskey="&viewImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImage();"/>
|
||||
<menuitem id="context-copyimage"
|
||||
label="©ImageCmd.label;"
|
||||
accesskey="©ImageCmd.accesskey;"
|
||||
command="cmd_copyImageLocation"/>
|
||||
<menuseparator id="context-sep-copyimage"/>
|
||||
<menuitem id="context-saveimage"
|
||||
label="&saveImageCmd.label;"
|
||||
accesskey="&saveImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveImage();"/>
|
||||
<menuitem id="context-setWallpaper"
|
||||
label="&setWallpaperCmd.label;"
|
||||
accesskey="&setWallpaperCmd.accesskey;"
|
||||
oncommand="gContextMenu.setWallpaper();"/>
|
||||
<menuseparator id="context-sep-setWallpaper"/>
|
||||
<menuitem id="context-back"
|
||||
label="&goBackCmd.label;"
|
||||
accesskey="&goBackCmd.accesskey;"
|
||||
|
@ -76,79 +103,30 @@
|
|||
label="&reloadCmd.label;"
|
||||
accesskey="&reloadCmd.accesskey;"
|
||||
oncommand="BrowserReload();"/>
|
||||
<menuitem id="context-reload-frame"
|
||||
label="&reloadFrameCmd.label;"
|
||||
accesskey="&reloadFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.reloadFrame();"/>
|
||||
<menuitem id="context-stop"
|
||||
label="&stopCmd.label;" disabled="true"
|
||||
label="&stopCmd.label;"
|
||||
accesskey="&stopCmd.accesskey;"
|
||||
disabled="true"
|
||||
oncommand="BrowserStop();"/>
|
||||
<menuseparator id="context-sep-navigation"/>
|
||||
<!-- View ==================================== -->
|
||||
<menuitem id="context-viewsource"
|
||||
label="&viewPageSourceCmd.label;"
|
||||
accesskey="&viewPageSourceCmd.accesskey;"
|
||||
oncommand="BrowserViewSourceOfDocument(_content.document);"/>
|
||||
<menuitem id="context-viewframesource"
|
||||
label="&viewFrameSourceCmd.label;"
|
||||
accesskey="&viewFrameSourceCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameSource();"/>
|
||||
<menuitem id="context-viewinfo"
|
||||
label="&viewPageInfoCmd.label;"
|
||||
accesskey="&viewPageInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewInfo();"/>
|
||||
<menuitem id="context-viewframeinfo"
|
||||
label="&viewFrameInfoCmd.label;"
|
||||
accesskey="&viewFrameInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameInfo();"/>
|
||||
<menuitem id="context-viewimage"
|
||||
label="&viewImageCmd.label;"
|
||||
accesskey="&viewImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewImage();"/>
|
||||
<menuitem id="context-viewbgimage"
|
||||
label="&viewBGImageCmd.label;"
|
||||
accesskey="&viewBGImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewBGImage();"/>
|
||||
<menuseparator id="context-sep-view"/>
|
||||
<!-- Misc ==================================== -->
|
||||
<menuseparator id="context-sep-stop"/>
|
||||
<menuitem id="context-bookmarkpage"
|
||||
label="&bookmarkPageCmd.label;"
|
||||
accesskey="&bookmarkPageCmd.accesskey;"
|
||||
oncommand="BookmarksUtils.addBookmarkForBrowser(document.getElementById('content').webNavigation, true);"/>
|
||||
<menuitem id="context-bookmarklink"
|
||||
label="&bookmarkLinkCmd.label;"
|
||||
accesskey="&bookmarkLinkCmd.accesskey;"
|
||||
oncommand="BookmarksUtils.addBookmark(gContextMenu.linkURL(),
|
||||
gContextMenu.linkText(),
|
||||
undefined, true);"/>
|
||||
<menuseparator id="context-sep-bookmark"/>
|
||||
<!-- Save ==================================== -->
|
||||
oncommand="gContextMenu.addBookmark();"/>
|
||||
<menuitem id="context-savepage"
|
||||
label="&savePageCmd.label;"
|
||||
accesskey="&savePageCmd.accesskey;"
|
||||
oncommand="saveDocument(window._content.document);"/>
|
||||
<menuitem id="context-saveframe"
|
||||
label="&saveFrameCmd.label;"
|
||||
accesskey="&saveFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveFrame();"/>
|
||||
<menuitem id="context-savelink"
|
||||
label="&saveLinkCmd.label;"
|
||||
accesskey="&saveLinkCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveLink();"/>
|
||||
<menuitem id="context-saveimage"
|
||||
accesskey="&saveImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.saveImage();"/>
|
||||
<menuitem id="context-setWallpaper"
|
||||
label="&setWallpaperCmd.label;"
|
||||
oncommand="gContextMenu.setWallpaper();"/>
|
||||
<menuseparator id="context-sep-save"/>
|
||||
<!-- Application Integration ================= -->
|
||||
<menuseparator id="context-sep-apps"/>
|
||||
<!-- Clipboard =============================== -->
|
||||
<menuitem id="context-selectall"
|
||||
label="&selectAllCmd.label;"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuseparator id="context-sep-viewbgimage"/>
|
||||
<menuitem id="context-viewbgimage"
|
||||
label="&viewBGImageCmd.label;"
|
||||
accesskey="&viewBGImageCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewBGImage();"/>
|
||||
<menuitem id="context-undo"
|
||||
label="&undoCmd.label;"
|
||||
accesskey="&undoCmd.accesskey;"
|
||||
command="cmd_undo"/>
|
||||
<menuseparator id="context-sep-undo"/>
|
||||
<menuitem id="context-cut"
|
||||
label="&cutCmd.label;"
|
||||
accesskey="&cutCmd.accesskey;"
|
||||
|
@ -161,28 +139,66 @@
|
|||
label="&pasteCmd.label;"
|
||||
accesskey="&pasteCmd.accesskey;"
|
||||
command="cmd_paste"/>
|
||||
<menuitem id="context-copyemail"
|
||||
label="©EmailCmd.label;"
|
||||
accesskey="©EmailCmd.accesskey;"
|
||||
oncommand="gContextMenu.copyEmail();"/>
|
||||
<menuitem id="context-copylink"
|
||||
label="©LinkCmd.label;"
|
||||
accesskey="©LinkCmd.accesskey;"
|
||||
command="cmd_copyLink"/>
|
||||
<menuitem id="context-copyimage"
|
||||
label="©ImageCmd.label;"
|
||||
accesskey="©ImageCmd.accesskey;"
|
||||
command="cmd_copyImageLocation"/>
|
||||
<menuseparator id="context-sep-clip"/>
|
||||
<!-- Metadata ================================ -->
|
||||
<menuitem id="context-delete"
|
||||
label="&deleteCmd.label;"
|
||||
accesskey="&deleteCmd.accesskey;"
|
||||
command="cmd_delete"/>
|
||||
<menuseparator id="context-sep-paste"/>
|
||||
<menuitem id="context-selectall"
|
||||
label="&selectAllCmd.label;"
|
||||
accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
<menuseparator id="context-sep-selectall"/>
|
||||
<menuitem id="context-searchselect"
|
||||
accesskey="&search.accesskey;"
|
||||
oncommand="OpenSearch('internet', false, gContextMenu.searchSelected(), true);"/>
|
||||
<menuseparator id="frame-sep"/>
|
||||
<menu id="frame" label="&thisFrameMenu.label;" accesskey="&thisFrameMenu.accesskey;">
|
||||
<menupopup id="frame_popup">
|
||||
<menuitem label="&showOnlyThisFrameCmd.label;"
|
||||
accesskey="&showOnlyThisFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.showOnlyThisFrame();"/>
|
||||
<menuitem label="&openFrameCmdInTab.label;"
|
||||
accesskey="&openFrameCmdInTab.accesskey;"
|
||||
oncommand="gContextMenu.openFrameInTab();"/>
|
||||
<menuitem label="&openFrameCmd.label;"
|
||||
accesskey="&openFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.openFrame();"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context-reload-frame"
|
||||
label="&reloadFrameCmd.label;"
|
||||
accesskey="&reloadFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.reloadFrame();"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&bookmarkFrameCmd.label;"
|
||||
accesskey="&bookmarkFrameCmd.accesskey;"
|
||||
oncommand="gContextMenu.addBookmarkForFrame();"/>
|
||||
<menuitem id="saveframeas"
|
||||
label="&saveFrameCmd.label;"
|
||||
accesskey="&saveFrameCmd.accesskey;"
|
||||
oncommand="saveDocument(gContextMenu.target.ownerDocument);"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&viewFrameSourceCmd.label;"
|
||||
accesskey="&viewFrameSourceCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameSource();"/>
|
||||
<menuitem label="&viewFrameInfoCmd.label;"
|
||||
accesskey="&viewFrameInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewFrameInfo();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator id="context-sep-properties"/>
|
||||
<menuitem id="context-viewsource"
|
||||
label="&viewPageSourceCmd.label;"
|
||||
accesskey="&viewPageSourceCmd.accesskey;"
|
||||
oncommand="BrowserViewSource(_content.document);"/>
|
||||
<menuitem id="context-viewinfo"
|
||||
label="&viewPageInfoCmd.label;"
|
||||
accesskey="&viewPageInfoCmd.accesskey;"
|
||||
oncommand="gContextMenu.viewInfo();"/>
|
||||
<menuitem id="context-metadata"
|
||||
label="&metadataCmd.label;"
|
||||
accesskey="&metadataCmd.accesskey;"
|
||||
oncommand="gContextMenu.showMetadata();"/>
|
||||
<menuseparator id="context-sep-search"/>
|
||||
<!-- Search ================================== -->
|
||||
<menuitem id="context-searchselect" class="menuitem-iconic"
|
||||
oncommand="OpenSearch('internet', false, gContextMenu.searchSelected(), true);"/>
|
||||
</popup>
|
||||
</popupset>
|
||||
</overlay>
|
||||
|
|
|
@ -44,6 +44,7 @@ function nsContextMenu( xulMenu ) {
|
|||
this.link = false;
|
||||
this.inFrame = false;
|
||||
this.hasBGImage = false;
|
||||
this.isTextSelected = false;
|
||||
this.inDirList = false;
|
||||
this.shouldDisplay = true;
|
||||
|
||||
|
@ -63,6 +64,8 @@ nsContextMenu.prototype = {
|
|||
|
||||
// Get contextual info.
|
||||
this.setTarget( document.popupNode );
|
||||
|
||||
this.isTextSelected = this.isTextSelection();
|
||||
|
||||
// Initialize (disable/remove) menu items.
|
||||
this.initItems();
|
||||
|
@ -77,16 +80,10 @@ nsContextMenu.prototype = {
|
|||
this.initMetadataItems();
|
||||
},
|
||||
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 ) );
|
||||
|
||||
// Remove open frame if not applicable.
|
||||
this.showItem( "context-openframe", this.inFrame );
|
||||
this.showItem( "context-showonlythisframe", this.inFrame );
|
||||
|
||||
// Remove separator after open items if neither link nor frame.
|
||||
this.showItem( "context-sep-open", this.onSaveableLink || ( this.inDirList && this.onLink ) || this.inFrame );
|
||||
this.showItem( "context-sep-open", this.onSaveableLink || ( this.inDirList && this.onLink ) );
|
||||
},
|
||||
initNavigationItems : function () {
|
||||
// Back determined by canGoBack broadcaster.
|
||||
|
@ -94,90 +91,79 @@ nsContextMenu.prototype = {
|
|||
|
||||
// Forward determined by canGoForward broadcaster.
|
||||
this.setItemAttrFromNode( "context-forward", "disabled", "canGoForward" );
|
||||
|
||||
this.showItem( "context-back", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
this.showItem( "context-forward", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
|
||||
// Reload is OK if not on a frame; vice-versa for reload-frame.
|
||||
this.showItem( "context-reload", !this.inFrame );
|
||||
this.showItem( "context-reload-frame", this.inFrame );
|
||||
this.showItem( "context-reload", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
|
||||
this.showItem( "context-stop", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
this.showItem( "context-sep-stop", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
|
||||
// XXX: Stop is determined in navigator.js; the canStop broadcaster is broken
|
||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||
},
|
||||
initSaveItems : function () {
|
||||
// Save page is always OK, unless in directory listing.
|
||||
this.showItem( "context-savepage", !this.inDirList );
|
||||
|
||||
// Save frame as depends on whether we're in a frame.
|
||||
this.showItem( "context-saveframe", this.inFrame );
|
||||
this.showItem( "context-savepage", !( this.inDirList || this.isTextSelected || this.onTextInput ) && !( this.onLink && this.onImage ) );
|
||||
|
||||
// Save link depends on whether we're in a link.
|
||||
this.showItem( "context-savelink", this.onSaveableLink );
|
||||
|
||||
// Save image depends on whether there is one.
|
||||
this.showItem( "context-saveimage", this.onImage );
|
||||
if (this.onImage){ //if onImage, let's get the imagename into the context menu
|
||||
var saveImageMenuItem = document.getElementById( 'context-saveimage' );
|
||||
var imageName = extractFileNameFromUrl(this.imageURL);
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/contentAreaCommands.properties");
|
||||
var caption;
|
||||
if (imageName) {
|
||||
caption = bundle.formatStringFromName("saveImageAs", [imageName], 1);
|
||||
} else {
|
||||
caption = bundle.GetStringFromName("saveImageAsNoFilename");
|
||||
}
|
||||
|
||||
saveImageMenuItem.setAttribute( "label", caption );
|
||||
}
|
||||
|
||||
// Remove separator if none of these were shown.
|
||||
var showSep = !this.inDirList || this.inFrame || this.onSaveableLink || this.hasBGImage || this.onImage;
|
||||
this.showItem( "context-sep-save", showSep );
|
||||
|
||||
this.showItem( "context-sendimage", this.onImage );
|
||||
},
|
||||
initViewItems : function () {
|
||||
// View source is always OK, unless in directory listing.
|
||||
this.showItem( "context-viewsource", !( this.inDirList || this.onImage ) );
|
||||
|
||||
// View frame source depends on whether we're in a frame.
|
||||
this.showItem( "context-viewframesource", this.inFrame );
|
||||
|
||||
// View Info is available, unless in directory listing
|
||||
this.showItem( "context-viewinfo", !this.inDirList );
|
||||
|
||||
// View Frame Info depends on whether we're in a frame
|
||||
this.showItem( "context-viewframeinfo", this.inFrame );
|
||||
this.showItem( "context-viewsource", !( this.inDirList || this.onImage || this.isTextSelected || this.onLink || this.onTextInput ) );
|
||||
this.showItem( "context-viewinfo", !( this.inDirList || this.onImage || this.isTextSelected || this.onLink || this.onTextInput ) );
|
||||
|
||||
this.showItem( "context-sep-properties", !( this.inDirList || this.isTextSelected || this.onTextInput ) );
|
||||
// Set As Wallpaper depends on whether an image was clicked on, and only works on Windows.
|
||||
this.showItem( "context-setWallpaper", this.onImage && navigator.appVersion.indexOf("Windows") != -1);
|
||||
|
||||
this.showItem( "context-sep-setWallpaper", this.onImage && navigator.appVersion.indexOf("Windows") != -1);
|
||||
|
||||
// View Image depends on whether an image was clicked on.
|
||||
this.showItem( "context-viewimage", this.onImage );
|
||||
|
||||
// View background image depends on whether there is one.
|
||||
this.showItem( "context-viewbgimage", this.hasBGImage && !this.onImage );
|
||||
this.showItem( "context-viewbgimage", !( this.inDirList || this.onImage || this.isTextSelected || this.onLink || this.onTextInput ) );
|
||||
this.showItem( "context-sep-viewbgimage", !( this.inDirList || this.onImage || this.isTextSelected || this.onLink || this.onTextInput ) );
|
||||
var menuitem = document.getElementById("context-viewbgimage");
|
||||
|
||||
// Remove separator if all items are removed.
|
||||
this.showItem( "context-sep-view", !this.inDirList || this.inFrame || this.onImage );
|
||||
if (this.hasBGImage)
|
||||
menuitem.removeAttribute("disabled");
|
||||
else
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
},
|
||||
initMiscItems : function () {
|
||||
// Use "Bookmark This Link" if on a link.
|
||||
this.showItem( "context-bookmarkpage", !this.onLink );
|
||||
this.showItem( "context-bookmarklink", this.onLink );
|
||||
this.setItemAttr( "context-searchselect", "disabled",
|
||||
!this.isTextSelected() );
|
||||
this.showItem( "context-bookmarkpage", !( this.isTextSelected || this.onTextInput ) );
|
||||
this.showItem( "context-bookmarklink", this.onLink && !this.onMailtoLink );
|
||||
this.showItem( "context-searchselect", this.isTextSelected );
|
||||
this.showItem( "frame", this.inFrame );
|
||||
this.showItem( "frame-sep", this.inFrame );
|
||||
},
|
||||
initClipboardItems : function () {
|
||||
// Select All is always OK, unless in directory listing.
|
||||
this.showItem( "context-selectall", !this.inDirList );
|
||||
|
||||
// Copy depends on whether there is selected text.
|
||||
// Enabling this context menu item is now done through the global
|
||||
// command updating system
|
||||
// this.setItemAttr( "context-copy", "disabled", this.isNoTextSelected() );
|
||||
// this.setItemAttr( "context-copy", "disabled", !this.isTextSelected() );
|
||||
|
||||
goUpdateGlobalEditMenuItems();
|
||||
|
||||
// Items for text areas
|
||||
this.showItem( "context-cut", this.onTextInput );
|
||||
this.showItem( "context-paste", this.onTextInput );
|
||||
this.showItem( "context-undo", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-sep-undo", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-cut", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-copy", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-paste", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-delete", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-sep-paste", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-selectall", this.isTextSelected || this.onTextInput );
|
||||
this.showItem( "context-sep-selectall", this.isTextSelected );
|
||||
|
||||
// XXX dr
|
||||
// ------
|
||||
|
@ -189,14 +175,15 @@ nsContextMenu.prototype = {
|
|||
|
||||
// Copy link location depends on whether we're on a link.
|
||||
this.showItem( "context-copylink", this.onLink );
|
||||
this.showItem( "context-sep-copylink", this.onLink );
|
||||
|
||||
// Copy image location depends on whether we're on an image.
|
||||
this.showItem( "context-copyimage", this.onImage );
|
||||
this.showItem( "context-sep-copyimage", this.onImage );
|
||||
},
|
||||
initMetadataItems : function () {
|
||||
// Show if user clicked on something which has metadata.
|
||||
this.showItem( "context-metadata", this.onMetaDataItem );
|
||||
this.showItem( "context-sep-clip", this.onMetaDataItem );
|
||||
},
|
||||
// Set various context menu attributes based on the state of the world.
|
||||
setTarget : function ( node ) {
|
||||
|
@ -453,6 +440,11 @@ nsContextMenu.prototype = {
|
|||
// Determine linked-to URL.
|
||||
openNewTabWith( this.linkURL() );
|
||||
},
|
||||
// Open frame in a new tab.
|
||||
openFrameInTab : function () {
|
||||
// Determine linked-to URL.
|
||||
openNewTabWith( this.target.ownerDocument.location.href );
|
||||
},
|
||||
// Reload clicked-in frame.
|
||||
reloadFrame : function () {
|
||||
this.target.ownerDocument.location.reload();
|
||||
|
@ -520,6 +512,24 @@ nsContextMenu.prototype = {
|
|||
Components.interfaces.nsIClipboardHelper );
|
||||
clipboard.copyString(addresses);
|
||||
},
|
||||
addBookmark : function() {
|
||||
var docshell = document.getElementById( "content" ).webNavigation;
|
||||
BookmarksUtils.addBookmark( docshell.currentURI.spec,
|
||||
docshell.document.title,
|
||||
docshell.document.charset,
|
||||
false );
|
||||
},
|
||||
addBookmarkForFrame : function() {
|
||||
var doc = this.target.ownerDocument;
|
||||
var uri = doc.location.href;
|
||||
var title = doc.title;
|
||||
if ( !title )
|
||||
title = uri;
|
||||
BookmarksUtils.addBookmark( uri,
|
||||
title,
|
||||
doc.charset,
|
||||
false );
|
||||
},
|
||||
// Open Metadata window for node
|
||||
showMetadata : function () {
|
||||
window.openDialog( "chrome://navigator/content/metadata.xul",
|
||||
|
@ -622,19 +632,12 @@ nsContextMenu.prototype = {
|
|||
|
||||
return text;
|
||||
},
|
||||
// Returns "true" if there's no text selected, null otherwise.
|
||||
isNoTextSelected : function ( event ) {
|
||||
// Not implemented so all text-selected-based options are disabled.
|
||||
return "true";
|
||||
},
|
||||
|
||||
//Get selected object and convert it to a string to get
|
||||
//selected text. Only use the first 15 chars.
|
||||
isTextSelected : function() {
|
||||
isTextSelection : function() {
|
||||
var result = false;
|
||||
var selection = this.searchSelected();
|
||||
if (!gDefaultEngine)
|
||||
gDefaultEngine = new nsDefaultEngine();
|
||||
var searchSelect = document.getElementById('context-searchselect');
|
||||
|
||||
var bundle = srGetStrBundle("chrome://communicator/locale/contentAreaCommands.properties");
|
||||
|
@ -645,19 +648,12 @@ nsContextMenu.prototype = {
|
|||
if (searchSelectText.length > 15)
|
||||
searchSelectText = searchSelectText.substr(0,15) + "...";
|
||||
result = true;
|
||||
} else {
|
||||
searchSelectText = bundle.GetStringFromName("searchUnknown");
|
||||
}
|
||||
|
||||
// format "Search for <selection>" string to show in menu
|
||||
searchSelectText = bundle.formatStringFromName("searchText",
|
||||
[gDefaultEngine.name, searchSelectText], 2);
|
||||
searchSelect.setAttribute("label", searchSelectText);
|
||||
|
||||
// add icon for default engine we're gonna use to search
|
||||
// (eliminates last icon if we can't find current engine's icon)
|
||||
searchSelect.setAttribute("src", gDefaultEngine.icon);
|
||||
|
||||
// format "Search for <selection>" string to show in menu
|
||||
searchSelectText = bundle.formatStringFromName("searchText",
|
||||
[searchSelectText], 1);
|
||||
searchSelect.setAttribute("label", searchSelectText);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
|
|
|
@ -42,42 +42,6 @@ function toNavigator()
|
|||
OpenBrowserWindow();
|
||||
}
|
||||
|
||||
// Set up a lame hack to avoid opening two bookmarks.
|
||||
// Could otherwise happen with two Ctrl-B's in a row.
|
||||
var gDisableHistory = false;
|
||||
function enableHistory() {
|
||||
gDisableHistory = false;
|
||||
}
|
||||
|
||||
function toHistory()
|
||||
{
|
||||
// Use a single sidebar history dialog
|
||||
|
||||
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
|
||||
var iwindowManager = Components.interfaces.nsIWindowMediator;
|
||||
var windowManager = cwindowManager.QueryInterface(iwindowManager);
|
||||
|
||||
var historyWindow = windowManager.getMostRecentWindow('history:manager');
|
||||
|
||||
if (historyWindow) {
|
||||
//debug("Reuse existing history window");
|
||||
historyWindow.focus();
|
||||
} else {
|
||||
//debug("Open a new history dialog");
|
||||
|
||||
if (true == gDisableHistory) {
|
||||
//debug("Recently opened one. Wait a little bit.");
|
||||
return;
|
||||
}
|
||||
gDisableHistory = true;
|
||||
|
||||
window.open( "chrome://communicator/content/history/history.xul", "_blank",
|
||||
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar" );
|
||||
setTimeout(enableHistory, 2000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function toDownloadManager()
|
||||
{
|
||||
var dlmgr = Components.classes['@mozilla.org/download-manager;1'].getService();
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
<!-- 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 openLinkCmd.label "Open Link in New Window">
|
||||
<!ENTITY openLinkCmd.accesskey "W">
|
||||
<!ENTITY openLinkCmdInTab.label "Open Link in New Tab">
|
||||
<!ENTITY openLinkCmdInTab.accesskey "T">
|
||||
<!ENTITY openLinkInWindowCmd.label "Open">
|
||||
<!ENTITY openLinkInWindowCmd.accesskey "p">
|
||||
<!ENTITY openFrameCmd.label "Open Frame in New Window">
|
||||
<!ENTITY openFrameCmd.accesskey "o">
|
||||
<!ENTITY openFrameCmd.accesskey "W">
|
||||
<!ENTITY openFrameCmdInTab.label "Open Frame in New Tab">
|
||||
<!ENTITY openFrameCmdInTab.accesskey "T">
|
||||
<!ENTITY showOnlyThisFrameCmd.label "Show Only This Frame">
|
||||
<!ENTITY showOnlyThisFrameCmd.accesskey "w">
|
||||
<!ENTITY addToBookmarksCmd.label "Add to Bookmarks">
|
||||
<!ENTITY addToBookmarksCmd.label "Bookmark This Page">
|
||||
<!ENTITY addToBookmarksCmd.accesskey "B">
|
||||
<!ENTITY goBackCmd.label "Back">
|
||||
<!ENTITY goBackCmd.accesskey "b">
|
||||
|
@ -19,7 +21,7 @@
|
|||
<!ENTITY reloadCmd.accesskey "r">
|
||||
<!ENTITY reloadCmd.commandkey "r">
|
||||
<!ENTITY stopCmd.label "Stop">
|
||||
<!ENTITY stopCmd.accesskey "s">
|
||||
<!ENTITY stopCmd.accesskey "S">
|
||||
<!ENTITY reloadFrameCmd.label "Reload Frame">
|
||||
<!ENTITY reloadFrameCmd.accesskey "r">
|
||||
<!ENTITY viewPageSourceCmd.label "View Page Source">
|
||||
|
@ -31,39 +33,46 @@
|
|||
<!ENTITY viewFrameInfoCmd.label "View Frame Info">
|
||||
<!ENTITY viewFrameInfoCmd.accesskey "i">
|
||||
<!ENTITY viewImageCmd.label "View Image">
|
||||
<!ENTITY viewImageCmd.accesskey "w">
|
||||
<!ENTITY viewImageCmd.accesskey "I">
|
||||
<!ENTITY viewBGImageCmd.label "View Background Image">
|
||||
<!ENTITY viewBGImageCmd.accesskey "w">
|
||||
<!ENTITY setWallpaperCmd.label "Set As Wallpaper">
|
||||
<!ENTITY bookmarkPageCmd.label "Bookmark this Page">
|
||||
<!ENTITY bookmarkPageCmd.accesskey "b">
|
||||
<!ENTITY bookmarkLinkCmd.label "File Bookmark for Link...">
|
||||
<!ENTITY bookmarkLinkCmd.accesskey "b">
|
||||
<!ENTITY setWallpaperCmd.accesskey "S">
|
||||
<!ENTITY bookmarkPageCmd.label "Bookmark This Page">
|
||||
<!ENTITY bookmarkPageCmd.accesskey "m">
|
||||
<!ENTITY bookmarkLinkCmd.label "Bookmark This Link">
|
||||
<!ENTITY bookmarkLinkCmd.accesskey "L">
|
||||
<!ENTITY bookmarkFrameCmd.label "Bookmark This Frame">
|
||||
<!ENTITY bookmarkFrameCmd.accesskey "f">
|
||||
<!ENTITY savePageCmd.label "Save Page As...">
|
||||
<!ENTITY savePageCmd.accesskey "A">
|
||||
<!ENTITY savePageCmd.commandkey "s">
|
||||
<!ENTITY saveFrameCmd.label "Save Frame As...">
|
||||
<!ENTITY saveFrameCmd.accesskey "f">
|
||||
<!ENTITY saveLinkCmd.label "Save Link As...">
|
||||
<!ENTITY saveLinkCmd.accesskey "A">
|
||||
<!ENTITY saveImageCmd.accesskey "a">
|
||||
<!ENTITY saveLinkCmd.label "Save Link Target As...">
|
||||
<!ENTITY saveLinkCmd.accesskey "r">
|
||||
<!ENTITY saveImageCmd.label "Save Image As...">
|
||||
<!ENTITY saveImageCmd.accesskey "v">
|
||||
<!ENTITY copyCmd.label "Copy">
|
||||
<!ENTITY copyCmd.accesskey "c">
|
||||
<!ENTITY selectAllCmd.label "Select All">
|
||||
<!ENTITY selectAllCmd.accesskey "l">
|
||||
<!ENTITY copyLinkCmd.label "Copy Link Address">
|
||||
<!ENTITY copyLinkCmd.accesskey "n">
|
||||
<!ENTITY selectAllCmd.accesskey "A">
|
||||
<!ENTITY copyLinkCmd.label "Copy Link Location">
|
||||
<!ENTITY copyLinkCmd.accesskey "C">
|
||||
<!ENTITY copyImageCmd.label "Copy Image Location">
|
||||
<!ENTITY copyImageCmd.accesskey "m">
|
||||
<!ENTITY copyImageCmd.accesskey "o">
|
||||
<!ENTITY metadataCmd.label "Properties">
|
||||
<!ENTITY metadataCmd.accesskey "">
|
||||
<!ENTITY metadataCmd.accesskey "P">
|
||||
<!ENTITY copyEmailCmd.label "Copy Email Address">
|
||||
<!ENTITY copyEmailCmd.accesskey "E">
|
||||
<!ENTITY pasteCmd.label "Paste">
|
||||
<!ENTITY pasteCmd.accesskey "p">
|
||||
<!ENTITY cutCmd.label "Cut">
|
||||
<!ENTITY cutCmd.accesskey "u">
|
||||
<!ENTITY cutCmd.accesskey "t">
|
||||
<!ENTITY deleteCmd.label "Delete">
|
||||
<!ENTITY deleteCmd.accesskey "D">
|
||||
<!ENTITY undoCmd.label "Undo">
|
||||
<!ENTITY undoCmd.accesskey "U">
|
||||
<!ENTITY thisFrameMenu.label "This Frame">
|
||||
<!ENTITY thisFrameMenu.accesskey "F">
|
||||
<!ENTITY search.accesskey "W">
|
Загрузка…
Ссылка в новой задаче