Greasemonkey

From Wikipedia, the free encyclopedia
Jump to: navigation, search
This article is about the software. For the comic, see Grease Monkey. For other uses, see Grease monkey (disambiguation).
Greasemonkey
Greasemonkey.png
Original author(s) Aaron Boodman
Developer(s) Anthony Lieuallen, Johan Sundström,[1] 13 more[2]
Initial release 28 March 2005; 9 years ago (2005-03-28)[3]
Stable release 2.2[4] / 28 August 2014; 56 days ago (2014-08-28)
Written in JavaScript, XUL, CSS
Operating system Cross-platform
Available in English
Type Mozilla extension
License MIT License
Website www.greasespot.net

Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to web page content after or before the page is loaded in the browser (also known as augmented browsing).

The changes made to the web pages are executed every time the page is viewed, making them effectively permanent for the user running the script.

Greasemonkey can be used for customizing page appearance, adding new functions to web pages (for example, embedding price comparisons within shopping sites), fixing rendering bugs, combining data from multiple web pages, and numerous other purposes.

History[edit]

The Greasemonkey project began 28 November 2004, written by Aaron Boodman.[5][6][7] Boodman was inspired to write Greasemonkey after looking at a Firefox extension designed to clean up the interface of Allmusic.[8] This extension was written by Adrian Holovaty, who later became a userscript developer. By May 2005, there were approximately 60 general and 115 site-specific userscripts distributed for Greasemonkey.[8] During this time, a Greasemonkey compiler was also developed for converting a userscript into a standalone Firefox extension.[9] Greasemonkey was initially met with complaints by publishers, for its ability to block ads.[10] However, this criticism shifted its focus to other addons starting with the 2006 release of Adblock Plus.

Userscripts.org[edit]

To accommodate the growing number of scripts, userscripts.org was founded by Britt Selvitelle and other members of the Greasemonkey community in late 2005. Userscripts.org was open sourced in 2007 but the site later moved away from this code base.[11] As the main script repository listed on Greasemonkey's official site, userscripts.org grew to a size of over 100,000 scripts by 2013.

On April 1, 2013, the last known admin Jesse Andrews, posted that he was trying to fix install counts on userscripts.org.[12] Prior to this, many of the "most popular scripts" as listed by the site, had nominal install counts of zero. Over the following year spam scripts became more common, server downtime increased and the install count bug remained.[13] With no further communication by Andrews, userscript writers described the site as neglected and the official Greasemonkey site removed its front page link.[14][15] In response, script writers began working on the fork, openuserjs.org.[12] Dissatisfied with its development pace, Jason Barnabe created greasyfork.org as an immediate replacement. Since May 2014, userscripts.org became no longer accessible on the default port 80, meaning that anyone wanting to visit userscripts.org had to use a plain HTTP connection to userscripts.org:8080 (port 8080) to visit the website.[13] Since Aug 2014, userscripts.org:8080 has been inaccessible as well, but most scripts once hosted by userscripts.org can still be found on the static mirror http://userscripts-mirror.org.[13]

Technical details[edit]

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. 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.

Greasemonkey scripts can modify a webpage in any way that JavaScript allows, with certain Greasemonkey security restrictions. Scripts can also access other web pages and web services 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 metadata which specifies the name of the script, a description, resources required by 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.

Compatibility[edit]

Greasemonkey is available for Firefox, Flock and Web (formerly called Epiphany). The Greasemonkey extension for Web is part of the Web 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[16] and Songbird.[17] An equivalent extension called Tampermonkey is available for Google Chrome.

Equivalents for other browsers[edit]

Versions 8 and upwards of Opera also have user scripting functionality and are capable of running many Greasemonkey user scripts.[18] To make full use of GM_ API and metadata block, however, one has to use an extension such as Violentmonkey[19][20] or Tampermonkey.[21]

For Internet Explorer, similar functionality is offered by IE7Pro,[22] Sleipnir,[23] and iMacros.

As of February 2010, Chrome has limited "native support" for Greasemonkey scripts.[24] They are internally converted to extensions, and are managed as such. Chrome honors 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.[25] More compatibility is provided by the "TamperMonkey" extension, giving support for GreaseMonkey specific features.[26][27][28]

On Safari for Mac (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.[29] Fluid is a site-specific browser with integrated GreaseKit.

Kango[30] framework allows creating extensions for Firefox, Chrome, Internet Explorer, Opera, Safari using JavaScript only, the code being single for all browsers. Kango supports[31] user scripts.

See also[edit]

References[edit]

  1. ^ "The weblog about Greasemonkey". 
  2. ^ "The greasemonkey network graph". 
  3. ^ "Initial Greasemonkey Release". 
  4. ^ Greasemonkey 2.2 Release on greasespot.net.
  5. ^ "Greasemonkey Project Info". 
  6. ^ Pilgrim, Mark (2005). Greasemonkey Hacks. O'Reilly. 
  7. ^ "Aaron Boodman wrote Greasemonkey in 2004". 
  8. ^ a b Singel, Ryan (17 May 2005). "Firefox Users Monkey With the Web?". Wired magazine. 
  9. ^ Nivi (2005-05-08). "Greasemonkey will blow up business models (as well as your mind)". Archived from the original on 2008-02-05. Retrieved 2010-07-22. 
  10. ^ Festa, Paul (24 March 2005). "Firefox add-on lets surfers tweak sites, but is it safe?". CNET. 
  11. ^ Selvitelle, Britt (2007-01-03). "Userscripts.org... Opensource!". Archived from the original on 2007-01-17. Retrieved 2014-05-21. 
  12. ^ a b "Fixing Install Counts". 2013-04-01. Retrieved 2014-05-21. [dead link]
  13. ^ a b c Brinkmann, Martin (2014-05-09). "Userscripts.org down for good? Here are alternatives". Retrieved 2014-05-21. 
  14. ^ "User Script Hosting". 2014-05-16. Retrieved 2014-05-21. 
  15. ^ "Please change the official userscript site". greasemonkey-dev mailing list. 2014-04-21. https://groups.google.com/forum/#!topic/greasemonkey-dev/FDTswcuQW6Y. Retrieved 2014-05-21.
  16. ^ "Greasemonkey". mozdev. Retrieved 2009-05-05. 
  17. ^ ianloic. "Greasemonkey". Songbird. Retrieved 2009-05-05. 
  18. ^ "Take Control with User JavaScript". Opera Software. Retrieved 2009-03-26. 
  19. ^ Violent monkey - Opera add-ons
  20. ^ Cross-browser userscripting
  21. ^ Tampermonkey Beta - Opera add-ons
  22. ^ "User Scripts in IE7Pro". 
  23. ^ "You can also add custom functionality to Sleipnir with a wide range of plugins and user scripts". 
  24. ^ Boodman, Aaron (2010-02-01). "40,000 More Extensions!". blog.chromium.org. Retrieved 2010-02-01. 
  25. ^ "User Scripts - The Chromium Projects". Retrieved 2010-10-24. 
  26. ^ Chrome Web Store - Tampermonkey
  27. ^ Chrome Web Store - Tampermonkey BETA
  28. ^ Paul, Ian (18 January 2012). "How to Access Wikipedia on SOPA Protest Day". PC World. Retrieved 28 January 2013. 
  29. ^ "New extension for Safari 5 called NinjaKit lets you install GM scripts". Excellatronic Communications. Retrieved 2010-07-22. 
  30. ^ "Kango framework". 
  31. ^ "Modifying content of web pages using Kango Framework and jQuery". 

External links[edit]