Skip to content
This repository has been archived by the owner on May 13, 2018. It is now read-only.

Commit

Permalink
Button can now have a tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jun 15, 2012
1 parent b1ad028 commit ef724d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -26,6 +26,7 @@ The UrlbarButton module allows for easy adding of buttons to the urlbar in Firef

* **id** - a string identifier that identifies the specific button.
* **image** - a path to an image for the button. (optional)
* **tooltip** - a tooltip text for the button. (optional)
* **onClick** - a callback to fire on a click on the button. (optional)

### Option syntax: onClick
Expand Down Expand Up @@ -61,6 +62,7 @@ Follow the Add-on SDK's documentation for [third party packages](https://addons.
* Changed `setImage` and `setVisibility` to have the href-parameter as the last parameter instead of the first as that makes more sense for an optional parameter.
* Changed `setVisibility` to have its href parameter be optional for real
* Added new `getVisibility` method
* Button can now have a tooltip

### 0.3.0

Expand Down
3 changes: 3 additions & 0 deletions docs/urlbarbutton.md
Expand Up @@ -29,6 +29,9 @@ Creates a urlbarbutton.
@prop [image] {String}
A url to an image for the urlbar button.

@prop [tooltip] {String}
A tooltip for the urlbar button.

@prop [onClick] {Function}
A callback to fire when the urlbar button is clicked. Is called with the HTML page as its context and with the URL of the page as its first parameter.
</api>
Expand Down
3 changes: 3 additions & 0 deletions lib/urlbarbutton.js
Expand Up @@ -101,6 +101,9 @@ UrlbarButton = function (options) {
button.className = "urlbar-icon";
button.collapsed = true;

if (options.tooltip) {
button.setAttribute("tooltiptext", options.tooltip);
}
if (options.image) {
button.setAttribute("src", options.image);
}
Expand Down

0 comments on commit ef724d3

Please sign in to comment.