The Web Your Way with Greasemonkey


Extension Greasemonkey

Categories Developer Tools, Web Annoyances, Website Integration

Since the birth of the Web, Internet surfing has been a very passive activity. You decide where to go, but when you get there, the site owner controls the experience. Greasemonkey allows you to customize Web sites to your liking. Think of it as your interior decorator for the Web: You can get inside other people's pages and move, redesign, or remove what's on them. You can even add to them. For example, some Greasemonkey users customize Google to show image previews of each search result, which helps you decide whether a result is any good before you waste time clicking through to it. Of course, none of your changes affect other visitors to the page.

Greasemonkey is the tool that makes this possible. Before you can start surfing the Web your way, you need to tell Greasemonkey what "your way" is. This is expressed in a set of programming instructions known as a user script. When a Web site finishes loading, Greasemonkey executes these instructions to customize it. However, you don't need to be a programmer to use Greasemonkey. Thousands of advanced users have already created user scripts that you can install with one click.

Warning 

As with extensions in general, the Mozilla Foundation cannot guarantee the safety or function of user scripts.

Greasemonkey supports two kinds of user scripts:

  • Generic scripts can affect any Web site you visit. For example, the Linkifier script changes text addresses (such as http://www.google.com or john@smith.com) on any page into actual links that you can click.

  • Site-specific scripts are specifically designed for certain Web sites. For example, the Yahoo! Mail Keyboard Shortcuts script adds keyboard shortcuts to the Yahoo! mail interface so you can navigate it more quickly. This script is specially designed for Yahoo! and won't work elsewhere. Site-specific scripts are more fragile than generic scripts because they could stop working if the target Web site changes significantly.

Greasemonkey is one of the most complicated Firefox extensions available, but it's also one of the most powerful. Enjoy your Web!

How it works After installing Greasemonkey, make your way to the user scripts collections:

Generic scripts:

http://dunck.us/collab/GreaseMonkeyUserScriptsGeneric

Site scripts:

http://dunck.us/collab/GreaseMonkeyUserScriptsSpecific

When you find a script you like, right-click the link to it (left-clicking shows you the script itself) and choose Install User Script. Greasemonkey asks you whether to exclude certain Web sites from the effects of the script, as shown in Figure 22-5. By default, generic and site-specific scripts behave as I explain earlier in this section. When the Install User Script window appears, click OK to continue with installation. And that's basically all there is to it. When you visit an applicable Web site, the script should automatically kick in after the page is done loading.

image from book
Figure 22-5: You see this advanced window whenever you install a user script. Click OK to continue installing.

You can turn Greasemonkey on and off by clicking the little monkey head in the bottom-right corner of the main Firefox window. You'll also notice some new Greasemonkey options on the Tools menu, but these are mostly technical features you can ignore.

Tip 

I recommend the scripts in Table 22-2 to first-time Greasemonkey users who want to get their feet wet.

Table 22-2: Greasemonkey Scripts to Try

Script Name

Type

Description

Linkifier

Generic

Automatically converts textual addresses (such as http://www.google.com or john@smith.com) into clickable links.

Expand TextArea

Generic

Lets you resize text entry boxes on a page so you don't need to scroll as much. (Works only with text boxes that accept more than one line of text to begin with.)

Zoom Image

Generic

Lets you zoom images by using a small toolbar that appears when you hover over them.

Google Search Keys

Site

Numbers the results of a Google search, as illustrated in Figure 22-6. Press a number on your keyboard to open the corresponding results. (For example, in Figure 22-6 you could press 6 to load the CNN Weather page.)

image from book
Figure 22-6: The Google Search Keys script prefixes each Google search result with a number you can press to access it.

Additional help is available in Mark Pilgrim's free online book, Dive into Greasemonkey, at http://www.diveintogreasemonkey.org.




Firefox For Dummies
Firefox For Dummies
ISBN: 0471748994
EAN: 2147483647
Year: 2006
Pages: 157
Authors: Blake Ross

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net