Mozilla Firefox Extension Development

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Mozilla Firefox Extension Development - Presentation Transcript

    1. Brunch Combo Firefox Extension Development - Perry Loh - http://twitter.com/skeevs http://skeevs.com
    2. Firefox architecture http://web.uvic.ca/~chunchiu/seng422/Assignment_1_(LHCF).pdf UI Toolkit(XPToolkit) Gecko Data Persistence Expat (XML) Spidermonkey (Javascript) Necko (Networking) XPCOM Extensions + Themes
    3. Technology
    4. Development environment
      • DOM Inspector
      • Venkman (Javascript debugger)
      • Extension Developer’s Extension
      • IDE
        • Notepad
        • SPKet IDE
        • XULbooster plugin
    5. An Extension
    6. Install.RDF <RDF:RDF> <RDF:Description RDF:about = &quot;rdf:#$iZRGb1&quot; em:id = &quot;{ec8030f7-c20a-464f-9b0e-13a3a9e97384}&quot; em:minVersion = &quot;2.0&quot; em:maxVersion = &quot;3.0.*&quot; /> <RDF:Description RDF:about = &quot;urn:mozilla:install-manifest&quot; em:id = &quot;{8B30B659-1414-40a9-B886-A94631284CAB}&quot; em:name = &quot;Fownce&quot; em:description = &quot;Easily post a link from your address bar or post a message to your friends/public on Pownce&quot; em:version = &quot;0.1.6&quot; em:creator = &quot;Perry Loh&quot; em:homepageURL = &quot;http://skeevs.com&quot; em:iconURL = &quot;chrome://fownce/content/fownce.png&quot; </RDF:Description> </RDF:RDF>
    7. Chrome.manifest content fownce content/ locale fownce en-US locale/en-US/ skin fownce classic/1.0 skin/ overlay chrome://browser/content/browser.xul chrome://fownce/content/overlay.xul style chrome://global/content/customizeToolbar.xul chrome://fownce/skin/overlay.css
    8. The Chrome
      • Refers to the entire UI package
        • XUL, javascript, css,…
      • Can be referenced from URI
        • Chrome://browser/content/browser.xul
        • Chrome://myextension/content/overlay.xul
    9. Chrome UI Menubar Statusbar Toolbar Toolbarbutton Toolbox Window Button Menulist
    10. XUL
      • Stands for XML User-interface Language
      • Defined by …. XML
      • Set of UI controls
        • Layout : groupbox,vbox,hbox,grid,…
        • Input: textbox, checkbox,listbox, …
        • Window : window, dialog, …
    11. Javascript
      • Linked from UI (XUL)
          • <script src=&quot;chrome://myextension/content/overlay.js&quot;/>
      • Respond to events raised from UI
        • onload, oncommand, …
      • Manipulate DOM tree
        • window, document, content, …
      • Communicate with XPCOM objects
        • Preferences, LoginManager, …
    12. Localization
      • Individual folders per language under [content][locale]<language>
        • en-US, zh-CN, ja-JP, es-ES, …
      • Language files consist of
        • DTD files
          • <!ENTITY menu.refresh &quot; 刷新 &quot;>
        • Properties file
          • signin= 登录
    13. Icons + Styles
      • Typically in [content][skin] folder
      • Images are used as icons or graphics
      • CSS styles elements in UI. To style a button
      • #fownce-toolbar-button
      • {
      • list-style-image: url(&quot;chrome://fownce/skin/icon24.png&quot;);
      • -moz-image-region: rect(0px 24px 24px 0px)
      • }
    14. Piece it together
      • Extension
      • +----- install.rdf
      • +----- chrome.manifest
      • +----- [content]
      • +----- *.xul
      • +----- *.js
      • +----- [ locale]
      • +----- [en-us]
      • +----- *.dtd
      • +----- *.properties
      • +----- [skin]
      • +----- *.css
      • +----- *.png,*.jpg…
      Metadata UI + Code Localization Icons + Styles
    15. Piece it together
    16. Piece it together var fownce = { get prefs () { return Components.classes[ &quot;@mozilla.org/preferences-service;1&quot; ]. getService (Components.interfaces.nsIPrefService). QueryInterface(Components.interfaces.nsIPrefBranch). getBranch( &quot;extensions.fownce.&quot; ); }, ... ... optionsAccept : function() { var username = document.getElementById( 'p.username' ).value; var password = document.getElementById( 'p.password' ).value; var sendto = document.getElementById( 'p.sendto' ); var addnote = document.getElementById( 'p.addnote' ); this .prefs.setCharPref( 'sendto' ,sendto.value); this .prefs.setBoolPref( 'addnote' ,addnote.checked) this .clearAuth(); this .setAuth(username,password); }, ... ... }
    17. It’s not that hard ;)
    18. KTHXBAI - Perry Loh - http://twitter.com/skeevs http://skeevs.com

    + Perry LohPerry Loh, 2 years ago

    custom

    4024 views, 2 favs, 3 embeds more stats

    An introduction to Firefox extensions development. more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 4024
      • 3950 on SlideShare
      • 74 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 74
    Most viewed embeds
    • 38 views on http://barcamp.my
    • 24 views on http://www.hacioglumurat.com
    • 12 views on http://skeevs.com

    more

    All embeds
    • 38 views on http://barcamp.my
    • 24 views on http://www.hacioglumurat.com
    • 12 views on http://skeevs.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories