![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
css code to move paste & go to top of context menu please
Hello,
Would anyone know if it's possible to use .css code to move paste & go to the top of the address bar context menu please?
Thank you.
被采纳的解决方案
Hello,
To move Paste & Go to the top, you must change the order of every item.
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); .urlbar-textbox-container menuitem[cmd="cmd_undo"] { -moz-box-ordinal-group: 3 !important } .urlbar-textbox-container menuseparator:nth-of-type(1) { -moz-box-ordinal-group: 2 !important } .urlbar-textbox-container menuitem[cmd="cmd_cut"] { -moz-box-ordinal-group: 4 !important } .urlbar-textbox-container menuitem[cmd="cmd_copy"] { -moz-box-ordinal-group: 5 !important } .urlbar-textbox-container menuitem[cmd="cmd_paste"] { -moz-box-ordinal-group: 6 !important } .urlbar-textbox-container menuitem[anonid="paste-and-go"] { -moz-box-ordinal-group: 1 !important } .urlbar-textbox-container menuitem[cmd="cmd_delete"] { -moz-box-ordinal-group: 7 !important } .urlbar-textbox-container menuseparator:nth-of-type(2) { -moz-box-ordinal-group: 8 !important } .urlbar-textbox-container menuitem[cmd="cmd_selectAll"] { -moz-box-ordinal-group: 9 !important }定位到答案原位置 👍 0
所有回复 (7)
I'm not sure CSS can do that. But you could try this add-on and see whether that lets you do what you need: Menu Editor :: Add-ons for Firefox.
Hi jscher2000,
Thank you for your help.
I was hoping to avoid using any third-party addons. I've aleady come across userChrome.css code to customise the Context Menu and the Tab Context Menu, but am having trouble tracking down code to change the Address Bar Context Menu.
Thanks again.
选择的解决方案
Hello,
To move Paste & Go to the top, you must change the order of every item.
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); .urlbar-textbox-container menuitem[cmd="cmd_undo"] { -moz-box-ordinal-group: 3 !important } .urlbar-textbox-container menuseparator:nth-of-type(1) { -moz-box-ordinal-group: 2 !important } .urlbar-textbox-container menuitem[cmd="cmd_cut"] { -moz-box-ordinal-group: 4 !important } .urlbar-textbox-container menuitem[cmd="cmd_copy"] { -moz-box-ordinal-group: 5 !important } .urlbar-textbox-container menuitem[cmd="cmd_paste"] { -moz-box-ordinal-group: 6 !important } .urlbar-textbox-container menuitem[anonid="paste-and-go"] { -moz-box-ordinal-group: 1 !important } .urlbar-textbox-container menuitem[cmd="cmd_delete"] { -moz-box-ordinal-group: 7 !important } .urlbar-textbox-container menuseparator:nth-of-type(2) { -moz-box-ordinal-group: 8 !important } .urlbar-textbox-container menuitem[cmd="cmd_selectAll"] { -moz-box-ordinal-group: 9 !important }
Thanks Gingerbread_Man! I've been looking for this very thing myself but thought it should be included by default in Firefox.
I wanted the browser to automatically move Paste and/or Paste & Go to the top of the context menu, depending on what element you click on & only when data was detected in the clipboard. As 9 out of 10 times, if you're right clicking in the url bar (search box, form field, text area, etc) and have something copied, you're gonna want to paste it. Similar to how when you select text, the first choice is Copy followed by Select All.
I'll get around to filing a bug for the feature enhancement and see if I can get it to include pasting in the search engine box (Paste & Search) and text areas/text fields (Paste).
Gingerbread_Man, I'm guessing your code moves Paste & Go to the top of the context menu permanently. Is there a way to move it to the top of the menu only when it's active and not move it to the top when it's greyed out?
But on second thought, it doesn't bother me much if Undo is sitting underneath it sometimes. Guess I'm just curious if it can be done thru userchrome. Thanks.
Noah_SUMO wrote:
Thanks Gingerbread_Man!
You're welcome.
Noah_SUMO wrote:
Is there a way to move it to the top of the menu only when it's active and not move it to the top when it's greyed out?
Here you go. I changed the separator back to its original order, because otherwise when Paste & Go is not available, the first menu item would be that separator.
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); .urlbar-textbox-container menuitem[cmd="cmd_undo"] { -moz-box-ordinal-group: 2 !important } .urlbar-textbox-container menuseparator:nth-of-type(1) { -moz-box-ordinal-group: 3 !important } .urlbar-textbox-container menuitem[cmd="cmd_cut"] { -moz-box-ordinal-group: 4 !important } .urlbar-textbox-container menuitem[cmd="cmd_copy"] { -moz-box-ordinal-group: 5 !important } .urlbar-textbox-container menuitem[cmd="cmd_paste"] { -moz-box-ordinal-group: 6 !important } .urlbar-textbox-container menuitem[anonid="paste-and-go"] { -moz-box-ordinal-group: 1 !important } .urlbar-textbox-container menuitem[cmd="cmd_delete"] { -moz-box-ordinal-group: 7 !important } .urlbar-textbox-container menuseparator:nth-of-type(2) { -moz-box-ordinal-group: 8 !important } .urlbar-textbox-container menuitem[cmd="cmd_selectAll"] { -moz-box-ordinal-group: 9 !important } .urlbar-textbox-container menuitem[cmd="cmd_paste"][disabled="true"] { -moz-box-ordinal-group: 5 !important } .urlbar-textbox-container menuitem[anonid="paste-and-go"][disabled="true"] { -moz-box-ordinal-group: 6 !important }
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */ .urlbar-textbox-container menuitem[anonid="paste-and-go"] { -moz-box-ordinal-group: 0 !important; }
The customization files userChrome.css (interface) and userContent.css (websites) are located in the chrome folder in the user profile folder.
Thank you very much for your help, Gingerbread_Man. I really appreciate it :) .
Thank you very much also to cor-el. You're code works too.
Best regards to you both.