Revolutionizing the Web with Firefox and Greasemonkey (with screenshots)
A greasemonkey is a mechanic who works on your automobile. He gets his hands dirty, and goes under the hood to find out why your car is making that clunking noise. Greasemonkey is an extension for Firefox that does much the same thing, but without the ridiculous fees.
This guide is intended for beginners
In my previous guide I explained how to install a Firefox extension, and hopefully sparked some interest in why you would want to extend your web browser in the first place. I used the Greasemonkey extension as an example for a very good reason. Sometimes you want to extend your web browser in a big way, like putting a new room in your house. That’s where an extension comes in (it’s like hiring a construction company). Other times all you want to do is repaint a room or re-hang a door; something you could do yourself over a weekend. That’s where Greasemonkey comes in. There are many small jobs and minor tweaks to web pages that would be overkill for a full Firefox extension.
Greasemonkey is a unique extension in that it lets you install these things called user scripts. User scripts are much smaller than extensions, and are often targeted to much more specific tasks than extensions. There is a web site called UserScripts.org that is devoted to these small tiny hacks people have created to make the web work more like the way they want it to.
What Can Greasemonkey User Scripts Do?
- Remember information
- Remove parts of web pages
- Change how web pages look
- Automatically download information from other web sites and put it into the current page
- Cross-reference information from other web sites
- Speed up common tasks so that they require less clicks
Useful Greasemonkey User Scripts
- Pagerization: scrolling will automatically load the next page for Google (Search, Image, News, Group, Video), Yahoo, Wikipedia, Hatena, YouTube, del.icio.us, Twitter, digg and Userscripts.org.
- Pre Fill Comments: type ALT-C to fill in the comment form on all WordPress blogs.
- Automatically login to Facebook: tired of having to type your password every time?
- Disable Facebook apps: block apps on other people’s profile pages on Facebook.
- Facebook to Google Calendar: add Facebook events to your Google Calendar
- GMailTo: force mailto: links to open in Gmail.
- Gmail Folders: lets you add hierarchy to your gmail labels.
- Gmail Saved Searches: save frequently used searches.
- Gmail Label Colors: have labels with different colours.
- SSLGoogle: forces Gmail, Google Docs and GCalendar to open via https secure connection.
- Resize all text input boxes on the web.
- Auto Add Google Reader: one click subscription using Google Reader.
- StumbleUpon WYSIWYG editor: gives you a powerful HTML editor for your StumbleUpon blog.
- Cleaner Amazon: gets rid of useless sections on Amazon search results.
- Movie Dude: Adds crosslinks to all movie web sites.
- YouTube Video Download: Download YouTube videos.
- No YouNoobs: Hide the comments on YouTube.
- Digg Mirrors: Adds mirrors to websites on Digg.
- Digg.licio.us: Adds save to delicious links on Digg.
- No Rotten Tomatoes: Removes bad movies from the Rotten Tomatoes box office listing.
Greasemonkey installs like any other Firefox extension. This guide shows you how to install Greasemonkey in a step by step process with screenshots.
How to Find Greasemonkey User Scripts
The best source for finding Greasemonkey scripts is userscripts.org. To find scripts for a specific web site, type its name into the search box and hit enter.
The left hand side of the screen will return a list of scripts. Unfortunately there is no way to sort them.
If you click on the script name it will take you to a page with more information about the scripts. The easiest way to tell if a script is any good is by the number of times it has been installed, and how much effort the author goes into explaining what the script does and how it works.
To install a script click on the “install this script” link in the right hand column.
Hot Tip: I’ve created a script that highlights the most popular user scripts and makes it easier to find the best scripts on userscripts.org.
Installing a Script
All user scripts end with the .user.js extension. If you do not have Greasemonkey installed, or Greasemonkey is disabled, then your web browser will try to download the file instead of installing it.
Click on this link to start installation of my Akismet Auntie Spam script.
A box will pop-up that gives a short description, tells you which web sites the script runs on, and offer to install it. Click on the Install button.
A message will appear temporarily in the lower right hand corner of your web browser telling you that the installation was successful.
Turning Greasemonkey on and off
You can enable and disable Greasemonkey temporarily by clicking on the little monkey icon in the lower right corner of your web browser. This is a great trick for when a script isn’t doing exactly what you want – you can turn off all of your scripts and interact with the web site normally as if you didn’t have Greasemonkey installed.
Advanced Users – Managing Scripts
If you click on Tools >> Greasemonkey >> Manage User Scripts it will open up a windows that lets you:
- Control which web sites the script does or does not run on
- Enable or disable specific scripts
- Uninstall scripts
- Directly edit the script (it will ask you which text editor to use the first time you try it)
Heading to the management panel is a really useful way to further tweak scripts, or just change the web sites they run on.
Advanced Users – Configuring Scripts
I can’t tell you how to configure a specific script, but I can give you a general overview of the various ways it can be done.
Editing the Script
Example: Find images that are too wide
This is the sign of a lazy programmer. It isn’t that hard to edit a script, but it is still a pain in the butt when they tell you to change settings directly in the script. I usually won’t bother installing scripts like this.
- Click on Tools >> Greasemonkey >> Manage User Scripts
- Choose the Script
- Click on Edit
- Make the change
Running User Script Commands
User scripts can only modify the Firefox menu in one place, under Tools >> Greasemonkey >> User Script Commands. It may be grayed out if you don’t have any scripts installed that register commands.
Some scripts use hot keys to perform actions. You’ll have to read their documentation on how to use them. When you’re on the web page that the script works with, hitting keys on your keyboard will cause the script to do things.
Changing Settings Interactively
Example: Pre Fill Comments
Smart scripts configure themselves through dialog boxes the first time you run them. This is by far the recommended and most painless way for scripts to configure themselves. Hint.
Q1: Greasemonkey is cool! Is there anything else out there like it?
Q2: I want to create a Greasemonkey script, but I don’t know how to program.
Platypus is WYSIWYG editor for Greasemonkey scripts. It will let you create Greasemonkey scripts by moving around and interacting with parts of a web site.
(WYSIWYG – what you see is what you get)
Q3: What about Internet Explorer?
Yes Virginia, it is possible to use some userscripts with Internet Explorer. Watch this space.