By Ben Hollis
—
Last update
Dec 27, 2005
—
Installed
657 times.
// ==UserScript==
// @name Birthday Pass
// @author Ben Hollis
// @namespace http://brh.numbera.com/software/greasemonkeyscripts/
// @description Automatically fills out and submits those annoying age-check forms. For example, the age-check form at http://www.stubbsthezombie.com/
// @include *
// @version 2.0 (5-17-2006)
// ==/UserScript==
function submitForm(formElement) {
var inputElement = formElement;
formElement = formElement.parentNode;
while(typeof(formElement) != 'undefined' && formElement.tagName.toLowerCase() != "form") {
formElement = formElement.parentNode;
}
if(formElement.name.toLowerCase().indexOf("agegate") < 0 && formElement.id.toLowerCase().indexOf("agegate") < 0 && formElement.action.toLowerCase().indexOf("agegate") < 0 && inputElement.name.toLowerCase().indexOf("agegate") < 0 && inputElement.id.toLowerCase().indexOf("agegate") < 0 && inputElement.className.toLowerCase().indexOf("agegate") < 0) {
return; //Not an age gate, don't submit
}
var submitquery = document.evaluate( "//input[@type='submit']", formElement, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if(submitquery.snapshotLength > 0) {
var submitbutton = submitquery.snapshotItem(0);
submitbutton.click();
}
else {
formElement.submit();
}
}
/* I tested this with www.princeofpersiagame.com and www.stubbsthezombie.com. I'll update it as I find more of these, but if you find one that doesn't work feel free to let me know. */
var birthmonth = document.evaluate( "//select[contains(@name,'month') or contains(@id,'month')]|//input[contains(@name,'month') or contains(@id,'month')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if(birthmonth.snapshotLength > 0) {
var monthSelect = birthmonth.snapshotItem(0);
monthSelect.value = 1;
var birthday = document.evaluate( "//select[contains(@name,'day') or contains(@id,'day')]|//input[contains(@name,'day') or contains(@id,'day')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if(birthday.snapshotLength > 0) {
var daySelect = birthday.snapshotItem(0);
daySelect.value = 1;
var birthyear = document.evaluate( "//select[contains(@name,'year') or contains(@id,'year')]|//input[contains(@name,'year') or contains(@id,'year')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if(birthyear.snapshotLength > 0) {
var yearSelect = birthyear.snapshotItem(0);
yearSelect.value = "1941";
submitForm(yearSelect);
}
}
}
//Gears of War code, pretty crazy
else {
var birthdatetext = document.evaluate( "//input[@type='text' and (contains(@id, 'birthdate') or contains(@id,'Birthdate') or contains(@id,'BirthDate'))]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if(birthdatetext.snapshotLength > 0) {
var birthText = birthdatetext.snapshotItem(0);
birthText.value = "01/01/1941";
submitForm(birthText);
}
}