//
// ==UserScript==
// @name Popmundo Auto Login - Skip Class
// @namespace un4saken@hotmail.co.uk
// @description Automatically submits Popomundo login info which Firefox remembers, skips the Classroom, shows character page.
// @include http://www*.popmundo.com/*
// ==/UserScript==
function submitFirstPasswordForm()
{
for (var form, i=0; form=document.forms[i]; ++i) {
var numPasswordElements = 0;
var submitButton = null;
var formElement, j;
for (j=0; formElement=form[j]; ++j)
if (formElement.type == "password" && formElement.value && formElement.value.toLowerCase() != "password")
++numPasswordElements;
if (numPasswordElements == 1) {
for (j=0; formElement=form[j]; ++j)
if (formElement.type == "submit") {
submitButton = formElement;
break;
}
for (j=0; formElement=form.getElementsByTagName("input")[j]; ++j)
if (formElement.type == "image") {
submitButton = formElement;
break;
}
if (submitButton) {
submitButton.click();
return;
}
}
}
}
window.addEventListener(
"load",
function() {
setTimeout(submitFirstPasswordForm, 0);
},
false
);
if (document.evaluate('//a[contains(text(),"SKIP CLASS")]', document, null, 8, null).singleNodeValue) {
location.href = 'http://' + window.location.hostname + '/Common/CharacterDetails.asp';
}