WebScrap

July 3, 2009

はてな自動ログインスクリプト

GMail Auto-Loginをはてな用にいじったもの。


// ==UserScript==
// @name            Hatena Auto Login
// @namespace
// @description     Auto login to Hatena.
// @include         https://www.hatena.ne.jp/login?location=*
// ==/UserScript==

var pwFocus = false;

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

function focusEvent()
{
pwFocus = true;
}

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

0 Coment:

Post a Comment