SlideShare a Scribd company logo
Workshop: Taipei

Hsiao-Ting Yu “Littlebtc”
MozTW member / Jetpack Ambassador
Mozilla
What is Mozilla?



• Non-profit organization
• Support for better Internet: an open web
 • Open Source Software
 • Open Web Standard
• Major Products: Firefox & Thunderbird
Mozilla Labs?

• “Labs” in Mozilla
• Crazy ideas
• Explore future of the web
Jetpack Ambassadors
MozTW?


  • Mozilla communities in
    Taiwan


  • Group for Mozilla “fans”
  • Localize Mozilla products
  • Promote Mozilla product &
    web standard


  • Our mascot: Foxmosa
Jetpack Introduction
Old-type Mozilla Extension

• XUL: user interface
• JavaScript: code
• CSS: styling
• XBL: binding
• XPCOM: core

• ... So much hard things :(
Your Firefox, customized
Faster, faster and faster
What is Jetpack?


   • Simple-to-use API to develop
     new-type extensions


   • HTML, CSS and JavaScript
   • JavaScript libraries available
   • Fast to develop, test and
     deploy


   • Extensible API                   Photo by www.rocketman.org, CC-BY-2.5
                                      http://en.wikipedia.org/wiki/File:Rose-4.jpg
Jetpack: Now and Future

• Now: Jetpack 0.8 (standalone extension)
 • Experimental Prototype
 • Jetpack as single JavaScript file
• Future: Jetpack SDK (Jetpack Reboot)
 • Distributed as a development kit
 • Jetpack as XPI extension bundle
 • Future version of Firefox will have Jetpack API
    supported included
Jetpack 0.8 Guides
Jetpack extension
https://addons.mozilla.org/zh-TW/firefox/addon/12025
Firebug
https://addons.mozilla.org/zh-TW/firefox/addon/1843
Go about:jetpack
Try it out!
Prepare a testing
extension
Procedure

• Prepare a .js file and a .htm file in the same folder
• in .htm file, add the following data:
  <html>
  <head>
    <title>Jetpack Workshop Example</title>
    <link rel="jetpack" href="example.js">
  </head>
  <body>
  </body>
  </html>


• in the .js file: add oneworld!');
  console.log('Hello
                           line


• Open the .htm file to "Install" the Jetpack
Refresh
Jetpack 0.8 APIs:
UI Related
Everyone needs a “Hello World”

• Log: Use Error Console (preferred) or Firebug Console
• Go “Develop” Tab
• Type
  • console.log("Hello   World!");
Notifications



• Simple Type
  jetpack.notifications.show("Hello World!");


• Complex Type
  jetpack.notifications.show( {
    title: "Hi Jetpack!",
    body: "        ",
   icon: "https://jetpack.mozillalabs.com/images/jetpack.png"

  } );
Menu (I)

• Import from future:
  jetpack.future.import("menu");


• Create new menu to a dummy menu object
  (does nothing)
  jetpack.menu.add("Aloha!");


• Create new menu to tools
  jetpack.menu.tools.add("Aloha!");
Menu (II)
•   What menu?

    •   jetpack.menu.file

    •   jetpack.menu.edit

    •   jetpack.menu.view

    •   jetpack.menu.history

    •   jetpack.menu.bookmarks

    •   jetpack.menu.tools

•   Context Menu: Somehow complex

    •   jetpack.menu.context.browser for browser UI

    •   jetpack.menu.context.page for page
Menu (III)
•   Object-type to allow more options

•   How about command? => command

•   Submenu? => menu

•   Details: https://developer.mozilla.org/en/Jetpack/UI/Menu


 jetpack.future.import("menu");
 jetpack.menu.context.page.add({
   label: "Ice Cream",
   icon: "https://jetpack.mozillalabs.com/images/
 jetpack.png",
   menu: new jetpack.Menu(["Vanilla", "Chocolate",
 "Pistachio", null, "None"]),
   command: function (menuitem)
 jetpack.notifications.show(menuitem.label)
 });
Slidebar (I)

• It is not the sidebar! :D
• Import from future:
  jetpack.future.import("slideBar");


• Append the slidebar with HTML content:
  jetpack.slideBar.append(
  {
    icon: "https://jetpack.mozillalabs.com/images/jetpack.png",
    html: "<html><body>Hello!</body></html>"
  }



• Or a given URL:
  jetpack.slideBar.append(
  {
    icon: "https://jetpack.mozillalabs.com/images/jetpack.png",
    url: "http://moztw.org"

  }
Slidebar (II)


• Events:
 • onReady: when feature("slidebar page") is loaded
 • onClick: when its icon is clicked
 • onSelect: when featured is selected
• Options:
 • autoReload: reload every time selected
Slidebar (III): Tips


• onReady, onSelect:
 • Will have a slider object as a parameter
 • You can use slider.contentDocument to access
    the document

  • Jetpack 0.8 is jQuery enabled, so:
    function ready(slider) {
      var _doc = slider.contentDocument;
      $("body", _doc).html("..."); // Have fun!
    }
    jetpack.slider.append( {... , 'onReady': ready})
Slidebar (IV): Tips again

• You can use E4X hack to write HTML code:
  var html = <>
  <html>
  <head>
    <style type="text/css">
    <![CDATA[
    ...
    ]]>
    </style>
    <base target="_blank" /> <!-- Dirty Hack, very dirty -->
  </head>
  <body>
  ...
  </body></html></>.toXMLString();
  jetpack.slideBar.append({html: html});


• Another dirty hack: set target to _blank to make
  links to open in the new tab, instead of in the
  slidebar content
Toolbar
•   https://wiki.mozilla.org/Labs/Jetpack/JEP/21#Initial_Implementation_API

•   Import from future
    jetpack.future.import("toolbar");


•   Which Toolbar?

    •   jetpack.toolbar.navigation

    •   jetpack.toolbar.bookmarks

•   Toolbar options
    var myButton = {
      id: "goMozTW",
      label: "Go MozTW",
      tooltip: "Access MozTW Website",
      image: "http://www.mozilla.org/favicon.ico",
      onclick: function(event) { jetpack.tabs.open('http://moztw.org/'); }
    }


•   Append And Remove
    jetpack.toolbar.navigation.append(myButton);
    jetpack.toolbar.navigation.remove("goMozTW");
Statusbar
•   Somehow like slidebar, HTML-based

•   Parameters: width, html

•   onReady when HTML item is loaded

    •   widget, its HTML document as a parameter

•   Example
    jetpack.statusBar.append({
      html: "<strong>Hi!</strong>",
      width: 100,
      onReady: function(widget) {
        $("strong", widget).text("Jetpack rocks?");
        $(widget).click(function()
        { jetpack.notifications.show("Yes!"); }
        );
      }
    });
A complex slidebar
example
The Target
In RSS
Code and result

• http://gist.github.com/323081
Hacks in the code



• $("<a />") to create element: not working
 • Use _doc.createElement("a") instead
• Some Regex to fetch the real title
• jQuery.ajax to fetch the content:
  http://api.jquery.com/jQuery.ajax/
Another example:
JetPlurk by irvinfly
Jetpack 0.8 APIs:
Not (so much) UI
related
Selection
•   https://developer.mozilla.org/en/Jetpack/UI/Selection

•   Import from future
    jetpack.future.import("selection");


•   Get Selection

    •   jetpack.selection.text as plain text

    •   jetpack.selection.html as HTML


•   Event: onSelection

•   Example
    jetpack.future.import("selection");
    jetpack.selection.onSelection(function(){
        jetpack.notifications.show(jetpack.selection.text);
        jetpack.selection.html = "<b>" + jetpack.selection.html +
    "</b>";
    });
Tabs (I)


• jetpack.tabs
• open(): open new tab
  jetpack.tabs.open("http://www.example.com");


• Array-like operations:
 • jetpack.tabs[0]: first tab
 • length: number of tabs
Tabs (II)

• Events:
 • onReady: (inherited document is fully loaded)
 • onFocus: focus changed
• Example
  jetpack.tabs.onReady(
    function(doc) {
      console.log('ok');
    }
  );
Simple Storage
• Simple Storage: implemented as JSON files
• Future namespace should be used:
  jetpack.future.import("storage.simple");  
  var myStorage = jetpack.storage.simple; 


• You can put some simple items: string, number, array,
  into myStorage:
  myStorage.group = 'moztw';
  myStorage.members = ['littlebtc', 'bobchao', 'irvinfly'];


• So
  console.log(myStorage.members[0])

  is littlebtc!

• sync() to force writing, open() to force reading
  (beware!)
Settings (I)

• Import from future is needed
• Need some manifest:
 • https://developer.mozilla.org/en/Jetpack/Storage/
    Settings

• Resulting interface in about:jetpack:
Settings (II)



• Setting types: text, password, boolean, range
• Available options: default, min (for range), max (for
  range)

• Read/Write the setting is simple:
  jetpack.storage.settings.facebook.username =
  'jen';
  music.volume = jetpack.storage.settings.volume;
Me, the extension



• Use "me":
  jetpack.future.import("me");  


• For first run purpose:
  jetpack.me.onFirstRun(function () {  
    jetpack.tabs.open("http://moztw.org/");
    jetpack.notifications.show('Welcome!');   
  });  
After finished...
Go Jetpack Gallery!
http://jetpackgallery.mozillalabs.com/
Jetpack SDK:
Jetpack rebooted
New "Jetpack" Architecture


   Before                         After
    jetpack   jetpack   jetpack      jetpack             jetpack


                                    Jetpack          Jetpack
         Jetpack API                 Core             Core




              Firefox                          Firefox
New "Jetpack SDK"


• Python SDK, with features enabled:
 • Testing
 • XPI Packaging
• "Package-based"
• CommonJS based scripting
• https://jetpack.mozillalabs.com/sdk/0.1/docs/
Jetpack-based extensions

• Jetpack as an API
• Jetpack-based extension will:
 • Require no restart to take effect
 • Have automatic update
 • And better security model
• No difference for users compared with traditional
  extensions

• Hosted on AMO too
Extension manager redesign
Future: it's your turn!

More Related Content

What's hot

Lessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGL
Lior Tal
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
Slobodan Lohja
 
Dojo & HTML5
Dojo & HTML5Dojo & HTML5
Dojo & HTML5
Mike Wilcox
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
JAX London
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
DevGAMM Conference
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
Oliver Busse
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit
Predhin Sapru
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages Application
Michael McGarel
 
Drupal 8 - Build Week Update
Drupal 8 - Build Week UpdateDrupal 8 - Build Week Update
Drupal 8 - Build Week Update
Angela Byron
 
Introducing CrossWorlds for IBM Domino
Introducing CrossWorlds for IBM DominoIntroducing CrossWorlds for IBM Domino
Introducing CrossWorlds for IBM Domino
Daniele Vistalli
 
Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019
Laurent Guérin
 
Drupal 8 Vocab Lesson
Drupal 8 Vocab LessonDrupal 8 Vocab Lesson
Drupal 8 Vocab Lesson
Mediacurrent
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPages
Jesse Gallagher
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
Teng Shiu Huang
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022NAVER D2
 
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven DevelopmentDrupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Mediacurrent
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on WindowsWO Community
 
Beyond Domino Designer
Beyond Domino DesignerBeyond Domino Designer
Beyond Domino Designer
Paul Withers
 
Managing windows with Puppet and Chocolatey
Managing windows with Puppet and ChocolateyManaging windows with Puppet and Chocolatey
Managing windows with Puppet and Chocolatey
SethMcBean
 

What's hot (20)

Lessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGL
 
Automated ui-testing
Automated ui-testingAutomated ui-testing
Automated ui-testing
 
Dojo & HTML5
Dojo & HTML5Dojo & HTML5
Dojo & HTML5
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
Dojo javascript toolkit
Dojo javascript toolkit Dojo javascript toolkit
Dojo javascript toolkit
 
How To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages ApplicationHow To Build a Multi-Field Search Page For Your XPages Application
How To Build a Multi-Field Search Page For Your XPages Application
 
Drupal 8 - Build Week Update
Drupal 8 - Build Week UpdateDrupal 8 - Build Week Update
Drupal 8 - Build Week Update
 
Introducing CrossWorlds for IBM Domino
Introducing CrossWorlds for IBM DominoIntroducing CrossWorlds for IBM Domino
Introducing CrossWorlds for IBM Domino
 
Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019Telosys project booster Paris Open Source Summit 2019
Telosys project booster Paris Open Source Summit 2019
 
Drupal 8 Vocab Lesson
Drupal 8 Vocab LessonDrupal 8 Vocab Lesson
Drupal 8 Vocab Lesson
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPages
 
Play! Framework for JavaEE Developers
Play! Framework for JavaEE DevelopersPlay! Framework for JavaEE Developers
Play! Framework for JavaEE Developers
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022
 
Drupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven DevelopmentDrupal Presentation for CapitalCamp 2011: Features Driven Development
Drupal Presentation for CapitalCamp 2011: Features Driven Development
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
 
Beyond Domino Designer
Beyond Domino DesignerBeyond Domino Designer
Beyond Domino Designer
 
Django
DjangoDjango
Django
 
Managing windows with Puppet and Chocolatey
Managing windows with Puppet and ChocolateyManaging windows with Puppet and Chocolatey
Managing windows with Puppet and Chocolatey
 

Viewers also liked

31 interesting ways to use audio in your class
31 interesting ways to use audio in your class31 interesting ways to use audio in your class
31 interesting ways to use audio in your class
mrholdsworth
 
090807social
090807social090807social
090807sociallittlebtc
 
Something about Wikipedia
Something about WikipediaSomething about Wikipedia
Something about Wikipedialittlebtc
 
Presentation
PresentationPresentation
Presentation
stephanieduphily
 
Investcap Advisors Llc Overview
Investcap Advisors Llc OverviewInvestcap Advisors Llc Overview
Investcap Advisors Llc Overview
sbarrie
 
Jetpack: el plugin para hacerte la vida más fácil
Jetpack: el plugin para hacerte la vida más fácilJetpack: el plugin para hacerte la vida más fácil
Jetpack: el plugin para hacerte la vida más fácil
Luis Rull
 
Stp Us Basic Finalbni Presentation
Stp Us Basic Finalbni PresentationStp Us Basic Finalbni Presentation
Stp Us Basic Finalbni Presentation
bevlena
 

Viewers also liked (7)

31 interesting ways to use audio in your class
31 interesting ways to use audio in your class31 interesting ways to use audio in your class
31 interesting ways to use audio in your class
 
090807social
090807social090807social
090807social
 
Something about Wikipedia
Something about WikipediaSomething about Wikipedia
Something about Wikipedia
 
Presentation
PresentationPresentation
Presentation
 
Investcap Advisors Llc Overview
Investcap Advisors Llc OverviewInvestcap Advisors Llc Overview
Investcap Advisors Llc Overview
 
Jetpack: el plugin para hacerte la vida más fácil
Jetpack: el plugin para hacerte la vida más fácilJetpack: el plugin para hacerte la vida más fácil
Jetpack: el plugin para hacerte la vida más fácil
 
Stp Us Basic Finalbni Presentation
Stp Us Basic Finalbni PresentationStp Us Basic Finalbni Presentation
Stp Us Basic Finalbni Presentation
 

Similar to MozTW Jetpack Workshop: Taipei

Porting Flashblock to Jetpack Platform (draft)
Porting Flashblock to Jetpack Platform (draft)Porting Flashblock to Jetpack Platform (draft)
Porting Flashblock to Jetpack Platform (draft)
Thomas Bassetto
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OSbenko
 
How dojo works
How dojo worksHow dojo works
How dojo works
Amit Tyagi
 
Dojo: Beautiful Web Apps, Fast
Dojo: Beautiful Web Apps, FastDojo: Beautiful Web Apps, Fast
Dojo: Beautiful Web Apps, Fast
Gabriel Hamilton
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
Fabian Jakobs
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
François Massart
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
Simon Willison
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
Derek Jacoby
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
Satyam Pandey
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
Timothy Fisher
 
Real World Seaside Applications
Real World Seaside ApplicationsReal World Seaside Applications
Real World Seaside Applications
ESUG
 
e10sとアプリ間通信
e10sとアプリ間通信e10sとアプリ間通信
e10sとアプリ間通信
Makoto Kato
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
jeresig
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
Fabio Fumarola
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
Elizabeth Smith
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
stuplum
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Anupam Ranku
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
Erhwen Kuo
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
Ulrich Krause
 

Similar to MozTW Jetpack Workshop: Taipei (20)

Porting Flashblock to Jetpack Platform (draft)
Porting Flashblock to Jetpack Platform (draft)Porting Flashblock to Jetpack Platform (draft)
Porting Flashblock to Jetpack Platform (draft)
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
Dojo: Beautiful Web Apps, Fast
Dojo: Beautiful Web Apps, FastDojo: Beautiful Web Apps, Fast
Dojo: Beautiful Web Apps, Fast
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
Real World Seaside Applications
Real World Seaside ApplicationsReal World Seaside Applications
Real World Seaside Applications
 
e10sとアプリ間通信
e10sとアプリ間通信e10sとアプリ間通信
e10sとアプリ間通信
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
 
XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 

More from littlebtc

FURP12-Snappy
FURP12-SnappyFURP12-Snappy
FURP12-Snappylittlebtc
 
寫給大家的 Git 教學
寫給大家的 Git 教學寫給大家的 Git 教學
寫給大家的 Git 教學
littlebtc
 
Jetpack and Jetpack Reboot
Jetpack and Jetpack RebootJetpack and Jetpack Reboot
Jetpack and Jetpack Rebootlittlebtc
 
COSCUP Jetpack Lighting Talk
COSCUP Jetpack Lighting TalkCOSCUP Jetpack Lighting Talk
COSCUP Jetpack Lighting Talklittlebtc
 
MoZH propose
MoZH proposeMoZH propose
MoZH propose
littlebtc
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basic
littlebtc
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecturelittlebtc
 

More from littlebtc (8)

FURP12-Snappy
FURP12-SnappyFURP12-Snappy
FURP12-Snappy
 
寫給大家的 Git 教學
寫給大家的 Git 教學寫給大家的 Git 教學
寫給大家的 Git 教學
 
Jetpack and Jetpack Reboot
Jetpack and Jetpack RebootJetpack and Jetpack Reboot
Jetpack and Jetpack Reboot
 
COSCUP Jetpack Lighting Talk
COSCUP Jetpack Lighting TalkCOSCUP Jetpack Lighting Talk
COSCUP Jetpack Lighting Talk
 
MoZH propose
MoZH proposeMoZH propose
MoZH propose
 
Ext 0523
Ext 0523Ext 0523
Ext 0523
 
Mozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basic
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecture
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 

MozTW Jetpack Workshop: Taipei

  • 1. Workshop: Taipei Hsiao-Ting Yu “Littlebtc” MozTW member / Jetpack Ambassador
  • 3. What is Mozilla? • Non-profit organization • Support for better Internet: an open web • Open Source Software • Open Web Standard • Major Products: Firefox & Thunderbird
  • 4. Mozilla Labs? • “Labs” in Mozilla • Crazy ideas • Explore future of the web
  • 6.
  • 7. MozTW? • Mozilla communities in Taiwan • Group for Mozilla “fans” • Localize Mozilla products • Promote Mozilla product & web standard • Our mascot: Foxmosa
  • 9. Old-type Mozilla Extension • XUL: user interface • JavaScript: code • CSS: styling • XBL: binding • XPCOM: core • ... So much hard things :(
  • 12. What is Jetpack? • Simple-to-use API to develop new-type extensions • HTML, CSS and JavaScript • JavaScript libraries available • Fast to develop, test and deploy • Extensible API Photo by www.rocketman.org, CC-BY-2.5 http://en.wikipedia.org/wiki/File:Rose-4.jpg
  • 13. Jetpack: Now and Future • Now: Jetpack 0.8 (standalone extension) • Experimental Prototype • Jetpack as single JavaScript file • Future: Jetpack SDK (Jetpack Reboot) • Distributed as a development kit • Jetpack as XPI extension bundle • Future version of Firefox will have Jetpack API supported included
  • 20. Procedure • Prepare a .js file and a .htm file in the same folder • in .htm file, add the following data: <html> <head> <title>Jetpack Workshop Example</title> <link rel="jetpack" href="example.js"> </head> <body> </body> </html> • in the .js file: add oneworld!'); console.log('Hello line • Open the .htm file to "Install" the Jetpack
  • 23. Everyone needs a “Hello World” • Log: Use Error Console (preferred) or Firebug Console • Go “Develop” Tab • Type • console.log("Hello World!");
  • 24. Notifications • Simple Type jetpack.notifications.show("Hello World!"); • Complex Type jetpack.notifications.show( { title: "Hi Jetpack!", body: " ", icon: "https://jetpack.mozillalabs.com/images/jetpack.png" } );
  • 25. Menu (I) • Import from future: jetpack.future.import("menu"); • Create new menu to a dummy menu object (does nothing) jetpack.menu.add("Aloha!"); • Create new menu to tools jetpack.menu.tools.add("Aloha!");
  • 26. Menu (II) • What menu? • jetpack.menu.file • jetpack.menu.edit • jetpack.menu.view • jetpack.menu.history • jetpack.menu.bookmarks • jetpack.menu.tools • Context Menu: Somehow complex • jetpack.menu.context.browser for browser UI • jetpack.menu.context.page for page
  • 27. Menu (III) • Object-type to allow more options • How about command? => command • Submenu? => menu • Details: https://developer.mozilla.org/en/Jetpack/UI/Menu jetpack.future.import("menu"); jetpack.menu.context.page.add({ label: "Ice Cream", icon: "https://jetpack.mozillalabs.com/images/ jetpack.png", menu: new jetpack.Menu(["Vanilla", "Chocolate", "Pistachio", null, "None"]), command: function (menuitem) jetpack.notifications.show(menuitem.label) });
  • 28. Slidebar (I) • It is not the sidebar! :D • Import from future: jetpack.future.import("slideBar"); • Append the slidebar with HTML content: jetpack.slideBar.append( { icon: "https://jetpack.mozillalabs.com/images/jetpack.png", html: "<html><body>Hello!</body></html>" } • Or a given URL: jetpack.slideBar.append( { icon: "https://jetpack.mozillalabs.com/images/jetpack.png", url: "http://moztw.org" }
  • 29. Slidebar (II) • Events: • onReady: when feature("slidebar page") is loaded • onClick: when its icon is clicked • onSelect: when featured is selected • Options: • autoReload: reload every time selected
  • 30. Slidebar (III): Tips • onReady, onSelect: • Will have a slider object as a parameter • You can use slider.contentDocument to access the document • Jetpack 0.8 is jQuery enabled, so: function ready(slider) { var _doc = slider.contentDocument; $("body", _doc).html("..."); // Have fun! } jetpack.slider.append( {... , 'onReady': ready})
  • 31. Slidebar (IV): Tips again • You can use E4X hack to write HTML code: var html = <> <html> <head> <style type="text/css"> <![CDATA[ ... ]]> </style> <base target="_blank" /> <!-- Dirty Hack, very dirty --> </head> <body> ... </body></html></>.toXMLString(); jetpack.slideBar.append({html: html}); • Another dirty hack: set target to _blank to make links to open in the new tab, instead of in the slidebar content
  • 32. Toolbar • https://wiki.mozilla.org/Labs/Jetpack/JEP/21#Initial_Implementation_API • Import from future jetpack.future.import("toolbar"); • Which Toolbar? • jetpack.toolbar.navigation • jetpack.toolbar.bookmarks • Toolbar options var myButton = { id: "goMozTW", label: "Go MozTW", tooltip: "Access MozTW Website", image: "http://www.mozilla.org/favicon.ico", onclick: function(event) { jetpack.tabs.open('http://moztw.org/'); } } • Append And Remove jetpack.toolbar.navigation.append(myButton); jetpack.toolbar.navigation.remove("goMozTW");
  • 33. Statusbar • Somehow like slidebar, HTML-based • Parameters: width, html • onReady when HTML item is loaded • widget, its HTML document as a parameter • Example jetpack.statusBar.append({ html: "<strong>Hi!</strong>", width: 100, onReady: function(widget) { $("strong", widget).text("Jetpack rocks?"); $(widget).click(function() { jetpack.notifications.show("Yes!"); } ); } });
  • 37. Code and result • http://gist.github.com/323081
  • 38. Hacks in the code • $("<a />") to create element: not working • Use _doc.createElement("a") instead • Some Regex to fetch the real title • jQuery.ajax to fetch the content: http://api.jquery.com/jQuery.ajax/
  • 40. Jetpack 0.8 APIs: Not (so much) UI related
  • 41. Selection • https://developer.mozilla.org/en/Jetpack/UI/Selection • Import from future jetpack.future.import("selection"); • Get Selection • jetpack.selection.text as plain text • jetpack.selection.html as HTML • Event: onSelection • Example jetpack.future.import("selection"); jetpack.selection.onSelection(function(){ jetpack.notifications.show(jetpack.selection.text); jetpack.selection.html = "<b>" + jetpack.selection.html + "</b>"; });
  • 42. Tabs (I) • jetpack.tabs • open(): open new tab jetpack.tabs.open("http://www.example.com"); • Array-like operations: • jetpack.tabs[0]: first tab • length: number of tabs
  • 43. Tabs (II) • Events: • onReady: (inherited document is fully loaded) • onFocus: focus changed • Example jetpack.tabs.onReady( function(doc) { console.log('ok'); } );
  • 44. Simple Storage • Simple Storage: implemented as JSON files • Future namespace should be used: jetpack.future.import("storage.simple");   var myStorage = jetpack.storage.simple;  • You can put some simple items: string, number, array, into myStorage: myStorage.group = 'moztw'; myStorage.members = ['littlebtc', 'bobchao', 'irvinfly']; • So console.log(myStorage.members[0]) is littlebtc! • sync() to force writing, open() to force reading (beware!)
  • 45. Settings (I) • Import from future is needed • Need some manifest: • https://developer.mozilla.org/en/Jetpack/Storage/ Settings • Resulting interface in about:jetpack:
  • 46. Settings (II) • Setting types: text, password, boolean, range • Available options: default, min (for range), max (for range) • Read/Write the setting is simple: jetpack.storage.settings.facebook.username = 'jen'; music.volume = jetpack.storage.settings.volume;
  • 47. Me, the extension • Use "me": jetpack.future.import("me");   • For first run purpose: jetpack.me.onFirstRun(function () {   jetpack.tabs.open("http://moztw.org/"); jetpack.notifications.show('Welcome!');    });  
  • 51. New "Jetpack" Architecture Before After jetpack jetpack jetpack jetpack jetpack Jetpack Jetpack Jetpack API Core Core Firefox Firefox
  • 52. New "Jetpack SDK" • Python SDK, with features enabled: • Testing • XPI Packaging • "Package-based" • CommonJS based scripting • https://jetpack.mozillalabs.com/sdk/0.1/docs/
  • 53. Jetpack-based extensions • Jetpack as an API • Jetpack-based extension will: • Require no restart to take effect • Have automatic update • And better security model • No difference for users compared with traditional extensions • Hosted on AMO too
  • 54.

Editor's Notes