Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

章节 1: 介绍附加组件

草案
本页尚未完工.

Note: If you want contribute to this document please following guidelines from the Contribute page.

This document was authored by Hideyuki Emura and was originally published in Japanese for the Firefox Developers Conference Summer 2007. Emura-san is a co-author of Firefox 3 Hacks (O'Reilly Japan, 2008.)

介绍

假如你正在读这指南,你可能以前用过Firefox.也许第一次你看到Firefox, 你可能很惊讶地看到,它有比其他全功能浏览器更简单的结构,例如 Opera或Safari.

What features are considered standard for web browsers these days? Perhaps things like fine-grained tab controls, mouse gestures, extensive toolbars and buttons, a feed reader, integration with a variety of web applications, or sophisticated tools to assist with web design. But we didn't set out to create an all-in-one browser that can satisfy everyone.

Instead, Firefox can support these features through extensions. The core browser is limited to basic features, so it’s something that a beginner can be comfortable with, but users who want something beyond that can install extensions.

关于附加组件

使用附加组件管理器管理

Firefox的附加组件管理器是一个极好的方式来管理附加组件, 在容易使用上是一个重大的进步.

附加组件管理器处理下列任务:

  • 安全地安装和卸载附件组件
  • 确保附加组件与你所使用的Firefox版本兼容
  • 管理一个网站的白名单用于安装信任的附加组件
  • 帮助故障排除,通过禁止它们并提供安全模式
  • 确认并运行更新
  • Provides access to add-ons' settings dialogs
  • Provides access to add-ons' support sites

Development environment amenities

Initially, there wasn't adequate documentation available, and extension developers were largely left to fend for themselves1; however, now there's a considerable store of knowledge.

Because Firefox and its extensions are designed to support multiple languages, excellent extensions come from all over the world, and can be quickly localized by anyone interested.

This lowers the threshold both to using and to developing extensions; that fact, combined with Firefox's rapidly growing popularity, has created a positive feedback loop, with the number of extension users and extension developers growing explosively—there are now more than 7000 extensions and themes published at the Firefox Add-ons site (https://addons.mozilla.org).

What you can do with extensions

Let's look at what features extensions can add, and some actual examples of extensions.

Single feature extensions

FIXME: Update this.

These are relatively simple extensions that add a single feature.

Text Link
Makes it so that double-clicking on an unlinked URL follows that URL.
Undo Closed Tabs Button
Adds a toolbar button to re-open the most recently closed tabs to the History menu.
1211576231.png
Locationbar
Separates a URL’s domain and path in the location bar for easier reading.
locationbar.png

Feature enhancing extensions

FIXME: Update this.

These extensions enhance features that already exist in Firefox.

Tab Mix Plus
Offers detailed tab-related settings.
PrefBar
Gives access to numerous preferences from the toolbar.PrefBar.png
NoScript
Enables and disables JavaScript execution on a site-by-site basis.

Web application integration extensions

FIXME: Update this.

The use the APIs of certain web applications to provide certain pieces of information.

Forecastfox.png

New feature extensions

FIXME: Update this.

Extensions can add completely new features to Firefox. This class of extension requires a greater level of knowledge and programming ability.

GreaseMonkey
UserChrome.js
Both of these provide an environment for running user scripts (JavaScript) in Firefox itself, where the scripts can target specific websites.
Adblock Plus
Blocks the display of unwanted advertisements on web pages.
All-in-One Gestures
Adds mouse-gesture functionality.

Application level extensions

FIXME: Update this.

These are sophisticated extensions that can be considered full-scale applications in their own right, essentially using Firefox as the development platform.

Firebug.gif

One-trick gag extensions

FIXME: Update this.

There are a number of one-trick gag extensions that aren’t very useful.

Shiitake Mushroom (1).png

This is a very brief survey of a few extensions, but there are many other unique extensions available.

表1: Firefox的高级定制方法

定制方法 Does it work for web sites? Does it work for Firefox?
User style sheets (change appearance through CSS)

Yes; you can change the userContent.css file, or use the Stylish extension.

Yes; you can change the userChrome.css file, or use the Stylish extension.

User scripts (change appearance and functionality through JavaScript)

Yes; you can use the GreaseMonkey extension or "bookmarklets."

Yes; you can change userChrome.js to add functionality through JavaScript.

附加组件 (它们可以做任何事)
主题 (它更改浏览器器的外观)

让我们一起编译一个附加组件

Table 1 shows the various customization options available to a user in Firefox. Users have flexible customization options, using CSS in user style sheets and JavaScript/DOM in user scripts (these depend on Stylish, GreaseMonkey, and userChrome.js).

In addition to CSS and JavaScript, extensions can take advantage of XUL and XPCOM technologies for more sophisticated features. Themes, which alter Firefox's appearance, are a kind of add-on.

In order to create an extension, you need an idea and just a little programming ability. The following chapters explain in detail the extension-writing techniques of some of Japan's leading extension authors. We encourage you to try your hand at it as well.

1 One of the authors of this special edition, Piro, is world-famous as one of the original developers.

文档标签和贡献者

 此页面的贡献者: robsean
 最后编辑者: robsean,