Greasemonkey
| Original author(s) | Aaron Boodman |
|---|---|
| Developer(s) | Anthony Lieuallen, Johan Sundström[1], 13 more[2] |
| Initial release | March 28, 2005[3] |
| Stable release | 0.8.20100408.6 / April 8, 2010 |
| Preview release | 0.9.0 / September 1, 2010[4] |
| Written in | JavaScript, XUL, CSS |
| Operating system | Cross-platform |
| Available in | English |
| Type | Mozilla extension |
| License | Expat License |
| Website | www.greasespot.net |
(category) |
|---|
| Contents |
| Origins and Lineage |
|
|
Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to HTML web page content on the DOMContentLoaded event, which happens immediately after it is loaded in the browser (also known as augmented browsing).
As Greasemonkey scripts are persistent, the changes made to the web pages are executed every time the page is opened, making them effectively permanent for the user running the script.
Greasemonkey can be used for adding new functions to web pages (for example, embedding price comparisons within shopping sites), fixing rendering bugs, combining data from multiple webpages, and numerous other purposes.
Contents |
[edit] Technical details
Greasemonkey user scripts are written in JavaScript and manipulate the contents of a web page using the Document Object Model interface. Scripts are site-specific and written by hand. userscripts.org maintains a database of Greasemonkey scripts, and for each, lists the URLs of web pages to which the script pertains. When the user visits a matching website, Greasemonkey invokes the relevant scripts, which can modify a webpage in any way JavaScript could. Greasemonkey scripts can also poll external HTTP resources via a non-domain-restricted XMLHTTP request. Scripts are named somename.user.js, and Greasemonkey offers to install any such script when a URL ending in that suffix is requested. Greasemonkey scripts contain optional metadata, which specifies the name of the script, a description, relevant resources to the script, a namespace URL used to differentiate identically named scripts, and URL patterns for which the script is intended to be invoked or not.
Writing a Greasemonkey script is similar to writing JavaScript for a web page, with some additional allowances such as cross-site XMLHttpRequests. Compared to writing a full-fledged Firefox extension, user scripting is a very modest step up in complexity from basic web programming. However, Greasemonkey scripts are limited due to security restrictions imposed by Mozilla's XPCNativeWrappers. For example, Greasemonkey scripts do not have access to many of Firefox's components, such as the download manager, I/O processes or its main toolbars. Additionally, Greasemonkey scripts run per instance of a matching webpage. Because of this, managing lists of items globally is difficult. However, script writers have been using cookies and Greasemonkey even offers APIs such as GM_getValue and GM_setValue to overcome this.
[edit] Typical Greasemonkey scripts
Users have written scripts that:
- Auto fill forms.
- Alter the formatting of text, borders, graphics, etc. (For example, highlight first-run programs in a TV listing.)
- Remove specific content, such as advertising, popups, even whole sections of a page. (For example, filter specific posters from a message board site.)
- Alter content and layout beyond that which the page author considered. (For example, add floating elements, make elements collapsible, etc.)
- Add links, buttons, or any other type of HTML element anywhere on the page. (For example, embed Google Reader into Gmail, thus providing an RSS feed option.)
- Enhance the content of pages by retrieving correlating information from related pages on the same site, or other sites. (For example, list the prices of competing retailers' for the same product.)
- In general, take advantage of extended JavaScript behavior to add previously non-existent functionality to pages. (For example, collate RSS feeds on the current page into a floating panel.)
[edit] Compatibility
Greasemonkey is available for Firefox, Flock and Epiphany. Google Chrome has built-in support for Greasemonkey scripts. The Epiphany Greasemonkey extension is part of the Epiphany-extensions package. However, this extension is not fully compatible as of release 2.15.1, since some Greasemonkey API functions (e.g. GM_getValue) are unsupported. There are also custom versions for SeaMonkey[5] and Songbird.[6]
[edit] Equivalents for other browsers
Versions 8 and upwards of Opera also have user scripting functionality and are capable of running many Greasemonkey user scripts.[7]
For Internet Explorer, similar functionality is offered by IE7Pro,[8] Sleipnir,[9] and iMacros.
As of February 2010[update], Chrome has "native support" for Greasemonkey scripts.[10] They are internally converted to extensions, and are managed as such. Chrome ignores @exclude metadata within the scripts, so the scripts are executed for all domains/pages. On the other hand, Chromium honors the @include directives and executes the scripts only for the domains/pages specified. In Chrome, scripts that use one of the GM_setValue or GM_getValue initiatives will break, and scripts that use the popular E4X standard will not run.[citation needed]
On Safari (and other Webkit applications), there is a SIMBL-managed plug-in called GreaseKit. Since the release of Safari 5 there is an extension called NinjaKit that uses the new API interface.[11]
Fluid, is by nature, a site specific browser which supports userscripts.
Also there is a script which emulates greasemonkeys API in not gecko browsers.Project Page
[edit] See also
- iMacros Web Browser Macro Recorder Addon
- List of augmented browsing software
- List of Firefox extensions
- ShiftSpace, an extensible platform for annotating and modifying web content, built on top of Greasemonkey
[edit] References
- ^ "The weblog about Greasemonkey". http://www.greasespot.net/2009/08/outie.html.
- ^ "The greasemonkey network graph". http://github.com/greasemonkey/greasemonkey/network.
- ^ "Initial Greasemonkey Release". http://wiki.greasespot.net/Version_history#0.2.5.
- ^ http://github.com/greasemonkey/greasemonkey
- ^ "Greasemonkey". mozdev. http://xsidebar.mozdev.org/modifiedmisc.html#greasemonkey. Retrieved 2009-05-05.
- ^ ianloic. "Greasemonkey". Songbird. http://addons.songbirdnest.com/addon/79. Retrieved 2009-05-05.
- ^ "Take Control with User JavaScript". Opera Software. http://opera.com/docs/userjs/examples/#greasemonkey. Retrieved 2009-03-26.
- ^ "Userscripts in IE7Pro". http://ie7pro.com/user-script.html.
- ^ "You can also add custom functionality to Sleipnir with a wide range of plugins and user scripts". http://fenrir-inc.com/global/sleipnir/support/plugin/.
- ^ Boodman, Aaron (2010-02-01). "40,000 More Extensions!". blog.chromium.org. http://blog.chromium.org/2010/02/40000-more-extensions.html. Retrieved 2010-02-01.
- ^ "New extension for Safari 5 called NinjaKit lets you install GM scripts". Excellatronic Communications. http://steeev.freehostia.com/wp/2010/07/19/new-extension-for-safari-5-called-ninjakit-lets-you-install-gm-scripts/. Retrieved 2010-07-22.
[edit] External links
- Greasemonkey @ addons.mozilla.org
- userscripts.org – the official userscript repository
- Greasemonkey Wiki
- Greasemonkey discussion page
- Greasemonkey code hosting – Powered by Github
- Greasemonkey Blog
- sVZ-Styles.de – the official german userscript repository for VZ
- Dive Into Greasemonkey – An online book on Greasemonkey script writing by Mark Pilgrim
- Nivi. "Greasemonkey will blow up business models (as well as your mind)". Archived from the original on 2008-02-05. http://web.archive.org/web/20080205114115/http://www.nivi.com/blog/article/greasemonkey-and-business-models/. Retrieved 2010-07-22.
- Greasemonkey Explained for non-techies
- Greasemonkey in the Enterprise – blog series on security and deployment issues when using Greasemonkey for IT projects
- Festa, Paul (24 March 2005). "Firefox add-on lets surfers tweak sites, but is it safe?". CNET. http://cnet.com.au/firefox-add-on-lets-surfers-tweak-sites-but-is-it-safe-240053700.htm.
- Singel, Ryan (17 May 2005). "Firefox Users Monkey With the Web?". Wired magazine. http://wired.com/science/discoveries/news/2005/05/67527.