Sunday, August 24, 2008

Greasemonkey !!!

FireFox - Greasemonkey

Greasmonkey is a firefox extension that allows you to write scripts that alter the webpages you visit

Some of the things which we can make using Greasemonkey is :

1. Make websites more readable.
2. Fix rendering bugs which the owner is not aware of.
3. Alter pages to make them work with other technologies like the speech based.
4. Retrieve data from multiple site and make them interconnected.

How to use Greasemonkey ??

To Use Greasemonkey, You need to install the Greasemonkey add-on unto yout Firefox browser and then we have to install the user script by choosing from the Tools > Install user script. The Greasemonkey is just an add-on and doesnt make any difference until the user scripts are installed. A repository of user scripts available. A user script usually ends with .user.js.

Let see how to use a sample greasemonkey script. As usuall its the Hello World script.
Example

The user script is named as helloworld.user.js

// Hello World! example user script
// version 0.1 BETA!
// 2005−04−22
// Copyright (c) 2005, Mark Pilgrim
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
//
// This is a Greasemonkey user script.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Hello World", and click Uninstall.
//
// −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
//
// ==UserScript==
// @name Hello World
// @namespace http://diveintogreasemonkey.org/download/
// @description example script to alert "Hello world!" on every page
// @include *
// @exclude http://diveintogreasemonkey.org/*
// @exclude http://www.diveintogreasemonkey.org/*
// ==/UserScript==
alert('Hello world!');


As you read the script you might know what the script means, no install this script by using the install user script option and choosing helloworld.user.js

Once installed, whenever you move to a new page an alert will be made saying Hello World.


Greasemonkey can change the way you browse once installed and used. Hope you have got a insight on what greasemonkey is all about.

Happy browsing and cheers to Greasemonkey !!!



No comments: