Yahoo Fantasy Sports focus player search box

By Tim Wilson Last update Sep 19, 2007 — Installed 431 times. Daily Installs: 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// ==UserScript==
// @name           Yahoo Fantasy Sports focus player search box
// @description    Places the focus on the player search box in Yahoo Fantasy Sports
// @include        http://*.fantasysports.yahoo.com/*/players*
// ==/UserScript==

// startpoint of this script
var labels;
var i;

labels = document.getElementsByTagName('label');

// Find the label for the search box and add the access key.
for ( i=0; i < labels.length; i++ ) {
    if( labels[i].getAttribute('for') == 'playersearchtext' ) {
        labels[i].setAttribute("accessKey", "s");
    }
}

// Uncomment to always focus the search box (and comment the lines above)
//var userName;
//if ( userName = document.getElementById('playersearchtext') ) {
//	userName.focus();
//}