Chinaunix首页 | 论坛 | 博客
  • 博客访问: 197166
  • 博文数量: 69
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 720
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-03 11:35
文章分类

全部博文(69)

文章存档

2011年(13)

2010年(46)

2009年(10)

我的朋友

分类: 系统运维

2010-08-11 19:41:42

helloworld extension简记

 

@ http://zcatt.cublog.cn

 

Hist:

20100811, draft

 

 

 

这里从MDC摘要了helloworld firefox extension的创建基本内容, 参考备忘. 我的firefox extenion的第一步.

1.建立firefox的开发profile

为了更好的开发extension, 需要改变一些firefox的设置, 出于不影响firefox一般使用的目的, 可以配置一个专用的profile用于extension的开发.

命令:

firefox.exe –no-remote

按照弹出框的导引创建自己的profile. 这里设profile名是dev, 位置是d:\firefox_profile. 注意,cmd执行这个命令前, 要设PATH.

 

以后可以执行下面的命令调用使用这个profilefirefox:

firefox.exe –no-remote –P dev

 

建议配置下面firefox preference几项:

nglayout.debug.disable_xul_cache

true

browser.dom.window.dump.enabled

true

javascript.options.showInConsole

true

javascript.options.strict

true

配置方法, 在地址栏输入about:config, 然后选择对应项并更改即可. 没有的项,可以右击鼠标创建.

 

2.extension目录结构和src

此例在d:\zcatt目录下创建extension的目录, 具体根据自己的实际相应调整.

 

目录结构

d:\zcatt\helloworld

|--install.rdf, chrome.manifest

|- content

|    |--clock.js, clock.xul, overlay.xul

|-locale

    |- en-US

    |    |-- clock.dtd, overlay.dtd

    |- zh-CN

          |--- clock.dtd, overlay.dtd

 

源文件的列表:

 

install.rdf:

 

 

   

     

    helloworld@xuldev.org 

     

    2 

     

    Hello, World! 

     

    0.1 

     

    My first extension. 

     

    Gomita 

     

    http://www.xuldev.org/helloworld/ 

     

   

     

     

        {ec8030f7-c20a-464f-9b0e-13a3a9e97384}

        3.0a1

        4.0b3pre

     

   

   

 

chrome.manifest

content helloworld content/

locale helloworld en-US locale/en-US/

locale helloworld zh-CN locale/zh-CN/

overlay chrome://browser/content/browser.xul chrome://helloworld/content/overlay.xul

 

overlay.xul

 

 

   

     

     oncommand="window.openDialog('chrome://helloworld/content/clock.xul','Clock','chrome,centerscreen,modal');"/> 

   

 

clock.xul

  

     title="&helloworld.clock;" 

     buttons="accept" 

     onload="initClock();">

 

阅读(1393) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~