There are 7 previous versions of this script.
// ==UserScript==
// @name GMail Auto Login & Secure Connection Forcer
// @description Auto logs into Gmail for you if Firefox remembers your password. Switches to a secure connection if you're not using one. Even allows the saving of passwords by turning autocomplete on.
// @namespace http://userscripts.org/users/23652
// @include https://www.google.com/accounts/ServiceLogin?service=mail*
// @include http://www.google.com/accounts/ServiceLogin?service=mail*
// ==/UserScript==
if(/^http:/.test(location.href))
{location.replace(location.href.replace(/^http/, 'https'));}
var username = GM_getValue('gm_un', '');
var password = GM_getValue('gm_pw', '');
function main() {
if(!/^https?:\/\/www\.google\.com\/accounts\/ServiceLogin\?service=mail/.test(location.href)) {return;}
if(username=='' || password=='') {options();}
else {
var f = document.forms[0],
n = document.getElementById('Email'),
p = document.getElementById('Passwd');
if(!f || !n || !p) {return;}
else {
if(n) {n.value = username;}
if(p) {p.value = password;}
f.submit();
return true;
}
}
}
function options() {
var gm_un = prompt('Username to remember');
var gm_pw = prompt('Password to remember');
if(gm_un && gm_pw && gm_un!='' && gm_pw!='') {
GM_setValue('gm_un', gm_un);
GM_setValue('gm_pw', gm_pw);
if(confirm('Reload to apply changes?')) {window.location.reload();}
} else {alert('Invalid username or password');}
return true;
}
// Nuller by JoeSimmons. Nulls out all the elements you put as the arguments.
// Syntax: nuller(someElement,anotherElement,moreElements);
function nuller() {
for(x in arguments)
if(x) {
x=null;
delete x;
}
}
function leakAvoider() {
nuller(username,password,n,p,f,gm_un,gm_pw);
window.removeEventListener('load', main, false);
document.removeEventListener('unload', leakAvoider, false);
return true;
}
window.addEventListener('load', main, false);
window.addEventListener('unload', leakAvoider, false);
GM_registerMenuCommand('Gmail Auto Login Options', options);
