statesystem workin all the way
This commit is contained in:
parent
574cf5d5ee
commit
89a821af16
@ -15,6 +15,7 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/js/onlinegraphic.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_details/js/wizard_details.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_visuals/js/wizard_visuals.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_skills/js/wizard_skills.js').'"></script>'.
|
||||
'<script type="text/javascript" language="JavaScript" src="'.SYSTEM\WEBPATH(new PPAGE(),'wizard_spawn/js/wizard_spawn.js').'"></script>';
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ SYSTEM.prototype.call = function(call,success,data,data_type,async){
|
||||
dataType: data_type,
|
||||
url: this.endpoint+'?'+call,
|
||||
success: success,
|
||||
//error: function{console.log(call)}
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown){console.log(call);}
|
||||
});
|
||||
}
|
||||
//get the pagestates and save em
|
||||
@ -72,8 +72,8 @@ SYSTEM.prototype.load_pagestates = function(){
|
||||
};
|
||||
//load a pagestatewith given id
|
||||
SYSTEM.prototype.load = function(id){
|
||||
console.log('Load Pagestate: '+id);
|
||||
if(!this.load_pagestates()){
|
||||
console.log(id+'2');
|
||||
return false;}
|
||||
var push = true;
|
||||
this.pagestates.forEach(function(entry) {
|
||||
@ -81,24 +81,29 @@ SYSTEM.prototype.load = function(id){
|
||||
if(push){
|
||||
window.history.pushState(null, "", '#'+id);
|
||||
push = false;}
|
||||
var fn = window[entry['func']];
|
||||
if(typeof fn !== 'function') {
|
||||
fn = null;}
|
||||
$(entry['div']).load(entry['url'],fn);
|
||||
$.ajax({
|
||||
async: false,
|
||||
data: {},
|
||||
dataType: 'html',
|
||||
url: entry['url'],
|
||||
success: function(data){$(entry['div']).html(data); var fn = window[entry['func']]; if(typeof fn === 'function'){fn()};},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown){console.log(errorThrown);}
|
||||
});
|
||||
//$(entry['div']).load(entry['url'],fn);
|
||||
|
||||
}
|
||||
});
|
||||
return push ? false : true;
|
||||
};
|
||||
//what?
|
||||
SYSTEM.prototype.cur_state = function() {
|
||||
var pathName = window.location.pathname,
|
||||
pageName = "";
|
||||
|
||||
if (pathName.indexOf("/") != -1) {
|
||||
pageName = pathName.split("/").pop();
|
||||
} else {
|
||||
pageName = pathName;
|
||||
}
|
||||
|
||||
return pageName;
|
||||
var pathName = window.location.href;
|
||||
if (pathName.indexOf('#') != -1) {
|
||||
return pathName.split('#').pop();}
|
||||
return '';
|
||||
}
|
||||
|
||||
SYSTEM.prototype.go_state = function(default_state){
|
||||
pageName = this.cur_state();
|
||||
this.load(pageName ? pageName : default_state);
|
||||
}
|
||||
@ -2,7 +2,8 @@ var sys = null;
|
||||
|
||||
$(document).ready(function() {
|
||||
sys = new SYSTEM('./api.php',1);
|
||||
sys.load('start');
|
||||
sys.go_state('start');
|
||||
//sys.load();
|
||||
});
|
||||
|
||||
function sendInfo(json,toolbar){
|
||||
@ -25,11 +26,6 @@ function register_login(){
|
||||
$.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.")
|
||||
}
|
||||
|
||||
@ -7,5 +7,5 @@
|
||||
</h4>
|
||||
<div style="text-align: center; padding-top: 25px;"><img src="${PICPATH}help_gnome.png" width="200px;" /></div>
|
||||
<div id="start" style="float: left;padding-top: 55px;">
|
||||
<a href="#"><img src="${PICPATH}button.png"/></a>
|
||||
<a href="#wizard_details"><img src="${PICPATH}button.png"/></a>
|
||||
</div>
|
||||
@ -4,10 +4,10 @@ function init_wizard_details_toolbar(){
|
||||
}
|
||||
|
||||
function init_wizard_details (){
|
||||
sys.load('wizard_details_toolbar');
|
||||
//sys.load('wizard_details_toolbar');
|
||||
|
||||
$('#charname').keyup(function(){
|
||||
sendInfo('{"char_name" : "'+$(this).val()+'"}','wizard_details_toolbar');});
|
||||
sendInfo('{"char_name" : "'+$(this).val()+'"}','wizard_details');});
|
||||
|
||||
$('.info').mouseover(function(){
|
||||
var info = $(this).attr('info');
|
||||
@ -21,7 +21,7 @@ function init_wizard_details (){
|
||||
$('#details_race a').addClass('fadeout');
|
||||
$('#details_race .'+$(this).attr('gender')).addClass('fadein');
|
||||
$(this).addClass('selected');
|
||||
sendInfo('{"char_gender" : "'+$(this).attr('gender')+'"}','wizard_details_toolbar');
|
||||
sendInfo('{"char_gender" : "'+$(this).attr('gender')+'"}','wizard_details');
|
||||
});
|
||||
|
||||
$('#details_race a').click(function(){
|
||||
@ -29,7 +29,7 @@ function init_wizard_details (){
|
||||
$('#details_gender a').removeClass('selected');
|
||||
$('#details_gender .'+$(this).attr('gender')).addClass('selected');
|
||||
$(this).addClass('selected');
|
||||
sendInfo('{"char_race" : "'+$(this).attr('race')+'", "char_gender" : "'+$(this).attr('gender')+'"}','wizard_details_toolbar');
|
||||
sendInfo('{"char_race" : "'+$(this).attr('race')+'", "char_gender" : "'+$(this).attr('gender')+'"}','wizard_details');
|
||||
});
|
||||
|
||||
$('#details_class a').click(function(){
|
||||
@ -58,7 +58,7 @@ function init_wizard_details (){
|
||||
if(!$('#details_race .selected').hasClass('fadein')){
|
||||
$('#details_race .selected').removeClass('selected');
|
||||
}
|
||||
sendInfo('{"char_class" : "'+$(this).attr('cclass')+'"}','wizard_details_toolbar');
|
||||
sendInfo('{"char_class" : "'+$(this).attr('cclass')+'"}','wizard_details');
|
||||
});
|
||||
|
||||
$('#content .male').click(function (){male();});
|
||||
|
||||
4
mojotrollz/page/wizard_skills/js/wizard_skills.js
Normal file
4
mojotrollz/page/wizard_skills/js/wizard_skills.js
Normal file
@ -0,0 +1,4 @@
|
||||
function init_wizard_skills_toolbar(){
|
||||
$('#last').click(function(){sys.load($(this).attr('sysload'));});
|
||||
$('#next').click(function(){sys.load($(this).attr('sysload'));});
|
||||
}
|
||||
@ -14,6 +14,6 @@ class wizard_skills extends SYSTEM\PAGE\Page {
|
||||
$vars = array();
|
||||
$vars['js'] = $this->js();
|
||||
$vars['css'] = $this->css();
|
||||
return 'not implemented';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'wizard_skills/wizard_skills.tpl'), $vars);
|
||||
}
|
||||
}
|
||||
2
mojotrollz/page/wizard_skills/wizard_skills.tpl
Normal file
2
mojotrollz/page/wizard_skills/wizard_skills.tpl
Normal file
@ -0,0 +1,2 @@
|
||||
not implemented
|
||||
<div id="frame_content_toolbar" style="margin-top: 75px; height: 75px;"></div>
|
||||
@ -4,22 +4,16 @@ function init_wizard_visuals_toolbar(){
|
||||
}
|
||||
|
||||
function init_wizard_visuals (){
|
||||
sys.load('wizard_visuals_toolbar');
|
||||
$('#sel_skin_color').change(function(){
|
||||
sendInfo('{"char_skin_color" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
||||
sys.load('wizard_visuals');});
|
||||
sendInfo('{"char_skin_color" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||
$('#sel_hair').change(function(){
|
||||
sendInfo('{"char_hair" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
||||
sys.load('wizard_visuals');});
|
||||
sendInfo('{"char_hair" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||
$('#sel_hair_color').change(function(){
|
||||
sendInfo('{"char_hair_color" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
||||
sys.load('wizard_visuals');});
|
||||
sendInfo('{"char_hair_color" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||
$('#sel_face').change(function(){
|
||||
sendInfo('{"char_face" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
||||
sys.load('wizard_visuals');});
|
||||
sendInfo('{"char_face" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||
$('#sel_facial_hair').change(function(){
|
||||
sendInfo('{"char_facial_hair" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
||||
sys.load('wizard_visuals');});
|
||||
sendInfo('{"char_facial_hair" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||
|
||||
//$('.item').draggable();
|
||||
}
|
||||
@ -19,6 +19,6 @@ class wizard_visuals extends SYSTEM\PAGE\Page {
|
||||
$vars['css'] = $this->css();
|
||||
$vars['WOWICONS'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=wowicons&id=';
|
||||
$vars['infotext_default'] = \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_WOW_INFOTEXT)['default'];
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'wizard_visuals/wizard_visuals.tpl'), $vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'wizard_visuals/wizard_visuals.tpl'), $vars);
|
||||
}
|
||||
}
|
||||
@ -123,4 +123,4 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="frame_content_toolbar" style="margin-top: 75px; height: 75px;">${wizard_visuals_toolbar}</div>
|
||||
<div id="frame_content_toolbar" style="margin-top: 75px; height: 75px;"></div>
|
||||
Loading…
x
Reference in New Issue
Block a user