Permalink
Browse files

Button can now have a tooltip

  • Loading branch information...
1 parent b1ad028 commit ef724d3b9477e9a05a0af6bc4b276b3250923de5 @voxpelli committed Jun 15, 2012
Showing with 8 additions and 0 deletions.
  1. +2 −0 README.md
  2. +3 −0 docs/urlbarbutton.md
  3. +3 −0 lib/urlbarbutton.js
View
@@ -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
@@ -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
@@ -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>
View
@@ -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);
}

0 comments on commit ef724d3

Please sign in to comment.