MenuManipulator 20140526

Talk about add-ons and extension development.
Post Reply
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

MenuManipulator 20140526

Post by dorando »

This extension allows you to move, edit, or create new <menu>, <menuitem>, and <menuseparator> elements within a <menubar>, <popup>, or the <tabbrowser>s context menu.

Moving happens via drag and drop, everything else (currently) via right clicking on the menu or attribute pane.

MenuManipulator should work with Firefox, Thunderbird, SeaMonkey, and any other XULRunner Application.

Gecko Bugs / Limitations:
- Setting some specific attributes corrupts the .attributes list (should be harmless in most cases).
- Setting attributes which are <observe>d (maybe from a <command>) will likely fail.
- User created Top Level <menu>s without a style attribute are invisible as the core (incorrectly) assumes that they are empty.

Notes:
- Future version might not be backward compatible.
- If an extension (or an app update) adds/removes <menuseparator>s or <menu><menupopup> constructs without an id, some actions might be applied to the wrong items.
- The MenuManipulator dialog tries to avoid generated menu items as these can mix up move actions, but since there is no easy way detecting these, some might still be listed.
- If you disable an extension which adds menu items, it is advisable to reset these specific items or there is a chance that some move actions are misinterpreted.

Other extensions:
- Menu Editor
- Personal Menu (Personal Firefox Button)
- S3.Menu Wizard

Configurations:

Code: Select all

prefs.js: (use about:config to edit these)

// Set the number of fallbacks the Move action should use
user_pref("menumanipulator.Move.fallbacks", 0);

// Module('UIHook'); adds a menuitem to all windows matching this pref
user_pref("menumanipulator.UIHook", "");

// Don't check any code for syntax
user_pref("menumanipulator.editor.checkSyntax", "^$");

// Code which will be run in every window
user_pref("menumanipulator.global.20140526", "Module('UIHook');");

// Run also in chrome tabs (about:config, etc)
user_pref("menumanipulator.observe", "chrome-document-global-created");

// Determines if the state of an item should be saved along with other edits
user_pref("menumanipulator.saveState", true);

// Try using Orion (Firefox ESR 24) or CodeMirror (Firefox 26+)
user_pref("menumanipulator.source-editor", true);

// Disable code folding in CodeMirror (Firefox 26+)
user_pref("menumanipulator.source-editor.enableCodeFolding", false);

// Show trailing space in CodeMirror (Firefox 26+)
user_pref("menumanipulator.source-editor.showTrailingSpace", true);

userChrome.css:

/* Don't highlight changes */
#menumanipulator-window treechildren::-moz-tree-cell-text(created),
#menumanipulator-window treechildren::-moz-tree-cell-text(moved),
#menumanipulator-window treechildren::-moz-tree-cell-text(modified) {
 font-weight: normal !important;
}

Changes:
20140526:
- Restructured the service to workaround an issue preventing the global pref to be set for new profiles (causing limited functionality)
- Restructured the .xpi (removed the .zip, moved everything except defaults and locale to top)
- Restored Icons and Treelines
- Rows and Cells can be styled now (properties: created, moved, modified)
- The Edit window now persists position and size
- Increased the default size of the main window
- UIHook will now try the first menupopup if the alternatives are missing
- New menumanipulator.observe pref controlling which window types the service should observe
- New menumanipulator.editor.checkSyntax pref controlling which attributes should be checked for syntax errors
- New menumanipulator.source-editor pref controlling if Orion (Firefox ESR 24) or CodeMirror (Firefox 26+) should be used
- New menumanipulator.source-editor.* prefs controlling CodeMirror settings
- Added "use strict"; to various code
- Added support for anonymous tabContextMenu (Instantbird)
- Removed the workaround for problems introduced by bug 300412 and bug 254021 (not needed anymore)
- Removed nsDragAndDrop and reworked depending code
- Removed SetTab for Firefox (not needed anymore)
- Removed <command> from overlay.xul and moved attributes directly to the <menuitem> (makes it easier to edit)
- Removed script type (not needed anymore thanks to bug 830665)
- Removed XPath.js (since the built-in XPath support can't be disabled anymore, see bug 304494)
- Removed code for obsolete applications
- Replaced deprecated Attr .nodeValue and .nodeName
- Replaced deleteBranch with a clearUserPref iterator
- Changed code to use Services.jsm where possible
- Changed Module and Load to pass UTF-8 to loadSubScript
- Changed Module and Load to reportError
- Changed code to use children/nextElementSibling/previousElementSibling/firstElementChild/lastElementChild where possible

Full Changelog.
Last edited by dorando on May 27th, 2014, 5:09 am, edited 12 times in total.
Support mozilla.dorando.at through donations/contributions.
User avatar
Tene
Posts: 129
Joined: June 11th, 2004, 10:02 am
Location: United Kingdom

Post by Tene »

In the hope this'll work using the latest trunk, I'll try it ... btw what about "Menulator"? Sounds very retro 8)

Edit: stupid me, didn't notice that it didn't delete (well, until I found out first hand).
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

Tene wrote:In the hope this'll work using the latest trunk
It works.

Tene wrote:didn't notice that it didn't delete
I did not implement a method to delete items as this can cause problems. If you want to hide an item use the <a href="http://www.mozilla.org/support/firefox/tips#app_mainmenu">built-in</a> functionality or set <code>style</code> to <code>display:none</code> of the specific item.
Worldseye
Posts: 118
Joined: March 19th, 2004, 5:50 pm

Post by Worldseye »

Does this extension coniflict with Menu Editor?.. I'm guessing it does, but wanted to ask, as with them both you'd have complete control.. next question.. any plans to combine this extension with Menu Editor?
Dan
jedbro
Posts: 1899
Joined: November 10th, 2002, 12:35 pm
Location: Mexico / Boulder Co.
Contact:

Post by jedbro »

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

Post by dorando »

Worldseye wrote:Does this extension coniflict with Menu Editor?.. I'm guessing it does, but wanted to ask, as with them both you'd have complete control.. next question.. any plans to combine this extension with Menu Editor?
MenuManipulator is an alternative approach to the same core functionality provided by Menu Editor, so yes it will conflict with it (you shouldn't have a need for it anyway)....
Zoolcar9
Posts: 2225
Joined: November 9th, 2004, 6:45 pm
Location: Jakarta, Indonesia (UTC+7)
Contact:

Post by Zoolcar9 »


I'm still using MenuEditor 1.1, and it works with MenuManipulator :)

My Firefox information | Add-ons | GitHub

"With great power, comes great desire to show it off."
Ebu
Posts: 15
Joined: June 4th, 2005, 12:54 am

Re: MenuManipulator 20050529

Post by Ebu »

Hi!
I tested MM and liked especially the funktion to add new menus.
But I've got one question: Is it possible to copy items of menus? I'd love the possibillity to create a new Menu (as the 'tool' menu) with the options I like and need. But I don't want to 'cut' them from their original position. Think that would be cool.

Thanks so far,
Ebu
hydreux
Posts: 237
Joined: August 11th, 2003, 9:32 pm

Post by hydreux »

just wondering, where does the ext. save the changes made to the menubar?
i made some changes then unistalled the ext. & the menubar reverted to the original form...
is it possible keep the changes even after uninstalling the ext.?

attaching the changes made...
<a href="http://img78.echo.cx/my.php?image=menumanipulator4dw.png"><img src="http://img78.echo.cx/img78/6550/menumanipulator4dw.th.png" border="0" alt="" /></a>
Image hosting by ImageShack
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

Zoolcar9 wrote:I'm still using MenuEditor 1.1, and it works with MenuManipulator :)
This will eventually lead to problems...

Ebu wrote:Is it possible to copy items of menus?
I'm considering adding the ability to clone and/or copy nodes, but this likey will cause some issue. For the time being, the only way is to recreate the wanted menu items.

hydreux wrote:just wondering, where does the ext. save the changes made to the menubar?
In the prefs as menumanipulator.<i>location</i>. Without the MenuManipulatorService this isn't of much use.
thorazine
Posts: 70
Joined: September 19th, 2004, 10:07 am

Post by thorazine »

I tried this, I've use MenuEditor before, but resetted menus and edited menuedit.rdf and installed this one and found no problems.
Can this be used safely without breaking anything to create context menu child entries? (This is something MenuEditor cant do AFAIK).
I dont understand what most of the known bugs / limitations mean, say, what items can or cant I move? Can I add / delete separators?
dorando
Posts: 1203
Joined: January 9th, 2004, 9:57 am
Contact:

Post by dorando »

thorazine wrote:Can this be used safely without breaking anything to create context menu child entries?
I hope so.

thorazine wrote:[...] what items can or cant I move?
All items listed should be movable, but moving some item with an eventListener (like the Greasemonkey menuitems) or their containers will cause these eventListener to be lost.

thorazine wrote:Can I add / delete separators?
Adding: yes, deleting: no (but you can hide it by setting <code>style</code> to <code>display:none</code>).
korsch
Posts: 3
Joined: July 5th, 2005, 1:26 pm

Post by korsch »

Will this extension (or any other method) allow me to hide options on the Bookmarks Context Menu, such as the 'Sort By Name' option (I hit this by accident sometimes)??

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

Post by dorando »

Use

Code: Select all

menuitem[label="Sort By Name"], menuitem[label="Sort By Name"] + menuseparator
{ display: none !important; }
or

Code: Select all

#bookmarks-context-menu menuitem[command="cmd_bm_sortbyname"],
#bookmarks-context-menu menuitem[command="cmd_bm_sortbyname"] + menuseparator
{ display: none !important; }
in your userChrome.css

Editing the Bookmarks Context Menu won't be supported by MenuManipulator as this menu is (re)generated on demand.
korsch
Posts: 3
Joined: July 5th, 2005, 1:26 pm

Post by korsch »

That worked for me, thanks very much!
Post Reply