mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* new account.login view for tibiacom template
* added new indicator icons for create account, create character and change character name * attempt to fix incorrect views counter behavior (its resetting to 0 in some cases) * moved check_* functions to class Validator * from now all validators ajax requests will fire onblur instead of onkeyup * ajax requests returns now json instead of xml * added 404 response when file is not found * fixed gallery
This commit is contained in:
@@ -1,28 +1,60 @@
|
||||
<script type="text/javascript">
|
||||
eventId = 0;
|
||||
lastSend = 0;
|
||||
var eventId = 0;
|
||||
var lastSend = 0;
|
||||
|
||||
$(function() {
|
||||
$('#createaccount').submit(function () {
|
||||
return validate_form(this);
|
||||
});
|
||||
|
||||
updateFlag();
|
||||
$('#account_country').change(function() {
|
||||
updateFlag();
|
||||
});
|
||||
|
||||
$('#account_input').blur(function() {
|
||||
checkAccount();
|
||||
});
|
||||
$('#email').blur(function() {
|
||||
checkEmail();
|
||||
});
|
||||
$('#password').blur(function() {
|
||||
checkPassword();
|
||||
});
|
||||
$('#password2').blur(function() {
|
||||
checkPassword();
|
||||
});
|
||||
});
|
||||
|
||||
function updateFlag()
|
||||
{
|
||||
var img = $('#account_country_img');
|
||||
var country = $('#account_country :selected').val();
|
||||
if(country.length) {
|
||||
img.attr('src', 'images/flags/' + country + '.gif');
|
||||
img.show();
|
||||
}
|
||||
else {
|
||||
img.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkAccount()
|
||||
{
|
||||
if(eventId != 0)
|
||||
{
|
||||
clearInterval(eventId);
|
||||
clearInterval(eventId)
|
||||
eventId = 0;
|
||||
}
|
||||
|
||||
if(document.getElementById("account_input").value == "")
|
||||
{
|
||||
document.getElementById("acc_check").innerHTML = '<b><font color="red">Please enter account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}.</font></b>';
|
||||
$('#account_error').html('Please enter account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}.');
|
||||
$('#account_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
return;
|
||||
}
|
||||
|
||||
// anti flood
|
||||
//anti flood
|
||||
var date = new Date;
|
||||
var timeNow = parseInt(date.getTime());
|
||||
|
||||
@@ -30,17 +62,26 @@
|
||||
{
|
||||
if(timeNow - lastSend < 1100)
|
||||
{
|
||||
eventId = setInterval('checkAccount()', 1100);
|
||||
eventId = setInterval('checkAccount()', 1100)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var account = document.getElementById("account_input").value;
|
||||
$.get("tools/validate.php", { account: account, uid: Math.random() },
|
||||
$.getJSON("tools/validate.php", { account: account, uid: Math.random() },
|
||||
function(data){
|
||||
document.getElementById("acc_check").innerHTML = data;
|
||||
lastSend = timeNow;
|
||||
});
|
||||
if(data.hasOwnProperty('success')) {
|
||||
$('#account_error').html ('');
|
||||
$('#account_indicator').attr('src', 'images/global/general/ok.gif');
|
||||
}
|
||||
else if(data.hasOwnProperty('error')) {
|
||||
$('#account_error').html(data.error);
|
||||
$('#account_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
lastSend = timeNow;
|
||||
}
|
||||
|
||||
function checkEmail()
|
||||
@@ -53,13 +94,14 @@
|
||||
|
||||
if(document.getElementById("email").value == "")
|
||||
{
|
||||
document.getElementById("email_check").innerHTML = '<b><font color="red">Please enter e-mail.</font></b>';
|
||||
$('#email_error').html('Please enter e-mail.');
|
||||
$('#email_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
return;
|
||||
}
|
||||
|
||||
//anti flood
|
||||
var date = new Date;
|
||||
vartimeNow = parseInt(date.getTime());
|
||||
var timeNow = parseInt(date.getTime());
|
||||
|
||||
if(lastSend != 0)
|
||||
{
|
||||
@@ -71,11 +113,77 @@
|
||||
}
|
||||
|
||||
var email = document.getElementById("email").value;
|
||||
$.get("tools/validate.php", { email: email, uid: Math.random() },
|
||||
$.getJSON("tools/validate.php", { email: email, uid: Math.random() },
|
||||
function(data){
|
||||
document.getElementById("email_check").innerHTML = data;
|
||||
lastSend = timeNow;
|
||||
});
|
||||
if(data.hasOwnProperty('success')) {
|
||||
$('#email_error').html ('');
|
||||
$('#email_indicator').attr('src', 'images/global/general/ok.gif');
|
||||
}
|
||||
else if(data.hasOwnProperty('error')) {
|
||||
$('#email_error').html(data.error);
|
||||
$('#email_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
lastSend = timeNow;
|
||||
}
|
||||
|
||||
function checkPassword()
|
||||
{
|
||||
if(eventId != 0)
|
||||
{
|
||||
clearInterval(eventId)
|
||||
eventId = 0;
|
||||
}
|
||||
|
||||
if(document.getElementById("password").value == "")
|
||||
{
|
||||
$('#password_error').html('Please enter the password for your new account.');
|
||||
$('#password_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
return;
|
||||
}
|
||||
|
||||
if(document.getElementById("password2").value == "")
|
||||
{
|
||||
$('#password2_error').html('Please enter the password again!');
|
||||
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
return;
|
||||
}
|
||||
|
||||
//anti flood
|
||||
var date = new Date;
|
||||
var timeNow = parseInt(date.getTime());
|
||||
|
||||
if(lastSend != 0)
|
||||
{
|
||||
if(timeNow - lastSend < 1100)
|
||||
{
|
||||
eventId = setInterval('checkPassword()', 1100)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var password = document.getElementById("password").value;
|
||||
var password2 = document.getElementById("password2").value;
|
||||
$.getJSON("tools/validate.php", { password: password, password2: password2, uid: Math.random() },
|
||||
function(data){
|
||||
if(data.hasOwnProperty('success')) {
|
||||
$('#password_error').html ('');
|
||||
$('#password2_error').html ('');
|
||||
$('#password_indicator').attr('src', 'images/global/general/ok.gif');
|
||||
$('#password2_indicator').attr('src', 'images/global/general/ok.gif');
|
||||
}
|
||||
else if(data.hasOwnProperty('error')) {
|
||||
$('#password_error').html(data.error);
|
||||
$('#password2_error').html(data.error);
|
||||
$('#password_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
$('#password2_indicator').attr('src', 'images/global/general/nok.gif');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
lastSend = timeNow;
|
||||
}
|
||||
|
||||
function validate_required(field,alerttxt)
|
||||
|
Reference in New Issue
Block a user