MozillaZine

Help with adding menuitem

Talk about add-ons and extension development.
xraphael75
 
Posts: 3
Joined: November 3rd, 2009, 8:52 am
November 3rd, 2009, 9:06 am

Post Posted November 3rd, 2009, 9:06 am

I've been trying to get this to work but the new menuitem just will not show up no matter what I try. At this point I'm just trying to get the menuitem to show in the context (right click) menu. Please help!

install.rdf
<?xml version="1.0"?>
<RDF:RDF xmlns:em="http://www.mozilla.org/2004/em-rdf#"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="rdf:#$vR+Gs"
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
em:minVersion="3.0a1"
em:maxVersion="3.7a1pre" />
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="stg@raphael"
em:name="stg"
em:version="1.0"
em:creator="x"
em:description="stg">
<em:targetApplication RDF:resource="rdf:#$vR+Gs"/>
</RDF:Description>
</RDF:RDF>


ff-overlay.xul
<?xml version="1.0" encoding="UTF-8"?>
<overlay id="stg-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript" src="chrome://stg/chrome/content/ff-overlay.js" />

<popup id="contentAreaContextMenu">
<menuitem id="context-stg" label="Send To Gatherer" oncommand="stg.onMenuItemCommand(event)" />
</popup>
</overlay>


ff-overlay.js
var stg = {
alert('loaded')
onLoad: function() {
},
showContextMenu: function(event) {
document.getElementById("context-stg").hidden = false
},
onMenuItemCommand: function(e) {
alert('yay')
},
};
window.addEventListener("load", function(e){ stg.onLoad(e); }, false);



chrome.manifest
content stg chrome/content/
overlay chrome://browser/content/browser.xul chrome://stg/chrome/content/ff-overlay.xul

folder structure
stg@raphael
--[chrome]
----[content]
----ff-overlay.xul
----ff-overlay.js
install.rdf
chrome.manifest


I can install the extension, but no matter what I try the menuitem will not show up. PLEASE help. Thanks!

Triton

User avatar
 
Posts: 356
Joined: August 25th, 2004, 7:36 pm
November 3rd, 2009, 12:56 pm

Post Posted November 3rd, 2009, 12:56 pm

Try this:

Code: Select all

<popupset id="mainPopupSet
<popup id="contentAreaContextMenu">
<menuitem id="context-stg" label="Send To Gatherer" oncommand="stg.onMenuItemCommand(event)" />
</popup>
</popupset>
</overlay>

Chromifox Extreme Themes Extreme | Carbon | Blade

Add-Ons Chromifox Companion

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 8 guests