Greasemonkey

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Greasemonkey
Greasemonkey.png
Original author(s) Aaron Boodman
Developer(s) Anthony Lieuallen, Johan Sundström,[1] 13 more[2]
Initial release March 28, 2005; 6 years ago (2005-03-28)[3]
Stable release 0.9.14 / January 20, 2012; 4 days ago (2012-01-20)
Written in JavaScript, XUL, CSS
Operating system Cross-platform
Available in English
Type Mozilla extension
License Expat License
Website www.greasespot.net
Firefox.svg
(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 layouting or 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] History

The Greasemonkey project began November 28, 2004.[4][5][6]

[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 generally written to be either page-specific or domain-specific (applying to all pages within a domain) but may also be tagged to apply to all domains for global browser enhancements. userscripts.org maintains a database of Greasemonkey scripts, and for each, lists the URLs of web pages to which the script pertains.[7] Users of Greasemonkey can write or download scripts and save them to their own personal library. When users visit a website matching a script in their personal script library, Greasemonkey invokes the relevant scripts, which can modify a webpage in any way which JavaScript allows—with certain Greasemonkey security restrictions. Greasemonkey scripts can also poll external HTTP resources via a non-domain-restricted XMLHTTP request, allowing external content to be merged with the original page content. 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] Compatibility

Greasemonkey is available for Firefox, Flock and Epiphany. 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[8] and Songbird.[9]

[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.[10]

For Internet Explorer, similar functionality is offered by IE7Pro,[11] Sleipnir,[12] iMacros, Trixie.[13]

As of February 2010, Chrome has limited "native support" for Greasemonkey scripts.[14] They are internally converted to extensions, and are managed as such. Chrome honours the @include and @exclude directives, and introduces the @match objective as a simplified way to select specific domains/pages specified. In Chrome, scripts that use Firefox-specific functionality will break, and several Greasemonkey features are unavailable.[15]

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.[16] Fluid is a site-specific browser with integrated GreaseKit.

[edit] See also

[edit] References

  1. ^ "The weblog about Greasemonkey". http://www.greasespot.net/2009/08/outie.html. 
  2. ^ "The greasemonkey network graph". http://github.com/greasemonkey/greasemonkey/network. 
  3. ^ "Initial Greasemonkey Release". http://wiki.greasespot.net/Version_history#0.2.5. 
  4. ^ "Greasemonkey Project Info". https://www.mozdev.org/projects/overview/greasemonkey/. 
  5. ^ Pilgrim, Mark (2005). Greasemonkey Hacks. O'Reilly Media, Inc.. [1]
  6. ^ "Aaron Boodman wrote Greasemonkey in 2004". http://blog.chromium.org/2010/02/40000-more-extensions.html. 
  7. ^ http://userscripts.org/
  8. ^ "Greasemonkey". mozdev. http://xsidebar.mozdev.org/modifiedmisc.html#greasemonkey. Retrieved 2009-05-05. 
  9. ^ ianloic. "Greasemonkey". Songbird. http://addons.songbirdnest.com/addon/79. Retrieved 2009-05-05. 
  10. ^ "Take Control with User JavaScript". Opera Software. http://opera.com/docs/userjs/examples/#greasemonkey. Retrieved 2009-03-26. 
  11. ^ "Userscripts in IE7Pro". http://ie7pro.com/user-script.html. 
  12. ^ "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/. 
  13. ^ "Trixie". http://www.bhelpuri.net/Trixie/. Retrieved 2011-08-01. 
  14. ^ 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. 
  15. ^ "User Scripts - The Chromium Projects". http://www.chromium.org/developers/design-documents/user-scripts/. Retrieved 2010-10-24. 
  16. ^ "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

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages