MenuManipulator 20140526

Talk about add-ons and extension development.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: MenuManipulator 20110327

Post by morat »

@joshfeingold

Try to create a menuitem in the menupopup id="emailAddressPopup".

label: Search Email Address

oncommand:

Code: Select all

var eps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].
  getService(Components.interfaces.nsIExternalProtocolService);
var ios = Components.classes["@mozilla.org/network/io-service;1"].
  getService(Components.interfaces.nsIIOService);
var ea = findEmailNodeFromPopupNode(document.popupNode, "emailAddressPopup").
  getAttribute("emailAddress");
eps.loadURI(ios.newURI("http://www.google.com/search?q=" + ea, null, null));

Edit:

Philip Chee wrote:emailNode.getAttribute("emailAddress") is for SeaMonkey and old Thunderbird.
emailNode.parentNode.parentNode.getAttribute("emailAddress") is for new Thunderbird with the silly message header pain er pane.
Last edited by morat on July 20th, 2012, 6:47 am, edited 1 time in total.
LewisR1
Posts: 13
Joined: October 16th, 2005, 2:19 pm
Location: New York, USA
Contact:

Re: MenuManipulator 20110327

Post by LewisR1 »

That's quite elegant, indeed.

Any thoughts on the differences necessary to have that function under SeaMonkey vs TB/FF? Just curious. I haven;t looked closely enough to try to sort it out for myself.

TIA
Lewis
Lewis G Rosenthal, CNA, CLE, CLP, CWTS
Rosenthal & Rosenthal, LLC
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Re: MenuManipulator 20110327

Post by Philip Chee »

LewisR1 wrote:That's quite elegant, indeed.

Any thoughts on the differences necessary to have that function under SeaMonkey vs TB/FF? Just curious. I haven;t looked closely enough to try to sort it out for myself.

TIA

Since SeaMonkey has a browser component, "http:" isn't an "external protocol". You should probably use openUILink() instead.
We also don't have findEmailNodeFromPopupNode()

From my addressContext (http://xsidebar.mozdev.org/modifiedmailnews.html#addresscontext) mod:
XUL:

Code: Select all

  <popup id="emailAddressPopup">
    <menuitem id="blah" label="&lookUpInBook.label;" oncommand="lookUpCard(document.popupNode);" />
  </popup>

JS:

Code: Select all

function lookUpCard(emailNode)
{
  if(emailNode){
    var email = emailNode.getAttribute("emailAddress") ||
                emailNode.parentNode.parentNode.getAttribute("emailAddress");
..........
  }
}

Then you probably want to do something like:

Code: Select all

openUILink("http://www.google.com/search?q=" + email);

Phil
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Re: MenuManipulator 20110327

Post by Philip Chee »

Code: Select all

function lookUpCard(emailNode)
{
  if(emailNode){
    var email = emailNode.getAttribute("emailAddress") ||
                emailNode.parentNode.parentNode.getAttribute("emailAddress");
..........
  }
}

emailNode.getAttribute("emailAddress") is for SeaMonkey and old Thunderbird.
emailNode.parentNode.parentNode.getAttribute("emailAddress") is for new Thunderbird with the silly message header pain er pane.

Phil
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: MenuManipulator 20110327

Post by morat »

@LewisR1

Firefox:

Step 1)

* create a menuitem in the menupopup id="contentAreaContextMenu"

label: Search Email Address

oncommand:

Code: Select all

var url = gContextMenu.linkURL;
var qmark = url.indexOf("?");
var email = qmark > 7 ? url.substring(7, qmark) : url.substr(7);
gBrowser.addTab("http://www.google.com/search?q=" + email);

note: 7 == length of "mailto:"

Step 2)

* insert the following line in the onpopupshowing attribute in the menupopup id="contentAreaContextMenu"

Code: Select all

  if (event.target != this)
    return true;
  gContextMenu = new nsContextMenu(this, gBrowser, event.shiftKey);
  if (gContextMenu.shouldDisplay)
    updateEditUIVisibility();
+ document.getElementById("__ID__").hidden = !gContextMenu.onMailtoLink;
  return gContextMenu.shouldDisplay;

note: replace __ID__ with the id attribute of the menuitem

note: might need to restart Firefox after editing the onpopupshowing attribute

http://www.w3schools.com/html/tryit.asp ... tml_mailto
LewisR1
Posts: 13
Joined: October 16th, 2005, 2:19 pm
Location: New York, USA
Contact:

Re: MenuManipulator 20110327

Post by LewisR1 »

Thanks. Actually, I think Phil hit on it more to the point (for me), as I was looking for a way of applying this to SeaMonkey. Still, all of these solutions for adding functions to the context menu for an email address and passing the address as a parameter are quite slick. I'm constantly amazed at how we need to use the tools we may know so well in different ways (I've had my head in some advanced Linux routing stuff for a new client, and I never would have even thought about doing things like this with packets before). ;-)

Thanks again...both of you!

Cheers
Lewis
Lewis G Rosenthal, CNA, CLE, CLP, CWTS
Rosenthal & Rosenthal, LLC
User avatar
pohunohi
Posts: 27
Joined: October 1st, 2010, 4:54 am

Re: MenuManipulator 20110327

Post by pohunohi »

Why is not visible MenuManipulator menu AppButton?

Image
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: MenuManipulator 20110327

Post by dorando »

bazzacad wrote:I noticed that you've added this line to the "prefs.js"

Code: Select all

user_pref("menumanipulator.chrome://messenger/content/messenger.xul", "Node(\"id('folderPaneContext-rename')\"); Set('label','TM Rename'); Set('oncommand','alert(\"Hello World!\");'); ");
How could I take this user_pref & incorporate it into my add-on without all the extra functionality of your add-on?
MenuManipulator in essence does just

Code: Select all

var node document.getElementById("folderPaneContext-rename");
node.setAttribute("label","TM Rename");
node.setAttribute("oncommand",'alert("Hello World!");'); 
during the load event phase. Alternatively you could add

Code: Select all

<target id="folderPaneContext-rename" label="TM Rename" oncommand='alert("Hello World!");' /> 
to an overlay.

pohunohi wrote:Why is not visible MenuManipulator menu AppButton?
MenuManipulator can't currently edit the Firefox Button since it is not a proper menu, you can use Personal Menu (Personal Firefox Button) to edit it.
Support mozilla.dorando.at through donations/contributions.
Bernd S.
Posts: 95
Joined: January 22nd, 2010, 7:14 am

How to open View > Toolbars > Customize

Post by Bernd S. »

I'm trying to define a short-cut to open the menu "customize" .

Code: Select all

cmd_CustomizeMailToolbar
doesn't seem to work at all.

TB 17.0.2
Win7 x86
MP 20110327

Thank you

Bernd
Last edited by Bernd S. on January 25th, 2013, 9:28 am, edited 1 time in total.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: MenuManipulator 20110327

Post by dorando »

Try

Code: Select all

CustomizeMailToolbar('mail-toolbox''CustomizeMailToolbar'); 
Support mozilla.dorando.at through donations/contributions.
Bernd S.
Posts: 95
Joined: January 22nd, 2010, 7:14 am

Re: MenuManipulator 20110327

Post by Bernd S. »

Thank you Dorando, that works.
troypst
Posts: 16
Joined: March 15th, 2013, 5:19 am

Re: MenuManipulator 20110327

Post by troypst »

Hi dorando, I'd like to replace menueditor with menumanipulator, so before installing I tested it on a new profile, as unique extension. I edited the Edit menu and all was ok till I restarted and my changes were messed up. In the error console i found this:

"XUL box for _moz_generated_content_after element contained an inline #text child, forcing all its children to be wrapped in a block."

What am I doing wrong? I use FF19.02 on winXP.

Thanx.
troypst
Posts: 16
Joined: March 15th, 2013, 5:19 am

Re: MenuManipulator 20110327

Post by troypst »

Same thing happens with firefox 20.0.1. Also some separators return back to normal after being edited/hidden.
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Re: MenuManipulator 20110327

Post by dorando »

troypst wrote:"XUL box for _moz_generated_content_after element contained an inline #text child, forcing all its children to be wrapped in a block."
Happens for me in a clean profile, should be harmless.
troypst wrote:Same thing happens with firefox 20.0.1. Also some separators return back to normal after being edited/hidden.
MenuManipulator apparently doesn't correctly initialize for new profiles since 12.0… I hope to release an update soon to fix that, but just setting menumanipulator.global.20110327 in about:config to

Code: Select all

SetID(); 
should fix it too.
Support mozilla.dorando.at through donations/contributions.
troypst
Posts: 16
Joined: March 15th, 2013, 5:19 am

Re: MenuManipulator 20110327

Post by troypst »

That worked fine. Thanx.
Post Reply