Mobile/Fennec/Extensions/UserInterface/Context Menu: Difference between revisions

new "Changes in 2.0" section
m (formatting)
(new "Changes in 2.0" section)
 
Line 99: Line 99:
; ContextHelper.popupState.linkProtocol: The URI scheme of the link address.
; ContextHelper.popupState.linkProtocol: The URI scheme of the link address.
; ContextHelper.popupState.mediaURL: The image or video's source address.
; ContextHelper.popupState.mediaURL: The image or video's source address.
== Changes in Fennec 2.0 ==
Here are some tips for updating Fennec 1.1 add-ons to support Fennec 2.0:
* Add <tt>class="context-command"</tt> to your richlistitem elements.
* To support both 1.1 and 2.0, check for properties in both popupNode and popupState (see above for an example).
* If you use registerType to create a custom type in Fennec 2.0, you can continue to support Fennec 1.1 using a built-in type.  Here's a code snippet from Show Image Title:
<blockquote><pre>
if ("popupNode" in ContextHelper) {
  // Fennec 1.1
  document.getElementById("show-title-command").setAttribute("type", "image");
} else {
  // Fennec 2.0
  messageManager.loadFrameScript("chrome://showtitle/content/content.js", true);
}
</pre></blockquote>


== Sample Code ==
== Sample Code ==


* [http://bitbucket.org/mbrubeck/showtitle/src/tip/content/ Show Image Title source code]
* [http://bitbucket.org/mbrubeck/showtitle/src/tip/content/ Show Image Title source code]
canmove, Confirmed users
1,584

edits