O'Reilly logo

Greasemonkey Hacks by Mark Pilgrim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #65. Select Your Yahoo! ID from a List

Add a drop-down menu on Yahoo!'s login form to select your username.

Do you have multiple Yahoo! accounts? Are you tired of typing them over and over when switching back and forth between them? Are you sick of hacks that begin with rhetorical questions? I can't help you with that last one, but here's a hack that gives you a drop-down menu of all your Yahoo! IDs in the Yahoo! login form.

The Code

This user script runs on all Yahoo! pages, but the first thing it does is check for the existence of the Yahoo! login form. If it doesn't find a login form, it just exits without doing anything. If it does find the login form, it sets a short timer to replace the username input box with a drop-down menu of your Yahoo! IDs.

Edit the following user script to include your Yahoo! IDs, and then save it as yahoo-select.user.js:

 // ==UserScript== // @name Yahoo! User Persitance Thing // @namespace http://www.rhyley.org/gm/ // @description Add a drop-down box to the Yahoo login form // @include http*://*.yahoo.tld/* // ==/UserScript== // based on code by Jason Rhyley // and included here with his gracious permission // ** Replace this array with your Yahoo IDs ** var gUserIDs = new Array("Put","Your","User","ID","Here"); var login = null; var password = null; function buildLoginThing() { if (gUserIDs[0] == 'Put'){ alert('You must configure the script before it will \n' + 'work propery. Go to "Manage User Scripts" and\n' + 'click the \"Edit\" button to configure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required