jetpackで出来ることが増えてきた
jetpackはJEPから機能を取り込むことで出来る事が増えてきています。
ストレージのサポートやAudio・スライドバー・PageModsなどが追加されました。
現状でFireFoxのUIに変更を加えられる事が出来るのは、スライドバーとステータスバーだけなのですがJEPには後2つ提案されているAPIがあります。
MenuBarとToolBarに対するものです。
ToolBarのAPIは提案されたばかりでStatusはPlanningです。
現在の仕様を見る限り以下の様なAPIとのこと。
jetpack.toolbar.navigation() // returns an abstracted "jetpacky" nav bar object / bookmarks bar object jetpack.toolbar.navigation.children() // gets the child objects in an array-like object jetpack.toolbar.bookmarks.children() // ditto var obj = {title: "my button", onclick: function(){}, ... } jetpack.toolbar.navigation.append(obj, [before_idx]) / .remove(idx) var obj = {title: "GrouchoMarx.com", url:"http://grouchomarx.com/", ... } jetpack.toolbar.bookmarks.append(obj, [before_idx]) / .remove(idx) var toolbar = jetpack.toolbar.create({id:'groucho-toolbar', name: 'GrouchoToolbar', children: [...]}) jetpack.toolbar.append(toolbar)
Labs/Jetpack/JEP/21 - MozillaWikiから引用したコードです。
プロパティとしてToolBarの構成要素を取得し設定する事が出来るようになりそうです。
また、MenuBarへ追加するJEPは
jetpack.menuBar.append //プロパティ label (string) icon (string) onClick (function) shortcutKey (object) key (character) modifiers (array; permissible values are "accel", "shift", "alt", "ctrl") disabled (boolean)
とStatusBarやSlideBarと同じシンプルなAPIとなっています。
Labs/Jetpack/JEP/14 - MozillaWiki
上記のAPIが取り込まれる事でUIに対する変更が今以上可能になります。
またUI以外のJEPとして、JavaScript Injection ToolkitやSystem Informationが追加されました。
JavaScript Injection Toolkitは指定したドキュメントコンテキスト中のjavascriptコードをjetpackから実行する事が出来るようになります。
他にも、指定したドキュメントコンテキスト中のJavascriptコード(ライブラリ)をjetpack中で使えるようにするAPIも提供される模様です。
System Informationはシステムの情報を取得するだけのAPIです。
JEPのTOPにリンクはありませんがPlaces API というものも提案されています。
以下のようなコードを書くことで簡単に、ブックマークや履歴の追加・削除・編集などが出来るようになります。
jetpack.places.find("Groucho Marx") jetpack.places.find({term: "Groucho Marx", where:"history", since: "2009-03-01 12:00:01"}) jetpack.places.find({term: "Groucho Marx", where:"history", before: "2008-12-31 00:00:01"}) jetpack.places.find({term: "Groucho Marx", where:"bookmarks", between: ["2009-03-01 12:00:01", "2009-04-01 12:00:03"]}) jetpack.places.bookmark() // bookmarks the current tab var bookmarks = jetpack.places.find({term: "Groucho Marx", where:"bookmarks", between: ["2009-03-01 12:00:01", "2009-04-01 12:00:03"]}) // bookmarks is an iterator or generator-like object with length properties dump(bookmarks.length) // 3 bookmarks[2].delete() bookmarks[1].title = "Groucho, we hardly knew ye!" bookmarks[1].tag("myhero") // auto saves tags bookmarks[1].tags() // returns ["myhero", "mustachioed-funny-guys",] bookmarks[1].save() // called to make the title change stick var places_items = jetpack.places.find({ tags: ["marx-brothers"] }) // returns an array of placesItem objects
また、Ver0.5-0.7のロードマップがあったのでまとめておきます。
Ver0.5
Feature | Description |
---|---|
.toolbar | Modify the toolbar, add/remove buttons |
Places API JEP | Define way to access to bookmarks, history, and awesomebar data |
Updated twitter library | Make the existing library easy for people well versed in the Twitter API (and better for everyone else!) |
Default styles | Make jetpacks pretty by default- add default fonts for status bar, and make status bar sizing automatic |
secure jetpacks | jetpacks are "locked-down" and given only the privileges they need (which a user or AMO reviewer can validate). |
.music (mac only) | Ability to access music |
.photos (mac only) | Integrate with photos on devices and computers |
.systeminfo | Poll system info, OS, application name, application version, platform version |
audio streaming | Record audio and give access to the resulting stream |
buildbot | build and test on commit |
.passwords JEP | safe access to password manager |
.menu | Ability to change and add menus in Firefox |
Jetpack gallery | A gallery for jetpacks so users and developers can easily explore and install Jetpacks and Libraries |
Bootstrapping | install jetpack if not installed yet for new jetpack features |
Ver0.6
Feature | Description |
---|---|
.passwords | JEP safe access to password manager |
.panel JEP | Like ubiquity- the ability to make an iframe appear magically |
.passwords impl | |
.clipboard image support | OS clipboard access |
secure libs | the ability for libraries to communicate their required privileges |
Ver0.7
Feature | Description | |
---|---|---|
.panel implementation | ||
First run experience | Give jetpacks the ability to know if they're being opened for the first time and act accordingly | |
Settings page per Jetpack | Like prefs on add-ons, give users the ability to set prefs for jetpack |
個人的には「Settings page per Jetpack」を早く導入して欲しいですね。
設定を保存する共通の仕組みが現状ではないのと、ユーザ向けの管理画面がないのが不便かなと思うところです。
about:jetpackのページは開発者向けという感じですので。。。
確実に機能が追加されているJetpackですが、未だに余り人気がないようです。
Userscripts.orgの登録数も余り増えていません。
まだ、何が出来るのかが余り明確になっていない気がするので、それも原因の1つなのでしょうか。
ちょっと困ったを解決するFeatureを作ってみるのもいいものですよ。