Tuesday, April 21, 2009

Tip Tuesday - What Is Greasemonkey?

Allow me to dive right into the topic as there is a lot to cover on this one.

The Greasemonkey Firefox extension associates a bit of JavaScript with specific web pages and runs it every time you visit, dynamically changing the appearance and/or functionality of those pages. On the geeky side, Greasemonkey basically allows users to install JavaScript that make on-the-fly changes to most HTML-based web pages. Wikipedia says:
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.

These scripts do not actually change the web site itself, but it changes the way Firefox interacts with the HTML on a web page to make it act in a way that is more user-friendly and/or befitting of one's needs. This change only occurs in your Firefox browser and only for the current session. It does not change any coding on the server side or to the web site itself. It simply changes how Firefox reads the code on the page and redisplays it to you with the aesthetic and functionality based on the directions/code of the script(s) you have installed. Every time you visit the web site, the script changes the page for you without you noticing it. There is no delay in the changes visible to the naked eye, usually.

Greasemonkey Hacks, a book by Mark Pilgrim, says:
Greasemonkey allows you to write scripts that alter the web pages you visit. You can use it to make a website more readable or more usable. You can fix bugs that the site owner can't be bothered to fix themselves. You can alter pages so they work better with assistive technologies that speak to a web page aloud or convert it to Braille.

Some scripts allow you to auto-fill forms. You can even automatically retrieve data from other sites to make two sites act as one ... very close to mashups.

By itself, Greasemonkey does none of these things. In fact, after you install it, you won't notice any change at all, until you start installing what are called "user scripts."

The "Swiss Army Knife" of Firefox extensions may seem like it requires a bit of rampup to get going, but it does not. You simply install those "user scripts" without as much as restarting your browser. There are literally thousands already written for you. To install these user scripts, first you must install the Greasemonkey Firefox extension. Then head out to Userscripts.org and search for a web site or page you'd like to see optimized and in what manner and you're sure to find something.

Gmail Labels / FoldersLet's say you want to make Gmail work better with filters & labels. To be specific, you really like folders and you wished that Gmail could work with folders instead. I'd head to Userscripts.org and search for "Gmail folders." The more you search, the more you'll see how things are listed. Side note: I personally made my gmail combine filter-use with labels and displays them as folders. It has truly changed how I use Gmail (see the screen shot on the side). If you like, I'd be more than happy to share with you how I've done that. Let me know in the comments, or shoot me an email to the ahmadism [squigly thing] gmail [dot] com

Greasemonkey allows you to stipulate what pages (and sub pages/directories) to run the script of your choice on. And the reverse is also true. Greasemonkey allows to exclude certain sites/pages as well.

Ahmadism BookmarkletsSome of you know me well enough to know that I'm a bookmarklet collecting fool. I don't want to spend too much time on what bookmarklets are, just know that they are JavaScript code that you run ad-hoc on whatever page you deem fit. To make them accessible to you, you put bookmarklets as links in your bookmarks/favorites. Usually right on your toolbar as shown in the image on the side. Whereas Greasemonkey scripts run on specified URLs, bookmarklets are on-demand. I use mine in place of extensions, especially toolbar extensions, whenever possible. This helps keep Firefox running smooth without any risk of bugs, viruses, etc. that come by way of extensions. Finally, bookmarklets run on Google Chrome (I'm a Firefox fan/user, personally) and on the iPhone (not an owner of one) without any glitches, apps, etc.

Among the bookmarklets that I use, which also exist as a Greasemonkey script, is "linkify."
Linkify basically converts text links to clickable hyperlinks. It turns plain text links into real clikable links. Attempts to catch links like google.com. I don't want that running on all pages, or a set of pages. Instead, I want to run it whenever I want to run it. And I have a version that opens up the links in a new tab, converts plain text email addresses, as well, etc.

Some of the must-have Greasemonkey scripts, which make sites work sooo much better and I use include:
  • Ahmadism.com's own Launch in New Tab (LiNT): Launches, all included sites YOU specify, in a new window/tab. A simple but very useful script especially for job boards. Simply specify the URL's you want this to apply to.
  • Google Account Multi-Login: Replaces "Sign Out" link on Google pages with a select box of accounts. This is a must-have for all who have more than one Gmail account.
  • YouTube HQ 720p Ultimate: This script successfully seeks out the HIGHEST available quality for YouTube, and loads it on the page without refreshing.Gmail Labels / Folders - Closer Look
  • GMailTo: Opens mailto: hyperlinks in gmail compose. I have mine to exclude https://*.yahoo.com
  • Check Range: Lets you check or uncheck a range of checkboxes by clicking the first checkbox and then Shift+clicking the last checkbox.
  • Folders4Gmail: Which does what I mentioned earlier and allows you to organize your labels in a folder-like hierarchy.
If you have not given Greasemonkey a chance and use Firefox, now is the time to jump on board. Greasemonkey will give you a new perspective on the Internet and your favorite web sites by allowing you to take control of what they do and how it feels.

So let's hear it, fellow Greasemonkey users: What user scripts do YOU have installed? Let us all know in the comments.

No comments: