MozTW YZU CSE Lecture

72
The Secret in the Extension Development for Mozilla Firefox by Littlebtc (Hsiao-Ting Yu) YZU Open Source Software Community Lecture The text of the slide is under CC-BY-SA-3.0. Most photos are under CC-BY-SA compatible license, while screenshots / logos are under Fair Use. OSSF / MozTW / YZU CSE

description

 

Transcript of MozTW YZU CSE Lecture

Page 1: MozTW YZU CSE Lecture

The Secret in the

Extension Developmentfor Mozilla Firefox

by Littlebtc (Hsiao-Ting Yu)

YZU Open Source Software Community Lecture

The text of the slide is under CC-BY-SA-3.0.Most photos are under CC-BY-SA compatible license,while screenshots / logos are under Fair Use.

OSSF / MozTW / YZU CSE

Page 2: MozTW YZU CSE Lecture

Me

• Undergraduate major in EE in NTU

• A Programmer (PHP)

• A Web Developer

– HTML/CSS

– Mozilla Technique (NicoFox)

Page 3: MozTW YZU CSE Lecture

http://littlebtc.blogspot.com

Page 4: MozTW YZU CSE Lecture

FREE SOFTWARE?OPEN SOURCE?

Page 5: MozTW YZU CSE Lecture

FREE SOFTWARE?→You can use, distribute and modify the software without restriction.

OPEN SOURCE?→The source code of software should be available and modification should not be restricted.

Page 6: MozTW YZU CSE Lecture

OSSF

• A project in the Institute of Information Science of Academia Sinica

• Spread the Free / Open source software spirit

• Support Free/Open Source Software community in Taiwan

Page 7: MozTW YZU CSE Lecture

MozTW http://moztw.org/

• A Community in Taiwan spreading the Firefox and Mozilla-related software

• Translate Firefox/Thunderbird/… to Traditional Chinese

• It is not so technical! It is a community devoting to improve your web experience.

http://www.flickr.com/photos/othree/3147927774/ http://www.flickr.com/photos/bobchao/3049469807/

Page 8: MozTW YZU CSE Lecture

WEB HISTORYIn my personal view:

Page 9: MozTW YZU CSE Lecture

Browser Wars

Page 10: MozTW YZU CSE Lecture

Browser War I

• I started to surf the Internet since 1997, using 36.6K Modem

• At that time, the most popular browser is Netscape, while I am an IE fans :p

• No AJAX, no CSS (<table> layouts)

• No rich media: Speed of Internet is still very slow

Page 11: MozTW YZU CSE Lecture

Yahoo! In 1998

( From archive.org )

Page 12: MozTW YZU CSE Lecture

IE4

(From Wikipedia)

Page 13: MozTW YZU CSE Lecture

Browser War I

• Why Internet Explorer wins: (I think that)

– FREE of charge & bundled with Windows

– Development of IE was active

– Killer Applications: FrontPage

– DHTML, CSS, VBScript support

– Netscape got in troubles: rewrite, lost AOL support, etc.

Page 14: MozTW YZU CSE Lecture

In 2001-2004

IE6 is the de-facto standard!

Page 15: MozTW YZU CSE Lecture

“A-Kuei” (2000-)

Page 16: MozTW YZU CSE Lecture

2001: Wikipedia

Page 17: MozTW YZU CSE Lecture

My Web work in 2002

Page 18: MozTW YZU CSE Lecture

…continued

Page 19: MozTW YZU CSE Lecture

The change of the web

• 2004: Gmail

• AJAX becomes a popular technique

Page 20: MozTW YZU CSE Lecture

And the browser wars II

• 2004: The grow of Firefox

(From Wikipedia)

Page 21: MozTW YZU CSE Lecture

2005: YouTube

Page 22: MozTW YZU CSE Lecture

2005: Writely (Google Docs today)

http://www.flickr.com/photos/googlisti/217887352/

Page 23: MozTW YZU CSE Lecture

2007: Nico Nico Douga

Page 24: MozTW YZU CSE Lecture

The generation of RIA

• 2007:

–HTML5 adopted by W3C

–Microsoft Silverlight

• 2008:

–Adobe AIR & Flex 3

Page 25: MozTW YZU CSE Lecture

2009: MozTW <audio> Demo

http://moztw.org/demo/audioplayer/

Page 26: MozTW YZU CSE Lecture

Mozilla and Mozilla Firefox

To make Internet Better!

Photo: http://www.flickr.com/photos/ews/2603070503/ CC-BY-2.0 by JP Puerta

Page 27: MozTW YZU CSE Lecture

“Mozilla”

• Originally, it is Netscape’s codename

• 1998: Mozilla Organization: “Co-ordinate” the development of Netscape

• Netscape 6 & 7 : Not so success

• 2003: Browser(Firefox)/Mail(Thunderbird) Netscape closed downIndependent Mozilla Foundation

Page 28: MozTW YZU CSE Lecture

The Mozilla Manifesto

“Make the Internet an ever better place for everyone.”

Page 29: MozTW YZU CSE Lecture

Firefox

Page 30: MozTW YZU CSE Lecture

Why Firefox?

• Free and Open Source Software

• A browser that is easy to use

• Highly web standard compatible

• And also easy to extend!

• Every Firefox can be different!

Page 31: MozTW YZU CSE Lecture

Firefox Extensions…

Page 32: MozTW YZU CSE Lecture

addons.mozilla.org

Page 33: MozTW YZU CSE Lecture

NicoFox• ~5000 Users

Page 34: MozTW YZU CSE Lecture

Extensions

• One of the “Add-ons”:

– Extensions, Themes, Plugin

• “Extend” your browser

– Provide more features

– Fix some problem

– Integrate with sites or applications

Page 35: MozTW YZU CSE Lecture

Extensions with Single Feature…

• Locationbar2

• Hide Menubar (Made in Taiwan!)

After Press Alt

Page 36: MozTW YZU CSE Lecture

Extensions with Feature Enhancements

• NoScript

Page 37: MozTW YZU CSE Lecture

Web Application Integration

• TwitterFox

• GmailManager

• Forestfox

• S3Fox(For Amazon S3)

Page 38: MozTW YZU CSE Lecture

Extension with New Feature(s)• AdBlock Plus

Page 39: MozTW YZU CSE Lecture

Extensions with New Feature(s)

• New Tong Wen Tang

– Conversion between Chinese characters

Page 40: MozTW YZU CSE Lecture

Extensions with New Feature(s)

• IE Tab: Use IE engine in a Firefox tab• Made in Taiwan!

Page 41: MozTW YZU CSE Lecture

Extensions with New Feature(s)

• Stylish (Custom CSS for every site & user interface)

• FireGuestures

• And more!

Page 42: MozTW YZU CSE Lecture

Application Level

• Sage

• Scrapbook

• Firebug

Page 43: MozTW YZU CSE Lecture

One trick

• Together with Foxkeh

• Glasser

– Apply Vista / 7 Aero Glass in toolbar

Page 44: MozTW YZU CSE Lecture

GO TO THE TECHNIQUE PART

Hacking the Firefox!

Page 45: MozTW YZU CSE Lecture

This is the Firefox…

Page 46: MozTW YZU CSE Lecture

… and this is part of the the“Main Browser Window”.

Page 47: MozTW YZU CSE Lecture

Wait? Wait!

Is this HTML / JavaScript?

=> No, but something similar to this

Page 48: MozTW YZU CSE Lecture

XUL

• “Write” Interface in an XML text format

– Just Like write web pages in HTML

• Cross-platform interface elements

XML User Interface Language

THERE IS NO DATA.THERE IS ONLY XUL.

<button />

Page 49: MozTW YZU CSE Lecture

JavaScript

• Used in both web and program!

• A major part of the source code in Mozilla Firefox is in JavaScript!

• JavaScript in Firefox core is able to access some core API

Easy but powerful

<script type=“x-application/javascript”>alert(‘Hello World!’);

</script>

<script type=“text/javascript”>alert(‘Hello World!’);</script>

Firefox Core

Web

Page 50: MozTW YZU CSE Lecture

CSS

• In Web: A powerful and modern styling language

• In Firefox Core: Still powerful to design interface in detail

– Styling toolbar, button, and more…

Make Your Style

label{width: 500px;

}

h1 {font-size: 160%;color: #999999;}

Firefox Core

Web

Page 51: MozTW YZU CSE Lecture

Ways to custom your Firefox?

Method Website Application (Firefox, …)

User Style Sheets (CSS) UserContent.css, Stylish UserChrome.css

User Script (JavaScript) Bookmarklet, Greasemonkey UserChrome.js

Extensions Easy but powerful

Themes (Not supported) Very flexible

Page 52: MozTW YZU CSE Lecture

Go for it!How developer actually develop their extension

Page 53: MozTW YZU CSE Lecture

developer.mozilla.org

Page 54: MozTW YZU CSE Lecture

Set up the environment

Page 55: MozTW YZU CSE Lecture

Read lots of code

Page 56: MozTW YZU CSE Lecture

Look for other’s source

Page 57: MozTW YZU CSE Lecture

Try and Error

Page 58: MozTW YZU CSE Lecture

This is what I write…

Page 59: MozTW YZU CSE Lecture

This is what it appears

Page 60: MozTW YZU CSE Lecture

Sometimes it is not your fault…

• It is Firefox’s Bug!

• It is something’s restrictions!

• It needs a complex way to bypass the problem! Orz

Page 61: MozTW YZU CSE Lecture

Sometimes it is not you fault

• The document is incomplete or even completely wrong

• You need to try it!

• Or… Find if some people had tried it!

Page 62: MozTW YZU CSE Lecture

The Hard Work

The player tooks me almost 50 hours!

Page 63: MozTW YZU CSE Lecture

The Hard Work

October 22 October 29

Page 64: MozTW YZU CSE Lecture

November 29

Page 65: MozTW YZU CSE Lecture

Dec 10

Page 66: MozTW YZU CSE Lecture

Feb 14

Page 67: MozTW YZU CSE Lecture

Still Complex

September 2008 (After two months of hard work!)

December 2008

Page 68: MozTW YZU CSE Lecture

Feedback

Page 69: MozTW YZU CSE Lecture

Take the Shortcut

Page 70: MozTW YZU CSE Lecture

About the Courses

• Speaker: Me

• 5/9, 5/23 09:00-17:00

• Near Taipei Main Station

• XUL, JavaScript, and more!

Page 71: MozTW YZU CSE Lecture

We have a “Chapter 0”!

Page 72: MozTW YZU CSE Lecture

THANK YOU!See you!

http://www.flickr.com/photos/bobchao/3325341079/