網頁

2009年12月1日 星期二

【Firefox Extension】statusbarpanel 實做。

首先,請閱讀以下文件:

如何製作Firefox擴充套件

如何撰寫install.rdf

完畢後就可以開始了。


目錄表:./
1.在extension的根目錄下建立install.rdf
※extension的根目錄是指你用來放這些檔案的資料夾。


<?xml version="1.0"?>

<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>statusTest@example.com</em:id>
        <em:version>1.0</em:version>
        <em:name>LOL That is it</em:name>
        <em:description>The Final Project in University</em:description>
        <em:creator>The Best</em:creator>


      <em:homepageURL>http://blog.xuit.net/andy19890411/Orz</em:homepageURL>


        <em:targetApplication>

            <Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>3.6</em:maxVersion>
            </Description>
        </em:targetApplication>
    </Description>
</RDF>


目錄表:./
2.在extension的根目錄下建立chrome.manifest

content statusTest jar:chrome/statusTest.jar!/content/
 content statusTest chrome/content/

# Firefox
overlay    chrome://browser/content/browser.xul chrome://statusTest/content/statusTest.xul



目錄表:./chrome/content/
3.在chrome資料夾底下建立statusTest.xul

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<overlay id="status-bar-sample-1-overlay"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

 <!-- Firefox -->
<statusbar id="status-bar">
    <statusbarpanel id="statusTest"
    label="Hello World"
    tooltiptext="Sample status bar item"/>
    <button label="{button label}" oncommand="window.alert('Hello World!!')"/>
</statusbar>

</overlay>

4.把chrome資料夾裡面的檔案壓縮成 statusTest.jar。
5.把extension的根目錄下所有檔案縮成 statusTest.xpi。


測試圖:


沒有留言:

張貼留言