This commit is contained in:
Savetheinternet 2011-01-21 13:14:55 +11:00
parent ec34fa8076
commit 67148f2846
6 changed files with 82 additions and 40 deletions

23
main.js
View file

@ -14,9 +14,21 @@ function focusId(id)
document.getElementById(id).focus();
init();
}
function generatePassword() {
pass = '';
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+';
for(i=0;i<8;i++) {
rnd = Math.floor(Math.random() * chars.length);
pass += chars.substring(rnd,rnd + 1);
}
return pass;
}
function dopost(form) {
localStorage.name = form.name.value;
localStorage.email = form.email.value;
localStorage.name = form.name.value.replace(/ ##.+$/, '');
if(form.email.value != 'sage')
localStorage.email = form.email.value;
return form.body.value != "" || (typeof form.thread != "undefined" && form.file.value != "");
}
@ -65,6 +77,13 @@ function init()
newElement.appendChild(style);
}
if(!localStorage.password)
localStorage.password = generatePassword();
elements = document.getElementsByName('password');
for(x=0;x<elements.length;x++) {
elements[x].value = localStorage.password;
}
document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild)
if (window.location.hash.indexOf('q') == 1)