Greasemonkey

Greasemonkey

Infobox Software
name = Greasemonkey



caption = Screenshot of the "BookBurro" user script running in Greasemonkey. BookBurro alters an amazon.com page to show the prices of the same book offered by competing retailers.
collapsible =
author = Aaron Boodman
developer = ?
released = ?
latest release version = 0.8.20080609.0
latest release date = 2008-06-12
latest preview version =
latest preview date =
programming language =
operating system = Cross-platform
language = English
genre = Mozilla extension
license = Expat License
website = [http://www.greasespot.net/ www.greasespot.net/]

Greasemonkey is a Mozilla Firefox extension that allows users to install scripts that make on-the-fly changes to most HTML-based web pages. 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 functionality to web pages (for example, embedding price comparison in Amazon.com web pages), fixing rendering bugs, combining data from multiple webpages, and numerous other purposes. Well-written Greasemonkey scripts can integrate changes so well that their additions appear to be natural parts of the web page.

Technical details

Most Greasemonkey user scripts are written by hand, using site-specific JavaScript code which manipulates the contents of a web page using the Document Object Model interface. [http://userscripts.org/ userscripts.org] maintains a database of Greasemonkey scripts, and for each it lists the URLs of web pages to which the scripts pertain. (N.B. The [http://dunck.us/collab/GreaseMonkeyUserScripts obsolescent script repository] "might" contain some older scripts that have not yet migrated to the [http://userscripts.org/ new repository] .) When the user loads a matching page, Greasemonkey invokes the relevant scripts, which can then add to the page, delete parts of it, or move parts around. Greasemonkey scripts can also poll external HTTP resources via a non-domain-restricted XMLHTTP request. Greasemonkey scripts are named "somename".user.js, and Greasemonkey automatically detects and offers to install any such script, when a URL ending in that suffix is loaded. In addition to JavaScript code, Greasemonkey scripts contain limited optional metadata, which specifies the name of the script, a description, 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 restrictions imposed by the security provisions of Mozilla's XPCNativeWrappers. Compared to writing a full-fledged Firefox extension, user scripting is a very modest step up in complexity from basic web programming, but for the JavaScript illiterate and non-programmer incapable of writing a user script, the Platypus [http://platypus.mozdev.org/] extension allows them to edit a page (deleting or moving parts of it around) to create persistent Greasemonkey scripts automating their changes.

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 what 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 correlating information from related pages on the same site, or other sites. "(For example, list the prices of competing retailers' for the same product.)"
* Add extended JavaScript behavior to pages. "(For example, collate RSS feeds on the current page into a floating panel. Allow the user save an FLV file from popular video streaming sites such as Google Video, YouTube, and Facebook.)"

Technical, operational, and ethical issues arising from user scripting

Some in the Firefox community, and a number of technical analysts, warn that widespread use of Greasemonkey and related user scripting technologies will require care in deployment. Their concerns include:

* Possible disruption to revenue of some Websites. Some Firefox users already block Web advertisements with Adblock Plus, but Greasemonkey may be used to change ads from one company to those of their competitor, to artificially inflate Web advertising scores, or to fool the statistics programs run by paid browsing companies.
* Increases in the Web traffic that arise from some scripts. Such Greasemonkey scripts obtain additional information about pages the user visits, for example from services such as del.icio.us and Bloglines. If these scripts were widely used, they would cause substantial additional traffic to the target Websites. An example is a script that retrieves data for every link on the page through XMLHttpRequests.
* The proliferation of scripts acting on many pages, and the difficulty of distinguishing whether problems in a page are caused by actual Web-programming bugs or by local Greasemonkey scripts, may make troubleshooting defects more difficult.
* Script errors resulting from lack of coordination between Greasemonkey developers and the original Website developers.
* Greasemonkey only works on HTML-based pages, and does not work on Java, Flash, Flex, and Silverlight content within Web pages. An exception is where you attribute an embedded flash with the swliveconnect=true attribute, enabling you to modify variables in the Flash file. [ [http://userscripts.org/scripts/show/32886 A greasemonkey script that demonstrates its power over flash] ]
* Rich Internet Applications are more difficult for a Greasemonkey script developer to control than static Web pages. This is because the more logic that a page performs, the more complexities there are to consider for the Greasemonkey script writer to develop a script that will not interfere with the original application's functionality, and because of the high likelihood of further content being loaded (via XMLHttpRequest) after the main page load has completed.
* The original site developers can release a new version of the site that causes the Greasemonkey script designed for that site to stop working. Therefore, a Greasemonkey script written for a specific site without developer coordination cannot be considered a long-term solution.
* There is no official way for user scripts to update themselves; some developers added such functionality to their userscripts but most of them remain static, and eventually break.

Greasemonkey compatibility and equivalents for other browsers

Other Mozilla-based browsers

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 [http://xsidebar.mozdev.org/modifiedmisc.html#greasemonkey] and Songbird [http://addons.songbirdnest.com/addon/79] .

Opera

Version 8 and upwards of Opera also have [http://www.opera.com/support/tutorials/userjs/ user scripting functionality] . Both Opera and Firefox support the W3C DOM. Opera is capable of running many Greasemonkey user scripts. [Opera. [http://www.opera.com/support/tutorials/userjs/examples/#greasemonkey Take Control with User JavaScript] . Retrieved 2008/07/05.]

afari

[http://8-p.info/greasekit/ GreaseKit] (formerly [http://creammonkey.sourceforge.net/ Creammonkey] ) and [http://www.culater.net/software/PithHelmet/PithHelmet.php PithHelmet] (shareware) are similar tools for the MacOS version of the Safari browser, along with other WebKit based applications such as MailPlane.

Konqueror

[http://kde-apps.org/content/show.php?content=51482 Konqueror Userscript] is a webpage manipulation tool for KDE's Konqueror browser which aims for compatibility with Greasemonkey scripts and metadata. It is available as a KPart.

Internet Explorer

For Internet Explorer, similar functionality is offered by IE7pro, iMacros, [http://www.bhelpuri.net/Trixie/Trixie.htm Trixie] (last updated 2005), [http://www.reifysoft.com/turnabout.php Turnabout] (last updated 2006) and [http://www.gm4ie.com/ Greasemonkey for IE] (last updated 2006). Turnabout used to be open source software (under the BSD License), but as of September 2006, the source code is no longer available.

imilar software

Browser level only (Firefox)

*AlchemyPoint combines a Firefox extension with a client side Proxy Server to allow for manipulation of web content, scraping of data from websites, detection/parsing of microformats, etc.
* [http://groups.csail.mit.edu/uid/chickenfoot/ Chickenfoot] is a Firefox extension that aims to enable both end-user programmers and hackers to script interactions on the Web.
* [https://addons.mozilla.org/firefox/3863/ iMacros for Firefox] is a Firefox extension that allows the user to record and replay so called "Internet Macros" for web automation, web scraping or web testing.
*Stylish is a Firefox extension that allows for client-side manipulation of webpage content through Cascading Style Sheets.
*Bookmarklets can execute arbitrary JavaScript on any page, but they require a user to click them, rather than running automatically.
*Firebug is a developers extension which allows arbitrary realtime changes to a page's DOM
* [http://monkey.coolspacer.com/ Super GreaseMonkey] is a mod of GreaseMonkey which supports runtime libraries (specifically jquery) for user scripts.
* [http://www.bubbleshq.com/ Bubbles] is the first Site-Specific-Browser, and it uses JS injection of user-scripts, very much like GreaseMonkey.

Proxy level

* [http://monkeygrease.org/ Monkeygrease] is a Java Servlet which can be used to alter the output of a closed-source Java web application before its output is sent to the client.
*Proxomitron, available since late 1990s, predates JavaScript active browsing and provides similar functionality for all browsers using a regexp-like matching language.
* [http://proximodo.sourceforge.net/ Proximodo] , inspired by- and interoperable with proxomitron, is an open source, client side proxy server which allows manipulation of page content
* [http://privoxy.org/ Privoxy] is an open source, client side proxy server which allows manipulation of page content available in many OS flavors
* [http://mousehole.rubyforge.org/wiki/wiki.pl?MouseHole MouseHole] is a client side proxy server which allows manipulation of page content using Ruby.

Alternatives

Without an extension like Greasemonkey, modifications to websites can also be done in one of the following ways:

* Entering javascript: URLs in the Location Bar or using bookmarklets
* Using the browser's DOM Inspector
* Using a full-fledged extension that serves the same purpose. (It is indeed possible to convert much of the code in a GreaseMonkey script to become part of a Firefox extension. Indeed this is how GreaseMonkey scripters often "graduate" to becoming extension writers.)
* Using a local HTTP proxy that modifies the HTML, such as WebWasher or Proxomitron
* Using the Opera browser and user.js scripts

ee also

* Adblock
* List of Firefox extensions

Notes

External links

* [http://www.greasespot.net/ Homepage of the Greasemonkey extension]
* [http://wiki.greasespot.net/ Greasemonkey Wiki]
* [http://diveintogreasemonkey.org/toc/ "Dive Into Greasemonkey"] - A free online book on Greasemonkey script writing by Mark Pilgrim
* [http://userscripts.org/ UserScripts.org] (formerly [http://greasemonkeyed.com Greasemonkeyed.com] ) - User script repository
* [http://userstyles.org/ UserStyles.org] - User styles (CSS) for [http://addons.mozilla.org/addon/2108 Stylish] extension (many of which are also available in Greasemonkey format)
* [http://userjs.org/ UserJS.org] - User Javascripts for Opera (many of which are also available in Greasemonkey format)
* [http://simon.incutio.com/archive/2005/04/11/etiquette Greasemonkey etiquette]
*
* [http://sorl.net/dev/xpi/ Greasemonkey script compiler] Converts Greasemonkey scripts into extensions
* [http://arantius.com/misc/greasemonkey/script-compiler Script compiler] for conversion of Greasemonkey scripts to extensions
* [http://www.letitblog.com/greasemonkey-compiler/ Greasemonkey compiler] converts Greasemonkey user scripts into full-fledged extensions
* [http://www.makeuseof.com/tag/greasemonkey-firefox-addon/ Greasemonkey Explained for non-techies]
* [http://peterlaird.blogspot.com/2007/08/greasemonkey-in-enterprise-when-is-gm.html Greasemonkey in the Enterprise] - blog series on security and deployment issues when using Greasemonkey for IT projects
* [http://internetducttape.com/2007/08/24/howto-use-firefox-greasemonkey-userscripts-screenshots/ InternetDuctTape.com] - Beginner's Guide to installing and using Greasemonkey user scripts

External reviews

*
*cite news | last=Singel | first=Ryan | title=Firefox Users Monkey With the Web? | date=17 May 2005 | publisher=Wired magazine | url=http://www.wired.com/news/technology/0,1282,67527,00.html


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Greasemonkey — Entwickler Anthony Lieuallen, Aaron Boodman, Johan Sundström Aktuelle Version 0.9.13 (3. November 2011) Kategorie Add on Deutschsprachig Ja …   Deutsch Wikipedia

  • Greasemonkey — Desarrollador Anthony Lieuallen, Johan Sundström Información general Diseñador Aaron Boodman Lanzamiento 28 de marzo …   Wikipedia Español

  • Greasemonkey — est une extension pour les navigateurs web Mozilla Firefox, Epiphany, Opera et Internet Explorer, permettant de modifier le comportement d une page web en associant un script JavaScript au chargement de celle ci. Il est ainsi possible d… …   Wikipédia en Français

  • Greasemonkey — Тип добавление пользовательского JavaScript на веб страницу Разработчики Anthony Lieuallen, Aaron Boodman, Johan Sundström Устанавливается на Firefox, Google Chrome Версия 1.5 (19 ноября 2012 го …   Википедия

  • Greasemonkey — es una extensión para el navegador Mozilla Firefox que permite, por medio de pequeñas porciones de código creadas por usuarios, modificar el comportamiento de páginas web específicas. Con esta extensión es posible mejorar la experencia de lectura …   Enciclopedia Universal

  • greasemonkey — grease monkey n. Slang A mechanic, especially one who works on motor vehicles or aircraft. * * * …   Universalium

  • Active Browsing — Greasemonkey (von engl. grease monkey für „(Kfz )Schrauber“[1], wörtlich „Schmieraffe“) heißt eine Erweiterung zum Webbrowser Mozilla Firefox, die die Implementierung des Konzeptes Active Browsing ermöglicht. Greasemonkey erlaubt dem Nutzer… …   Deutsch Wikipedia

  • Applisignet — Bookmarklet Un bookmarklet (en français : un applisignet, ou un marque page scripté) est un petit programme JavaScript pouvant être stocké : soit en tant qu URL dans un signet avec la plupart des navigateurs Web soit en tant qu… …   Wikipédia en Français

  • Bookmarklet — Un bookmarklet (en français : signapplet [1] (Québec), applisignet, marque page scripté) est un petit programme JavaScript pouvant être stocké : soit en tant qu URL dans un signet avec la plupart des navigateurs Web soit en tant qu… …   Wikipédia en Français

  • Favelet — Bookmarklet Un bookmarklet (en français : un applisignet, ou un marque page scripté) est un petit programme JavaScript pouvant être stocké : soit en tant qu URL dans un signet avec la plupart des navigateurs Web soit en tant qu… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”