views:

16

answers:

0

Hello,

well I'm trying to deactivate the middle mouse button function in firefox (middle click on a link shouldn't open a new tab).

I found the right function:

function handleLinkClick(event, href, linkNode)
{
  var doc = event.target.ownerDocument;

  switch (event.button) {
    case 0:    // if left button clicked
//@line 4966 "e:\builds\moz2_slave\win32_build\build\browser\base\content\browser.js"
      if (event.ctrlKey) {
//@line 4968 "e:\builds\moz2_slave\win32_build\build\browser\base\content\browser.js"
        openNewTabWith(href, doc, null, event, false);
        event.stopPropagation();
        return true;
      }

  if (event.shiftKey && event.altKey) {
    var feedService = 
        Cc["@mozilla.org/browser/feeds/result-service;1"].
        getService(Ci.nsIFeedResultService);
    feedService.forcePreviewPage = true;
    loadURI(href, null, null, false);
    return false;
  }

  if (event.shiftKey) {
    openNewWindowWith(href, doc, null, false);
    event.stopPropagation();
    return true;
  }

  if (event.altKey) {
    saveURL(href, linkNode ? gatherTextUnder(linkNode) : "", null, true,
            true, doc.documentURIObject);
    return true;
  }

  return false;
case 1:    // if middle button clicked
  var tab = gPrefService.getBoolPref("browser.tabs.opentabfor.middleclick");
  if (tab)
    openNewTabWith(href, doc, null, event, false);
  else
    openNewWindowWith(href, doc, null, false);
  event.stopPropagation();
  return true;
  }
  return false;
}

How to override this function?

Greetings.

related questions