Firefox/Thunderbird Extension Wizard から雛形を手に入れる : (1) :【Firefox 拡張機能 (Extensions) の作成方法】

オンラインで雛形を作成してくれるサービスがあるので、それを使って一つ一つ
情報を明確にしていきます。まず最初に、初期状態での Firefox へのインストール手順です。

この際、About Box 有りと無しと二つの雛形を作成して、
DF(Windows95/98/Me / ユーティリティ) で比べてみました
Firefox/Thunderbird Extension Wizard の利用
Additional Features が雛形を作成する際のオプションで、この違いによって
チェックを付けたほうは、「アドオン画面」の右クリックのポップアップメニューの
About ダイアログを表示するメニューで使われるダイアログが作成されます
( 無い場合は、Firefox のダイアログが使用されるようです )




↓カスタムダイアログ


↓デフォルトのダイアログ

Create custom about box オプションによる雛形の違い
実際は、About Box は使用するつもりはありませんが、処理としてブラウザのメニュー
から呼び出す時にダイアログが必要になります。それに転用する為に追加したオプションです。

追加されたファイルは2つあります

1) content\about.xul
2) locale\en-US\about.dtd

とりあえず、二つ目のファイルはあまり気にしなくて良いです。(about.xul から参照するファイル)
一つ目がダイアログの実体で、拡張機能で画面(ユーザーインターフェイス)として使用される xul
ファイルです

後、このパッケージをインストールする install.rdf というファイルの中に
記述されている部分があります

<em:aboutURL>chrome://tk/content/about.xul</em:aboutURL>

の部分ですが、後で削除します
install.rdf
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
 xmlns:em="http://www.mozilla.org/2004/em-rdf#">
  <Description about="urn:mozilla:install-manifest">
    <em:id>palette@tegaki</em:id>
    <em:name>tegaki</em:name>
    <em:version>1.0</em:version>
    <em:creator>lightbox</em:creator>
    <em:aboutURL>chrome://tk/content/about.xul</em:aboutURL>
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
        <em:minVersion>1.5</em:minVersion>
        <em:maxVersion>3.0.*</em:maxVersion>
      </Description>
    </em:targetApplication>
  </Description>
</RDF>
about.xul
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://tk/locale/about.dtd">
<dialog
	title="&about; tegaki"
	orient="vertical"
	autostretch="always"
	onload="sizeToContent()"
	buttons="accept"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<!-- Original template by Jed Brown -->
<groupbox align="center" orient="horizontal">
<vbox>
  <text value="tegaki" style="font-weight: bold; font-size: x-large;"/>
  <text value="&version; 1.0"/>
  <separator class="thin"/>
  <text value="&createdBy;" style="font-weight: bold;"/>
  <text value="lightbox"/>
  <separator class="thin"/>
</vbox>
</groupbox>
</dialog>


インストール
インストールは、zip ファイルを解凍してできたディレクトリ名を
Extension ID に変えて Mozilla Firefox\extensions ディレクトリにコピーします