Bug 23460 fix:Bookmarks URL should show in status bar at mouseover of menuitem

The following is a fix for bug 23460 that can be applied to Mozilla 1.4 and after. After the fix is applied, you can roll over the bookmark items in the bookmarks menu and personal toolbar and the URL for the bookmark will immediately appear in the statusbar.

Change chrome/comm/content/communicator/bookmarks/bookmarksMenu.js (or grab the file or get the patch and apply it):

1. Add the statusbarLabel and statusbarIsSave after _orientation:

var BookmarksMenu = {
  _selection:null,
  _target:null,
  _orientation:null,
  statusbarLabel:'',
  statusbarIsSaved:false,

2. Right before the var BookmarksMenuController = line and after the end of the loadBookmark function, add the showBookmarkURL and hideBookmarkURL functions:

    BookmarksCommand.openBookmark(selection, "current", aDS)
  },
  
  showBookmarkURL: function (aTarget, aDS)
  {
     if (aTarget.id != '' && BookmarksUtils.resolveType(aTarget.id) == 'Bookmark') 
	 {
         var url = BookmarksUtils.getProperty(aTarget.id, NC_NS+'URL', aDS);
	     var statusbar = document.getElementById('statusbar-display');
		 // Need to check this because we can get the mouseover event before
		 // the mouseout event from a previous bookmark in subfolders
		 if (!this.statusbarIsSaved)
		 {
		 	this.statusbarLabel = statusbar.label;
			this.statusbarIsSaved = true;
         }
	     statusbar.label = url;
     }
  },
  
  hideBookmarkURL: function (aTarget)
  {
     // Only restore if the label was set
     if (aTarget.id != '' && BookmarksUtils.resolveType(aTarget.id) == 'Bookmark')
	 {
	     var statusbar = document.getElementById('statusbar-display');
		 statusbar.label = this.statusbarLabel;
		 this.statusbarIsSaved = false;
     }
  }
}

var BookmarksMenuController = {

Make the following changes to the bookmarks template code in chrome/comm/content/navigator/navigatorOverlay.xul (or grab the file or get the patch and apply it):

    <rule parent="hbox">
      <toolbarbutton class="bookmark-item" uri="rdf:*" editable="true" 
                     status="rdf:http://home.netscape.com/WEB-rdf#status"
                     rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
                     statustext="rdf:http://home.netscape.com/NC-rdf#URL"
                     tooltip="btTooltip"
                     label="rdf:http://home.netscape.com/NC-rdf#Name"
                     onmouseover="BookmarksMenu.showBookmarkURL(event.target, this.database)"
                     onmouseout="BookmarksMenu.hideBookmarkURL(event.target)"/>
    </rule>
    <rule nc:FolderGroup="true" iscontainer="true">

...

                  status="rdf:http://home.netscape.com/WEB-rdf#status"
                  onmouseover="BookmarksMenu.showBookmarkURL(event.target, this.database)"
                  onmouseout="BookmarksMenu.hideBookmarkURL(event.target)" />
      </menupopup>
    </rule>
  </template>

Fix developed July 15, 2003


How to apply this change

Although most developers know how to apply this, I've gotten requests for instructions from Mozilla users and since it is fairly easy to apply, I thought I'd include them. I take no responsibility for whether this breaks your Mozilla installation. You're on your own.

Here's what you need to do: In your installed Mozilla's mozilla/bin/chrome directory you'll see a number of JAR files. A JAR file stands for "Java Archive". The important thing to know is that they are just ZIP files. You can rename them and open them with your favorite unzip tool. (Or just click them like a normal folder in Windows XP) The files bookmarksMenu.js and navigatorOverlay.xul mentioned in the patch are located in the comm.jar file.

What you need to do is grab those files by unzipping the JAR, make the changes described in the patch, and then zip them back up--and here's the important part--making sure that they are added with the path information preserved. So, looking at them in the jar, you'll see their path as content/communicator/bookmarks/ for bookmarksMenu.js and content/navigator/ for navigatorOverlay.xul.

After the changes are applied to the JAR, you should be able to restart Mozilla and see the URL in the statusbar when opening the bookmarks menu and when looking at folders on your bookmarks toolbar.

Instructions added Nov 24, 2003

Copyright © 2000-2010 Tim Powell
All rights reserved.