GMail Auto-Login

By m3nth Last update Feb 7, 2006 — Installed 7,207 times. Daily Installs: 1, 0, 4, 8, 1, 5, 7, 5, 2, 2, 0, 1, 5, 0, 2, 7, 5, 4, 3, 3, 4, 2, 2, 3, 1, 0, 3, 1, 2, 4, 0, 0
// ==UserScript==
// @name            GMail Auto-Login
// @namespace       
// @description     Auto-login to GMail, assuming Firefox is set to remember your password. Update: 2006-02-07
// @include         http*://www.google.com/accounts/*
// ==/UserScript==
// Stolen and subsequently adapted from the Myspace autologin script (see http://slashetc.net/code/)

var pwFocus = false;

function autoLogin()
{
    if(pwFocus==false)
    {
        if(document.forms[0].elements.namedItem("Passwd").value.length>1)
          {document.forms[0].submit();}
        else
          {setTimeout(autoLogin,100);}
    }
}

function focusEvent()
{
    pwFocus = true;
}

if(document.forms[0] && document.forms[0].elements.namedItem("Passwd"))
{
    document.forms[0].elements.namedItem("Passwd").addEventListener("keypress", focusEvent, false);
    window.addEventListener("load", autoLogin, false);
}