Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved documentation

  • Loading branch information...
commit ebae9ad8a41e6389da7a7397a40bd9c8d2dcbdfb 1 parent 6568c27
@voxpelli authored
Showing with 49 additions and 8 deletions.
  1. +12 −8 README.md
  2. +37 −0 docs/urlbarbutton.md
View
20 README.md
@@ -1,7 +1,7 @@
UrlbarButton for Mozilla Add-on SDK
=======
-The UrlbarButton module allows for easy adding of buttons to the Urlbar in Firefox.
+The UrlbarButton module allows for easy adding of buttons to the urlbar in Firefox.
## Usage
@@ -9,21 +9,25 @@ The UrlbarButton module allows for easy adding of buttons to the Urlbar in Firef
UrlbarButton({
id : 'foobar-button',
image : data.url("foobar-button.png"),
- onClick : autosubmit,
- showForPage : checkFlattrability
+ onClick : doTheThing,
+ showForPage : checkPage
});
## Options
-* **id** - a string identifier that identifies the specific Urlbar button.
-* **image** - an image for the Urlbar button. (optional)
-* **onClick** - a callback to fire on a click on the Urlbar button. (optional)
+* **id** - a string identifier that identifies the specific urlbar button.
+* **image** - an image for the urlbar button. (optional)
+* **onClick** - a callback to fire on a click on the urlbar button. (optional)
* **showForPage** - a callback that checks if the button should be showed on the current page or not. (optional)
### Option syntax: showForPage
-Should be a function. Is called with two arguments – the URL of the current page and a callback function that is invoked with "true" if the button should be hidden or "false" if it should be shown. The context of the showForPage function is the document of the page that is checked.
+Should be a function. Is called with two arguments - the URL of the current page and a callback function that is invoked with "true" if the button should be hidden or "false" if it should be shown. The context of the showForPage function is the document of the page that is checked.
+
+## How to use
+
+Follow the Add-on SDK's documentation for [third party packages](https://addons.mozilla.org/en-US/developers/docs/sdk/1.4/dev-guide/addon-development/third-party-packages.html).
## In action in
-* **Flattr Firefox Add-on**
+* **Flattr Firefox Add-on**: [Source](https://github.com/flattr/fx-flattr-addon)
View
37 docs/urlbarbutton.md
@@ -0,0 +1,37 @@
+The `urlbarbutton` API allows for easy adding of buttons to the urlbar in Firefox.
+
+## Example ##
+
+ var UrlbarButton = require('urlbarbutton').UrlbarButton;
+ UrlbarButton({
+ id : 'foobar-button',
+ image : data.url("foobar-button.png"),
+ onClick : doTheThing,
+ showForPage : checkPage
+ });
+
+<api name="UrlbarButton">
+@class
+
+Module exports `UrlbarButton` constructor allowing users to create a urlbar button.
+
+<api name="UrlbarButton">
+@constructor
+Creates a urlbarbutton.
+
+@param options {Object}
+ Options for the urlbarbutton, with the following parameters:
+
+@prop id {String}
+ An identifier for the specific urlbar button.
+
+@prop [image] {String}
+ A url to an image for the urlbar button.
+
+@prop [onClick] {Function}
+ A callback to fire on a click on the urlbar button.
+
+@prop [showForPage] {Function}
+ A callback that checks if the button should be showed on the current page or not.
+</api>
+</api>
Please sign in to comment.
Something went wrong with that request. Please try again.