Monday, August 23, 2010

The Complete Beginner’s Guide to User Scripts

A user script is code written in a programming language that allows you to control a piece of software. Think for example, macro’s in Microsoft Office that help improve your work flow. Well did you know that you can do the exact same thing with your browsing experience, and the websites you view? Well you can, and it’s amazing. Greasemonkey first came around in 2004/05, and its the tool that really threw user scripts in the browser out there. Greasemonkey is a Firefox extension that allows you to write scripts that alter the web pages that you view. It allows you to make web pages more usable, more viewable, fix bugs for yourself; the possibilities are endless.
Lets look at an example of a fantastic user script that solves some problems for the user. Twitter is a fantastic tool, that many of us web designers, and developers use to collaborate, share knowledge, and make new connections, as well as letting current, and prospective clients keep up with our work. However, if we are all honest, there are things about twitter that annoy, and limit us. Mentioning someone can be a difficult task, especially when you can’t remember their exact twitter name. Working out which people you follow are following you back is a monumental task. Navigating in the dark with URL shorteners can be potentially dangerous (NSFW). The new re-tweet button doesn’t let you add your own thoughts to a tweet without copy pasting. That’s just naming a few, but that can all be fixed, with a user script!

This user script, Making twitter better!, solves all these issues that we have. It auto-completes twitter names as you type for you, it shows an icon next to people who are following you back, it unshortens url’s for you so you can feel safe clicking links, and it add’s a new button; comment. This really shows the power that these user scripts have.

So what are user scripts coded in?

When you install Greasemonkey in Firefox, you’ll notice no difference at all. Greasemonkey itself doesn’t do these incredible things. It’s the user scripts that Greasemonkey runs that do the work. For the user scripts we are working with, these are imply chunks of javascript code, with a bit of additional information for Greasemonkey to work out where and when to run the script. These user scripts have the power to target a specific site, page, or a group of sites, and it has the power to do anything you can do with javascript, and more. That means, with a basic knowledge of javascript, you can get stuck right into making your own scripts!

What is browser support like?

You’ll be happy to know, that since Greasemonkey’s release in 2004/05, user scripts are no longer just limited to Firefox. You are able to user userscripts in Internet Explorer, Opera, Chrome, Safari, and of course Firefox, with support for other browsers being limited, but sometimes available. (I cannot vouch for each of the following options as I only use Chrome as my browser)

Internet Explorer

For internet explorer, your main option for similar functionality appears to be IE7Pro. This is an add-on for IE6, 7 and 8 and adds features such as tab enhancement, ad blocker, flash blocker, mouse gestures, inline search, privacy enhancements, online bookmark service, Greasemonkey-like user script support, and plug-in support.

Chrome

Google Chrome, you’ll be interested to hear, comes with built-in support for user scripts as of February 2010, so no add ons are necessary! Basically, Chrome turns user scripts into extensions and runs them as such. However, support for some user script specific functions are lacking, so be prepared to find the odd script that wont work for you.

Safari

Safari, unlike Chrome, doesn’t come with built-in support. For users of Safari 5, there is an extension called NinjaKit which allows you to obviously run user scripts. For users of older versions of Safari, there is an alternative called Greasekit which is a SIMBL plugin.

Firefox

Firefox obviously harness’ the power of user script through the Greasemonkeyscript. No surprise there since it has done since 2005!

Opera

Opera, like Chrome, is capable of running user scripts itself. Similarly to Chrome, you may run in to trouble with some scripts, but the majority will run fine.

Some user script for your use

Of course, what use would these browser implementations be without some scripts to use? Here are 20 fantastic scripts to get you started!

YouTube Video Download

Scans the YouTube page for all download formats, from iPod compatible MP4s to high-definition 1080p.

Disable Google Fade-in

Disable the animation from Google’s new homepage.

Show Just Image

Removes garbage from some image hosting sites and displays the image only.

Download from YouTube

Adds FLV, MP4, 3GP, and 720p download links to YouTube.

Google Inline MP3 Player

Inserts Google Reader’s MP3 Flash player next to any linked MP3 file you stumble onto while browsing

Chromium RSS-Feed Detection

Detect the RSS-Feed on Pages and show a little “SearchClone”-dialog

Helvetwitter

Twitter is becoming more and more cluttered with useless features and other junk. This strips it back to the basics.

Helvetical

Helvetical turns the mayhem of the Google interface of Google Calendar into something that doesn’t offend.

Helvetireader

Helvetireader aims to make the interface of Google Reader a clean, minimal experience where you’re not assaulted by an array of colours, social features and buttons.

No comments:

Post a Comment