Labs/Jetpack/JEP/21: Difference between revisions

From MozillaWiki
< Labs‎ | Jetpack‎ | JEP
Jump to navigation Jump to search
Line 33: Line 33:
var toolbar = jetpack.toolbar.create({id:'groucho-toolbar', name: 'GrouchoToolbar', children: [...]})
var toolbar = jetpack.toolbar.create({id:'groucho-toolbar', name: 'GrouchoToolbar', children: [...]})


jetpack.toolbar.append
jetpack.toolbar.append(toolbar)


...
...
</pre>

Revision as of 23:18, 27 July 2009

JEP 21 - jetpack.toolbar

  • Champion: David Dahl <ddahl at mozilla dot com>
  • Status: Planning
  • Type: API Track
  • Created: 27 July 2009
  • Reference Implementation: jetpack.toolbar
  • JEP Index

Introduction and Rationale

The 'toolbar' namespace will provide Jetpack developers the ability to modify toolbars in chrome space in the browser.

Proposal

Create an easy way to get a handle on the navigation toolbar, the bookmarks toolbar. Provide an elegant API to add, modify and remove items for each bar, as well as hiding and showing the toolbars.

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)

...