What is a library?
Using a library in a script
Libraries that are provided with Chickenfoot
How to create your own library
Though we have tried to provide a comprehensive set of commands
with Chickenfoot, we know that we may not have everything you need.
However, we also provide an
include() command that lets you include
Chickenfoot code from other files so that you can take advantage of code that others have written.
Such a reusable file is called a library, and we have packaged several libraries
(discussed below) with Chickenfoot. We have also allocated space on the
Scripts Wiki for users to upload their own libraries,
so you should also look there to see if someone has written code that solves the problem
that you're facing.
The files listed below are libraries that are packaged with Chickenfoot.
Once Chickenfoot is installed, you can look at the code for each file
from your browser. For example, to view the code for google-search.js,
enter the following URL into your browser:
To include one of the libraries that is bundled with Chickenfoot, you need only
pass the name of the library file to
include() and then you can
use the commands defined in the library in your script:
getGoogleSpellingSuggestion('aple'); // returns apple
To include a file on your computer, supply the full path of the file to Chickenfoot:
Currently, we only provide a handful of libraries with Chickenfoot, but we are eager
to include more! We imagine that many users would like to have accesss to an
AJAX toolkit from inside Chickenfoot, no? Or how about a standard set of
functions to manipulate Gmail so that you can create your own Gmail hack
without having to start from scratch? If you have library code that you would
like to contribute, please post it on the
section of the Scripts Wiki.
TODO: Explain how to avoid clogging the global namespace and how to make loading a library idempotent.
- closure-lite.js [Learn more]
Closure Lite is a
To see which Closure APIs it includes, see the official
- greasemonkey.js [Learn more]
Greasemonkey is a popular Firefox extension
that is similar to Chickenfoot -- both Greasemonkey and Chickenfoot let you create scripts
that you can run on web pages to automate them or change their behavior.
Greasemonkey has its own API,
so we provide a partial* implementation of the Greasemonkey API
so that you can run a Greasemonkey script in Chickenfoot simply by adding the line
include("greasemonkey.js") to the top of the script.
Although our current implementation of the API is not perfect, many of the Greasemonkey scripts
hosted on userscripts.org do not rely on the API at all,
so they will likely work "as-is" when run in Chickenfoot.
*The implementation of the Greasemonkey API
that is bundled with Chickenfoot is admittedly imperfect -- we would welcome
support from the Greasemonkey community to improve it so we can bundle a
more complete version with Chickenfoot.
- google-ajax-search.js [Learn more]
The Google AJAX Search API is
"an experimental API that lets you integrate a dynamic Google search module into your
web pages so your users can mash up Google search results with other content on your
site or add search results clippings to their own content."
After you register for a license key,
you can use the Chickenfoot wrapper for the API to add search results to any web page.
- json.js [Learn more]
(http://www.json.org/). The library also has a non-strict
such as Functions, RegExps, undefined, Infinity, and NaN.
Another option is to include Closure Lite and then use the
provided by that library. Newer versions of Firefox can use the built-in
JSON object and its methods:
- prototype.js [Learn more]
that aims to ease development of dynamic web applications."
It adds helpful methods to built-in types (String, Array, Number, Element, and Event),
as well as contributing new components, such as Ajax and Enumerable.
The script.aculo.us AJAX library is built on top of
- scriptaculous.js [Learn more]
script.aculo.us is an AJAX library that provides support for adding
visual effects, drag-and-drop, and other controls to your web pages.
We have tweaked the library slightly to provide better integration with Chickenfoot.
- us-geocoder.js [Learn more]
Provides access to US geocoding data from http://geocoder.us/.