Throbber URL

From MozillaZine Knowledge Base
Revision as of 10:19, 8 May 2007 by Rod Whiteley (talk | contribs) (rewrite for version 2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
This article applies to Firefox, Thunderbird and SeaMonkey.

The throbber is an image at the right of the main toolbar that animates when a server connection is active. Its appearance might depend on the theme you are using. In the default theme, it looks like:

Firefox or Thunderbird
SeaMonkey

In older versions of Firefox and Thunderbird you could click the throbber to open a URL. This feature is still present in SeaMonkey, and you can restore it in Firefox and Thunderbird. For information about preference settings for older versions, see an older version of this article.

Firefox

To make the throbber clickable so that it opens various URLs, depending on how you click it, you can use the Throbber Button extension.

Alternatively, use the userChrome.css method described for Thunderbird in the next section, which does not require any extension.

Thunderbird

In Thunderbird you can make the throbber clickable either so that it opens a URL in your default browser (for example, Firefox) or so that it opens a URL in Thunderbird itself (in the message pane).

There are two ways to customize Thunderbird. You can use a userChrome.css file, which does not require any extension but can only open a URL in your default browser. Or you can install and use the userChrome.js extension.

Using userChrome.css

To open a URL in your default browser, add this line to your userChrome.css file:

#throbber-box {-moz-binding: url(userChrome.xml#throbber);}

Make a new text file named userChrome.xml in the same directory as userChrome.css. Copy and paste the new file's content from here:

 <?xml version="1.0"?>
 <!DOCTYPE bindings [
   <!ENTITY url "http://kb.mozillazine.org/">
   <!ENTITY tip "Mozillazine Knowledge Base">
   ]>

 <bindings id="throbber-bindings" xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 <binding id="throbber">
   <content>
     <xul:label class="text-link" href="&url;"
         style="-moz-user-focus: ignore; margin: 0; height: 22px;">
       <xul:stack>
         <children/>
         <xul:box tooltiptext="&tip;" style="cursor: pointer;"/>
         </xul:stack>
       </xul:label>
     </content>
   </binding>
 </bindings>

Customize the URL and tooltip near the top of the new file.

Save the files and restart Thunderbird.

Note:  If this makes the menu bar jump upward occasionally, increase the value 22px in the new file, or if it jumps downward decrease the value. The right value depends on the theme you are using.

Using the userChrome.js extension

To open a URL in Thunderbird's message pane, add this code to your userChrome.js file. When you copy it from this page, make sure that you scroll to get all of the code:

ThrobberLink = {

  // customize:
  tip: "Mozillazine",
  url: "http://www.mozillazine.org/",

  click: function () {
    gMessageNotificationBar.clearMsgNotifications()
    ClearMessageSelection()
    ClearMessagePane()
    ShowThreadPane()
    if (IsMessagePaneCollapsed()) MsgToggleMessagePane()
    GetMessagePaneFrame().location.href = this.url
    },

  load: function (win) {
    var btn = win.document.getElementById("navigator-throbber")
    if (!btn) return

    win.ThrobberLink = this
    with (btn)
      removeAttribute("disabled"),
      setAttribute("oncommand", "ThrobberLink.click()"),
      setAttribute("tooltiptext", ThrobberLink.tip),
      style.cursor = "pointer"
    },

  observe: function (win, act) {
    if (act = "domwindowopened")
      win.QueryInterface(Components.interfaces.nsIDOMEventTarget)
        .addEventListener(
          "load",
          function () {ThrobberLink.load(
            win.QueryInterface(Components.interfaces.nsIDOMWindow))},
          false
          )
    }

  }

ThrobberLink.load(self)

Components
  .classes["@mozilla.org/embedcomp/window-watcher;1"]
  .getService(Components.interfaces.nsIWindowWatcher)
  .registerNotification(ThrobberLink)

Customize the tip and the URL near the top, making sure that you only change text between the double-quote characters.

To open the URL in your default browser, modify the code replacing the click section with:

click: function () {
  messenger.launchExternalURL(this.url)
  },

SeaMonkey

You can configure SeaMonkey throbber URLs separately for each window by setting the following preferences:

Navigator browser.throbber.url
Mail & Newsgroups browser.throbber.url
Address Book addressbook.throbber.url
Composer compose.throbber.url
Editor editor.throbber.url
IRC Chat messenger.throbber.url

See also