How can I remove items from right-click context menu?

Discussion of features in Mozilla Firefox
Locked
Awais
Posts: 61
Joined: December 11th, 2002, 1:33 pm

How can I remove items from right-click context menu?

Post by Awais »

When I right click on an image I am provided 13 different options, including some commands for extensions. When I right-click on a clickable image, the options increase to 16 options. And If I have selected some text on the page, and then right-click on a clickabe image, they increase to 20!!! thats lots of commands and majority of them, i dont need. So I was wondering if there is any way to get rid of some of these un-needed options? i especially don't like google bar items in the context menu, and I have unchecked the option for it in the options box, but its still there. How do i get rid of that? Maybe the developers could look into providing an option to customise right-click menu in future builds, like in TBE?


Secondly, is there a way to get rid of some of the extensions I don't find useful? I know one couldn't earlier on, but has anyone found a solution to the problem yet?

TIA.
sag
Posts: 387
Joined: November 19th, 2002, 8:56 pm

How can I remove items from right-click context menu?

Post by sag »

To remove items from the context menu, suppress their display by making CSS entries for them in your userChrome.css file. For example:

Code: Select all

#context-setWallpaper, #context-blockimage, #context-bookmarkpage
{
display: none;
}

Here's a list of context-menu item names:

#context-back
The "Back" item on the content area context menu.
#context-blockimage
The "Block images…" item on the content area context menu.
#context-bookmarklink
The "Bookmark this Link…" item on the content area context menu.
#context-bookmarkpage
The "Bookmark this Page…" item on the content area context menu.
#context-copy
The "Copy" item on the textbox context menu.
#context-copyemail
The "Copy Email Address" item on the content area context menu.
#context-copyimg
The "Copy Image Location" item on the content area context menu.
#context-copylink
The "Copy Link Location" item on the content area context menu.
#context-cut
The "Cut" item on the textbox context menu.
#context-delete
The "Delete" item on the textbox context menu.
#context-forward
The "Forward" item on the content area context menu.

#context-metadata
The "Properties" item on the content area context menu.
#context-openlink
The "Open Link in New Window" item on the content area context menu.
#context-openlinkintab
The "Open Link in New Tab" item on the content area context menu.
#context-paste
The "Paste" item on the textbox context menu.
#context-reload
The "Reload" item on the content area context menu.
#context-saveimage
The "Save Image As…" item on the content area context menu.
#context-savelink
The "Save Link As…" item on the content area context menu.
#context-savepage
The "Save Page As…" item on the content area context menu.
#context-searchselect
The "Web Search for…" item on the content area context menu.
#context-selectall
The "Select All" item on the textbox context menu.
#context-stop
The "Stop" item on the content area context menu.
#context-setWallpaper
The "Set As Wallpaper" item on the content area context menu.
#context-undo
The "Undo" item on the textbox context menu.
#context-viewbgimage
The "View Background Image" item on the content area context menu.
#context-viewimage
The "View Image" item on the content area context menu.
#context-viewinfo
The "View Page Info" item on the content area context menu.
#context-viewpartialsource-mathml
#context-viewpartialsource-selection
The "View Selection Source" item on the content area context menu.
#context-viewsource
The "View Source" item on the content area context menu.
User avatar
jrduncans
Posts: 316
Joined: September 16th, 2003, 7:22 pm
Location: Norfolk, VA, USA
Contact:

Post by jrduncans »

Thanks for the list sag.

I got rid of my forward, back, reload, and stop choices, because I generally use the buttons for that. This leaves a useless seperator on the context menu. Any idea on how to get rid of that? (I may end up putting reload back on there, so it'll be a non-issue, but I'd still be curious to know how to get rid of it...)
User avatar
soccer_dude182
Posts: 720
Joined: July 11th, 2003, 10:50 pm
Location: Waco, TX

Post by soccer_dude182 »

Wow, thanks for the tip, Sag! I also found the context menu cluttered, but this tip definitely helps me out. Thank you!
sboulema
Posts: 6615
Joined: May 20th, 2003, 12:34 am
Location: Amstelveen, The Netherlands

Post by sboulema »

seperators can be remove by adding -menuseparator after the item before the seperator

so something like this #openintabs-menuseparator,

and thnaks for completing my list sag :D
Awais
Posts: 61
Joined: December 11th, 2002, 1:33 pm

Re: How can I remove items from right-click context menu?

Post by Awais »

sag wrote:To remove items from the context menu, suppress their display by making CSS entries for them in your userChrome.css file. For example:

Code: Select all

#context-setWallpaper, #context-blockimage, #context-bookmarkpage
{
display: none;
}

.


Thanx a lot man. Deleted a lot of useless commands. There are a few that are still bugging me. Was wondering if you could help with them? What is the command for getting rid of:

Send page...
Googlebar items
Save Link to disk...
Send Link
Send Image

And how do i get rid of double horizontal lines just under "Send page..." command? once again, thanx for helping with the problem.
sboulema
Posts: 6615
Joined: May 20th, 2003, 12:34 am
Location: Amstelveen, The Netherlands

Post by sboulema »

sendpage -> #context-sendpage
sendlink -> #context-sendlink
sendimage -> #context-sendimage
User avatar
jrduncans
Posts: 316
Joined: September 16th, 2003, 7:22 pm
Location: Norfolk, VA, USA
Contact:

Post by jrduncans »

sboulema wrote:seperators can be remove by adding -menuseparator after the item before the seperator

so something like this #openintabs-menuseparator,

and thnaks for completing my list sag :D


Thank you muchly.
User avatar
jrduncans
Posts: 316
Joined: September 16th, 2003, 7:22 pm
Location: Norfolk, VA, USA
Contact:

Post by jrduncans »

sboulema wrote:seperators can be remove by adding -menuseparator after the item before the seperator

so something like this #openintabs-menuseparator,

and thnaks for completing my list sag :D


I guess I thanked you too early (while at work, before trying it ;))

Here's what I'm trying now, please tell me if you see what's wrong with it:

/* Remove items from: Right-Click context menu. */
#context-sendpage,
#context-sendimage,
#context-sendlink,
#context-back,
#context-forward,
#context-reload,
#context-stop,
#stop-menuseparator {display:none !important;}

That keeps the menuseparater there. I've tried several other possible ways, but not that work...
My Yute
Posts: 895
Joined: June 5th, 2003, 1:19 am
Location: Kingston, Jamaica

Post by My Yute »

Here's my CSS file - most annoying things are gone. There's a mor ecomplete one on the forums that I edited to get this one but I couldn't find it doing a qucik search. Probably you wil have more luck.

Code: Select all

/* ----------------------------- Context Menu ------------------------------ */

/* --------------------------------- Link ---------------------------- */
/* Open Link in New Window */
#context-openlink {
 display: none !important;   
}
/* Open Link in New Tab */
#context-openlinkintab {
 display: none !important;   
}
/* separator below the "Open Link in ..." items */
#context-sep-open {
 display: none !important;   
}

/* Bookmark This Link... */
#context-bookmarklink {
 
}

/* Save Link As... */
#context-savelink {

}

/* Send Link. . .*/
#context-sendlink{
display:none !important;
}

/* Copy Email Address */
#context-copyemail {
 display: none !important;   
}
/* Copy Link Location */
#context-copylink {
 display: none !important;   
}
/* separator below the items related to links */
#context-sep-copylink {
 display: none !important;   
}
/* ------------------------------- End Link ---------------------------- */

/* ----------------------------- Images ------------------------------ */
/* View Image */
#context-viewimage {
 display: none !important;   
}
/* Copy Image Location */
#context-copyimage {
 display: none !important;   
}
/* separator below the Copy Image Location item */
#context-sep-copyimage {
 display: none !important;   
}
/* Save Image As... */
#context-saveimage {
 display: none !important;   
}
/* Set As Wallpaper */
#context-setWallpaper {
   display: none !important;
}
/* Block Images from this Server */
#context-blockimage {
   display: none !important;
}
/* -------------------------- End Images ------------------------------ */

/* --------------------------- Web Page---------------------------- */
/* Back */
#context-back {
 display: none !important;   
}
/* Forward */
#context-forward {
   display: none !important;
}
/* Reload */
#context-reload {
  display: none !important;   
}
/* Stop */
#context-stop {
   display: none !important;
}
/* separator below the Stop item */
#context-sep-stop {
   display: none !important;
}

/* Bookmark This Page... */
#context-bookmarkpage {
   display: none !important;
}
/* Save Page As... */
#context-savepage {
   display: none !important;
}
/* View Background Image */
#context-viewbgimage {
   display: none !important;
}
/* separator above the View Background Image link */
#context-sep-viewbgimage {
   display: none !important;
}
/* ------------------------- End Web Page---------------------------- */

/* -------------------------- Text Box---------------------------- */
/* Undo */
#context-undo {
 display: none !important;   
}
/* separator below the Undo item */
#context-sep-undo {
 display: none !important;   
}

/* Cut */
#context-cut {
 display: none !important;   
}
/* Copy */
#context-copy {
 display: none !important;   
}
/* Paste */
#context-paste {
 display: none !important;   
}
/* Delete */
#context-delete {
 display: none !important;   
}
/* separator below the Delete item, even if the name contains "paste" */
#context-sep-paste {
 display: none !important;   
}

/* Select All */
#context-selectall {
 display: none !important;   
}
/* separator below the Select All item */
#context-sep-selectall {
  display: none !important;   
}
/* ------------------------- End Text Box---------------------------- */


/* Web Search for "foo", if "foo" is selected */
#context-searchselect {
 display: none !important;   
}
/* separator above the This Frame sub-menu */
frame-sep {

}
/* Unfortunately, the Frame sub-menu items don't have ids, so you can't select them individually.
You should be able to select the whole sub-menu with menu[id="frame"] or #frame. */

/* separator above the items related to the page properties: source, infos, & properties */
#context-sep-properties {
   
}
/* View Selection Source */
#context-viewpartialsource-selection {
}
/* View MathML Source */
#context-viewpartialsource-mathml {
 display: none !important;   
}
/* View Page Source */
#context-viewsource {
 display: none !important;   
}
/* View Page Info */
#context-viewinfo {
 display: none !important;   
}
/* Properties */
#context-metadata {
 display: none !important;   
}

/* ----------------------------- End Context Menu ------------------------------ */
User avatar
jrduncans
Posts: 316
Joined: September 16th, 2003, 7:22 pm
Location: Norfolk, VA, USA
Contact:

Post by jrduncans »

Thanks My Yute.

So it's #context-sep-<menu item above seperator name>
User avatar
mai9
Posts: 1619
Joined: January 15th, 2003, 3:41 pm
Location: Barcelona
Contact:

Post by mai9 »

Does anybody know how to tweak the context menu seen on the urlbar?
User avatar
mai9
Posts: 1619
Joined: January 15th, 2003, 3:41 pm
Location: Barcelona
Contact:

Post by mai9 »

My Yute wrote:

Code: Select all

/* separator above the This Frame sub-menu */
frame-sep {

}


I couldn't make this work :(

I also tried this:

#context-sep-frame
AncientPC
Posts: 19
Joined: April 29th, 2004, 12:19 am
Location: Austin, TX

Post by AncientPC »

I have a question that's slightly on (or off) topic. How can I change the hotkey for "Save Link to Disk" to "Save Link to Disk"? I'm more used to using the letter 'a' from IE, not to mention it's on the left side of the keyboard where my left hand's usually at.

Also, is it possible to change the mouse shortcut Alt + Left Click from "Save Page As" to "Save Link to DisK"?
The Q
Posts: 359
Joined: November 14th, 2002, 7:53 am
Location: Sydney, Australia

Post by The Q »

I found this in another thread; it's my current context menu option hider, modified slightly from someone else's. It's easy to adjust by simply marking a /* in front of those you wish to see.

Copy and paste into your userChrome.css file. restart Firefox and you'll be good to go :)

Code: Select all

/* =============== Context Menu Options Removal */

/* To show item place /* in front of it (see below) */

/* =============== Remove Items In Context Menu: WEB PAGE */
#context-back, /* "Back" */
#context-forward, /* "Forward" */
#context-reload, /* "Reload" */
#context-stop, /* "Stop" */
#context-sep-stop, /* Separator Below "Stop" */
#context-bookmarkpage, /* "Bookmark This Page..." */
#context-savepage, /* "Save Page As..." */
#context-sendpage, /* "Send Page..." */
/* =============== Remove Items In Context Menu: LINKS */
#context-openlink, /* "Open Link in New Window" */
/* #context-openlinkintab, /* "Open Link in New Tab" */
#context-sep-open, /* Separator Below "Open Link in New..." */
#context-bookmarklink, /* "Bookmark This Link..." */
#context-savelink, /* "Save Link to Disk..." */
#context-sendlink, /* "Send Link..." */
/* #context-copylink, /* "Copy Link Location" */
/* #context-copyemail, /* "Copy Email Address" */
/* #context-sep-copylink, /* Separator Below Link Items */
/* =============== Remove Items In Context Menu: IMAGES */
#context-viewimage, /* "View Image" */
/* #context-copyimage, /* "Copy Image Location" */
#context-copyimage-contents, /* "Copy Image to Clipboard" */
#context-sep-copyimage, /* Separator Below "Copy Image location" */
/* #context-saveimage, /* "Save Image As..." */
#context-sendimage, /* "Send Image..." */
#context-setWallpaper, /* "Set As Wallpaper" */
#context-blockimage, /* "Block Images from this Server" */
#context-sep-viewbgimage, /* Separator Above "View Background Image" */
#context-viewbgimage, /* "View Background Image" */
/* =============== Remove Items In Context Menu: TEXT */
/* #context-undo, /* "Undo" */
/* #context-sep-undo, /* Separator Below "Undo" */
/* #context-cut, /* "Cut" */
/* #context-copy, /* "Copy" */
/* #context-paste, /* "Paste" */
/* #context-delete, /* "Delete" */
/* #context-sep-paste, /* "Separator Below "Delete" */
#context-selectall, /* "Select All" */
#context-sep-selectall, /* "Separator Below "Select All" */
#context-searchselect, /* "Web Search  for..." */
/* #context-viewpartialsource-selection, /* "View Selection Source" */
/* =============== Remove Items In Context Menu: EXTRA */
#frame-sep, /* Separator Above "This Frame" */
/* #frame, /* "This Frame" */
/* #context-viewpartialsource-mathml, /* "View MathML Source" */
#context-sep-properties, /* Separator Above Properties Items */
/* #context-viewsource, /* "View Page Source" */
#context-viewinfo, /* "View Page Info" */
#context-metadata /* "Properties" */
{ display: none; !important; }

/* =============== Remove Items In Context Menu: BOOKMARKS */
#bookmarks-context-menu menuitem[label="Expand"],
#bookmarks-context-menu menuitem[label="Open"],
#bookmarks-context-menu menuitem[label="Open in Tabs"],
/* #bookmarks-context-menu menuitem[label="Manage Folder"] + menuseparator, */
#bookmarks-context-menu menuitem[label="New Folder..."] + menuseparator,
#bookmarks-context-menu menuitem[label="Open in New Window"],
#bookmarks-context-menu menuitem[label="Open in New Tab"],
#bookmarks-context-menu menuitem[label="Open in New Tab"] + menuseparator,
#bookmarks-context-menu menuitem[label="Cut"],
#bookmarks-context-menu menuitem[label="Copy"],
#bookmarks-context-menu menuitem[label="Paste"],
#bookmarks-context-menu menuitem[label="Paste"] + menuseparator
{ display: none; }

/* =============== End Context Menu Options Removal */
Locked