112 lines
3.6 KiB
JavaScript
112 lines
3.6 KiB
JavaScript
var WizardStates = [
|
|
//statename, backbut, nextbut, startbut, regbut, backname, nextname
|
|
['',false, false, true, false,'','wizard_details'],
|
|
['wizard_details',true,true, false, false,'','wizard_visuals'],
|
|
['wizard_visuals',true,true, false, false,'wizard_details','wizard_friend'],
|
|
['wizard_friend',true,true, false, false,'wizard_visuals','wizard_skills'],
|
|
['wizard_skills',true,true, false, false,'wizard_friend','wizard_spawn'],
|
|
['wizard_spawn',true,true, false, false,'wizard_skills','wizard_summ'],
|
|
['wizard_summ',true,true, false,false,'wizard_spawn','wizard_reg'],
|
|
['wizard_reg',true,false, false, true,'wizard_summ','']
|
|
]
|
|
|
|
var wizard_state = '';
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#login_form input").not("[type=submit]").jqBootstrapValidation({
|
|
preventSubmit: true,
|
|
submitError: function($form, event, errors) {},
|
|
submitSuccess: function($form, event){
|
|
$.get('./api.php?call=account&action=login&username='+$('#bt_login_user').val()+'&password_sha='+$.sha1($('#bt_login_password').val())+'&password_md5='+$.md5($('#bt_login_password').val()), function (data) {
|
|
if(data == 1){
|
|
$('.help-block').html("Login successfull.</br>");
|
|
$('#nav').load('?action=default_navbar', function (){
|
|
$('#nav').scrollLeft(2000);
|
|
load_wizard_page ('user_news');
|
|
register_menu ();
|
|
});
|
|
} else {
|
|
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.")
|
|
}
|
|
});
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
|
|
register_menu ();
|
|
|
|
$('#back a').click(function() {
|
|
back(wizard_state);});
|
|
|
|
$('#next a').click(function() {
|
|
next(wizard_state);});
|
|
|
|
$('#start a').click(function() {
|
|
start ();});
|
|
|
|
});
|
|
|
|
function register_menu (){
|
|
$('#wizard_navbar a').click(function () {
|
|
$('#wizard_navbar li').each(function(){
|
|
$(this).removeClass('active');});
|
|
$(this).parent().addClass('active');
|
|
load_wizard_page ($(this).attr("state"));
|
|
});
|
|
}
|
|
|
|
function load_wizard_page (state){
|
|
wizard_state = state;
|
|
|
|
if(state == ''){
|
|
window.location.reload();}
|
|
|
|
$('#content').hide();
|
|
$('#content').load('?action='+state, function (){
|
|
$('#content').show(750);
|
|
|
|
for(var i=0; i<WizardStates.length;i++){
|
|
if(WizardStates[i][0] == state){
|
|
WizardStates[i][1] ? $('#back').fadeIn(500) : $('#back').hide();
|
|
WizardStates[i][2] ? $('#next').fadeIn(500) : $('#next').hide();
|
|
WizardStates[i][3] ? $('#start').fadeIn(500) : $('#start').hide();
|
|
WizardStates[i][4] ? $('#register').fadeIn(500) : $('#register').hide();
|
|
break;
|
|
}
|
|
}
|
|
if(window[state]){
|
|
window[state]();}
|
|
});
|
|
|
|
};
|
|
|
|
function back(state){
|
|
for(var i=0; i<WizardStates.length;i++){
|
|
if(WizardStates[i][0] == state){
|
|
load_wizard_page (WizardStates[i][5]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function next(state){
|
|
for(var i=0; i<WizardStates.length;i++){
|
|
if(WizardStates[i][0] == state){
|
|
load_wizard_page (WizardStates[i][6]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function start(){
|
|
$('#nav').scrollTop(1500);
|
|
$('#nav').load('?action=default_navbar', function (){
|
|
$('#nav').scrollLeft(2000);
|
|
load_wizard_page ('wizard_details');
|
|
register_menu ();
|
|
});
|
|
|
|
}
|
|
|