86
edits
| Line 106: | Line 106: | ||
<pre class="brush:js;"> | <pre class="brush:js;"> | ||
jetpack. | jetpack.future.import("toolbar"); | ||
// | // Create button options. This can be done in a separate object like this, | ||
// or passed inline to append. | |||
var myButton = { | |||
id: "fooButton", | |||
label: "FOO!", | |||
tooltip: "Click on my to do something.", | |||
image: "http://www.mozilla.org/favicon.ico", | |||
click: function(event) { console.log("FOO! has been clicked") } | |||
} | |||
// Append the button to the toolbar | |||
jetpack.toolbar.navigation.append(myButton); | |||
// Remove the button from the toolbar | |||
jetpack.toolbar.navigation.remove("fooButton"); | |||
// Create button options for the bookmarks toolbar. | |||
var myOtherButton = { | |||
id: "barButton", | |||
label: "BAR!", | |||
tooltip: "Go to http://www.mozilla.org", | |||
image: "http://www.mozilla.org/favicon.ico", | |||
url: "http://www.mozilla.org" | |||
} | |||
// Append the button to the toolbar | |||
jetpack.toolbar.bookmarks.append(myOtherButton); | |||
// Remove the button from the toolbar | |||
jetpack.toolbar.bookmarks.remove("barButton"); | |||
</pre> | </pre> | ||
edits