GMX autologin

By S3bast1an Last update Jul 21, 2009 — Installed 1,728 times.

There are 1 previous version of this script.

// ==UserScript==
// @name           GMX autologin
// @namespace      http://www.gmx.de
// @description    Automatically submits the GMX login form if your username and password were automatically filled in (typically by the Firefox password manager). This script only logs in when necessary. 
// @include        *gmx.*
// ==/UserScript==

// Milliseconds to wait for form to autofill (necessary in Fx 1.5 - slower computers may need longer wait)
var timer = 1000;


var timo, maySubmit = true;  // Not currently typing (so we can submit it)

// Locate form elements
var form = document.forms.namedItem('login');
var uid = form.elements.namedItem('id');
var pw = form.elements.namedItem('p');

// Don't submit form as we are typing into it
pw.addEventListener('keydown', function(e) {
	maySubmit = false;
	
	clearTimeout(timo);
	
	timo = setTimeout(function() {
		maySubmit = true;
		doSignIn();
	}, 2000);
	
}, true);

function doSignIn() {
	//form.submit();
	if(uid.value.length && pw.value.length && maySubmit) {  // Form must be non-empty and not being typed into
		form.submit();
	} else {  // Bide our time...
		window.setTimeout(doSignIn, timer);
	}
}

// Attempt to sign in
doSignIn();