We're getting close to releasing a new version of Greasemonkey and I'd
like to get your feedback. Here's what new in Greasemonkey 0.8:
* FF3 beta support
* Songbird support (thanks Ian McKellar)
* New cute monkey icons in the status bar and addons panel (thanks to driz).
* Resources (see below for details)
You can download the new release here:
Please try it out and let us know what works and what doesn't. We are
especially interested in what the script authors think of the APIs.
This is one that people have been asking for for a long time now.
Thanks mainly to Gareth Andrew, you can now include images, css,
libraries with Greasemonkey.
You can see a working example here:
(obviously only works with Greasemonkey 0.8).
Resources are implemented using two new metadata tags and two new API
functions. Here are the new metadata tags:
@resource <name> <url>
Include the resource <url> when this script is installed and make it
available to the script using the name <name>. So, for example:
@resource google-logo http://www.google.com/intl/en_ALL/images/logo.gif
A special form of @resource for including JS libraries. The URL is
included, just like with @resource, but it is automatically added to
the beginning of the script. @require'd libraries are included in the
order they are declared. Here is an example:
@resource mochikit ../shared-libs/MochiKit-1.3-packed.js
Both metadata tags can accept relative or absolute URLs. Relative URLs
are resolved relative to the path of the user script requesting them.
Here are the new API functions:
Gets a URL for the resource with name <resourceName>. For example, you
could use this to set the src attribute of an image element to a
resource you included.
Gets the textual content of the resource with name <resourceName>.
Note: some popular JS libraries will not work with @require because
they don't work in Greasemonkey's XPCNativeWrapper environment. You
have two choices:
* Fix the script (and ideally submit a patch to the developer)
* Use @resource and GM_getResourceText, like this:
@resource prototype http://www.prototypejs.org/assets/2007/11/6/prototype.js
Looking forward to hearing your feedback,