I am making the Copy Feed URL script I requsted above, that adds a menuitem to the feed icon on right-click. The copying works, but I need to only show it when the feed icon is right-clicked. The code is based on code from Zoolcar9's Element Inspector.
function cfu_addMenuItem(aNode, aIndex) { var mi = aNode.appendChild(document.createElement("menuitem")); mi.id = "context-copyfeedurl"; mi.setAttribute("label", "Copy Feed URL"); mi.setAttribute("oncommand", "cfu_copyFeedURL(document.getElementById('feed-button').getAttribute('feed'))"); mi.style.display = "none"; var ms = aNode.insertBefore(document.createElement("menuseparator"), mi); ms.id = mi.id + "-separator";
}
function cfu_copyFeedURL(url) { var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper); gClipboardHelper.copyString(url); }
var cfu_menu = document.getElementById("toolbar-context-menu") cfu_addMenuItem(cfu_menu);
Doh! Thanks for that. There was another bug where the item was hidden if a submenu was opened and hidden, but I fixed that by checking that the event target was the menu. Here's the finished script:
Copy Feed URL Adds a menuitem to the feed icon's right-click menu, letting you copy the feed URL to the clipboard without having to first view/add the feed.
JFYI: without the <code>(function() {</code> ... <code>})()</code>, all functions and variables in the script will become global.
You know everything, don't you?
You removed the popuphidden event listener, but it still only shows when right clicking the feed icon. How does that work? Shouldn't it then show when right clicking anywhere else on the toolbar? Wait I got it, the popupshown event executes the function every time the toolbar context menu shows, so it gets set to hidden if not right clicking the feed button. And I know about the global thing, that's why I added the cfu_ prefix. Script updated.
Greg S wrote:I'm having problems with your minutes less than 10 losing the 0. Can you fix?? If not that's OK. I've trimmed the excess out of what posted above and it works fine but I'd rather use the code you posted if you can fix the minutes.
Just for the record, I'm still using a variation of my original. After making the changes you have suggested, I lose the right side number of the minutes although the left side number now works which was my problem. Anything else to try? Mine is working fine but your code seems minimal in comparison to mine which means I like yours better. Thanks
I'm hoping to get a script to increase the count in MAX_HISTORY_MENU_ITEMS. The default in browser.js in Chrome is 15 but I've upped it to 25. Also, I changed the history.view.rowCount from 10 to 0 so no sites visited show in the History menu. I'm just afraid that will be overwritten when the browser gets updated every time so if it's possible to fix it in the profile userChrome I'd appreciate any assistance.
I notice in FF version 2.0 that in AddOns when right clicking an extension/theme and selecting "Visti Home Page" now opens in a new tab which I like. Is there a script for doing this in FF version 1.5.0.7? Also the "Get More Extensions" & "Get More Themes" text links as well.
And I've found another annoyance fixed in 2.0, I'd like the Customize Toolbar Window to act like the one in 2.0 which is when it's resized it stays at that size the next time it's opened
Thanks
I was using this code to auto-clear the search bar in Firefox 1.5, and updated today to Firefox 2.0 and it no longer works. Any ideas on what to modify to get it working again?
I'm hoping to get a script to increase the count in MAX_HISTORY_MENU_ITEMS. The default in browser.js in Chrome is 15 but I've upped it to 25. Also, I changed the history.view.rowCount from 10 to 0 so no sites visited show in the History menu. I'm just afraid that will be overwritten when the browser gets updated every time so if it's possible to fix it in the profile userChrome I'd appreciate any assistance.
Can anyone help me out with this? Is it even possible to do using this extension?
(you'll have to install the extension first, then figure out where your profile folder is, open the chrome folder therein and add these lines to the userChrome.js file which you can edit with any text editor such as Notepad or vi)
mozillaZine is an independent Mozilla community and advocacy site. We're not affiliated or endorsed by the Mozilla Corporation but we love them just the same.