一半君的总结纸

听话只听一半君

想做个synology NAS Download Station的 firefox addon

需要会的科技目测主要是js,jquery,knockout,想像下面的chrome extension一样youtube页面上多一个按钮,我可能想要piratebay等网站下面加上下载按钮,或是嵌入douban影评…

想要的效果类似于这个download-station-extension

因为上面这个已经比较完善了… 所以想说能不能抄抄他的,chome的.crx extension文件其实是.zip, 安装的时候被解压到特定的位置,
linux下位于

~/.config/google-chrome/Default/Extensions/

win7下位于

C:\Users\<Your_User_Name>\AppData\Local\Google\Chrome\User Data\Default

目前他的版本号是2.1.3,大概看了下果然看不懂.

firefox add-on sdk 安装步骤

下载sdk ,解压,然后

source bin/activate

然后新建一个addon

mkdir my-addon
cd my-addon
cfx init

因为不想每次cfx run,可以存个autoUpdate.sh

while true ; do
cfx xpi
wget --post-file=my-addon.xpi http://localhost:8888/
sleep 5
done

在firefox新建一个profile 比如叫dev

firefox的命令行参数如下

[fucker@localhost ~]$ firefox -h

(process:16603): GLib-CRITICAL **: 
Usage: /usr/lib64/firefox/firefox [ options ... ] [URL]
       where options include:

X11 options
  --display=DISPLAY  X display to use
  --sync             Make X calls synchronous
  --g-fatal-warnings Make all warnings fatal

Firefox options
  -h or -help        Print this message.
  -v or -version     Print Firefox version.
  -P <profile>       Start with <profile>.
  -migration         Start with migration wizard.
  -ProfileManager    Start with ProfileManager.
  -no-remote         Do not accept or send remote commands; implies -new-instance.
  -new-instance      Open new instance, not a new window in running instance.
  -UILocale <locale> Start with <locale> resources as UI Locale.
  -safe-mode         Disables extensions and themes for this session.
  -jsconsole         Open the Browser Console.
  -jsdebugger        Open the Browser Toolbox.
  -browser           Open a browser window.
  -new-window  <url> Open <url> in a new window.
  -new-tab     <url> Open <url> in a new tab.
  -preferences       Open Preferences dialog.
  -search     <term> Search <term> with your default search engine.
  -recording <file>  Record drawing for a given URL.
  -recording-output <file> Specify destination file for a drawing recording.
  -setDefaultBrowser Set this app as the default browser.

所以可以先新建一个叫dev的profile

firefox -ProfileManager

然后用这个profile单独开一个firefox

# 用dev profile 新开一个firefox 
firefox -P dev -new-instance

然后用这个profile启动,装个Extension Auto-Installer

这样就可以随时改动addon,随时在这个firefox里看到最新的改动效果了,而不用每次cfx run新开一个firefox


參考:
mozilla developers
synology download station api

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: