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(),'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_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_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>';
|
'<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,
|
dataType: data_type,
|
||||||
url: this.endpoint+'?'+call,
|
url: this.endpoint+'?'+call,
|
||||||
success: success,
|
success: success,
|
||||||
//error: function{console.log(call)}
|
error: function(XMLHttpRequest, textStatus, errorThrown){console.log(call);}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//get the pagestates and save em
|
//get the pagestates and save em
|
||||||
@ -72,8 +72,8 @@ SYSTEM.prototype.load_pagestates = function(){
|
|||||||
};
|
};
|
||||||
//load a pagestatewith given id
|
//load a pagestatewith given id
|
||||||
SYSTEM.prototype.load = function(id){
|
SYSTEM.prototype.load = function(id){
|
||||||
|
console.log('Load Pagestate: '+id);
|
||||||
if(!this.load_pagestates()){
|
if(!this.load_pagestates()){
|
||||||
console.log(id+'2');
|
|
||||||
return false;}
|
return false;}
|
||||||
var push = true;
|
var push = true;
|
||||||
this.pagestates.forEach(function(entry) {
|
this.pagestates.forEach(function(entry) {
|
||||||
@ -81,24 +81,29 @@ SYSTEM.prototype.load = function(id){
|
|||||||
if(push){
|
if(push){
|
||||||
window.history.pushState(null, "", '#'+id);
|
window.history.pushState(null, "", '#'+id);
|
||||||
push = false;}
|
push = false;}
|
||||||
var fn = window[entry['func']];
|
$.ajax({
|
||||||
if(typeof fn !== 'function') {
|
async: false,
|
||||||
fn = null;}
|
data: {},
|
||||||
$(entry['div']).load(entry['url'],fn);
|
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;
|
return push ? false : true;
|
||||||
};
|
};
|
||||||
//what?
|
//what?
|
||||||
SYSTEM.prototype.cur_state = function() {
|
SYSTEM.prototype.cur_state = function() {
|
||||||
var pathName = window.location.pathname,
|
var pathName = window.location.href;
|
||||||
pageName = "";
|
if (pathName.indexOf('#') != -1) {
|
||||||
|
return pathName.split('#').pop();}
|
||||||
if (pathName.indexOf("/") != -1) {
|
return '';
|
||||||
pageName = pathName.split("/").pop();
|
}
|
||||||
} else {
|
|
||||||
pageName = pathName;
|
SYSTEM.prototype.go_state = function(default_state){
|
||||||
}
|
pageName = this.cur_state();
|
||||||
|
this.load(pageName ? pageName : default_state);
|
||||||
return pageName;
|
|
||||||
}
|
}
|
||||||
@ -2,7 +2,8 @@ var sys = null;
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
sys = new SYSTEM('./api.php',1);
|
sys = new SYSTEM('./api.php',1);
|
||||||
sys.load('start');
|
sys.go_state('start');
|
||||||
|
//sys.load();
|
||||||
});
|
});
|
||||||
|
|
||||||
function sendInfo(json,toolbar){
|
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) {
|
$.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){
|
if(data == 1){
|
||||||
$('.help-block').html("Login successfull.</br>");
|
$('.help-block').html("Login successfull.</br>");
|
||||||
$('#nav').load('?action=default_navbar', function (){
|
|
||||||
$('#nav').scrollLeft(2000);
|
|
||||||
load_wizard_page ('user_news');
|
|
||||||
register_menu ();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.")
|
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,5 +7,5 @@
|
|||||||
</h4>
|
</h4>
|
||||||
<div style="text-align: center; padding-top: 25px;"><img src="${PICPATH}help_gnome.png" width="200px;" /></div>
|
<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;">
|
<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>
|
</div>
|
||||||
@ -4,10 +4,10 @@ function init_wizard_details_toolbar(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init_wizard_details (){
|
function init_wizard_details (){
|
||||||
sys.load('wizard_details_toolbar');
|
//sys.load('wizard_details_toolbar');
|
||||||
|
|
||||||
$('#charname').keyup(function(){
|
$('#charname').keyup(function(){
|
||||||
sendInfo('{"char_name" : "'+$(this).val()+'"}','wizard_details_toolbar');});
|
sendInfo('{"char_name" : "'+$(this).val()+'"}','wizard_details');});
|
||||||
|
|
||||||
$('.info').mouseover(function(){
|
$('.info').mouseover(function(){
|
||||||
var info = $(this).attr('info');
|
var info = $(this).attr('info');
|
||||||
@ -21,7 +21,7 @@ function init_wizard_details (){
|
|||||||
$('#details_race a').addClass('fadeout');
|
$('#details_race a').addClass('fadeout');
|
||||||
$('#details_race .'+$(this).attr('gender')).addClass('fadein');
|
$('#details_race .'+$(this).attr('gender')).addClass('fadein');
|
||||||
$(this).addClass('selected');
|
$(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(){
|
$('#details_race a').click(function(){
|
||||||
@ -29,7 +29,7 @@ function init_wizard_details (){
|
|||||||
$('#details_gender a').removeClass('selected');
|
$('#details_gender a').removeClass('selected');
|
||||||
$('#details_gender .'+$(this).attr('gender')).addClass('selected');
|
$('#details_gender .'+$(this).attr('gender')).addClass('selected');
|
||||||
$(this).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(){
|
$('#details_class a').click(function(){
|
||||||
@ -58,7 +58,7 @@ function init_wizard_details (){
|
|||||||
if(!$('#details_race .selected').hasClass('fadein')){
|
if(!$('#details_race .selected').hasClass('fadein')){
|
||||||
$('#details_race .selected').removeClass('selected');
|
$('#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();});
|
$('#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 = array();
|
||||||
$vars['js'] = $this->js();
|
$vars['js'] = $this->js();
|
||||||
$vars['css'] = $this->css();
|
$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 (){
|
function init_wizard_visuals (){
|
||||||
sys.load('wizard_visuals_toolbar');
|
|
||||||
$('#sel_skin_color').change(function(){
|
$('#sel_skin_color').change(function(){
|
||||||
sendInfo('{"char_skin_color" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
sendInfo('{"char_skin_color" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||||
sys.load('wizard_visuals');});
|
|
||||||
$('#sel_hair').change(function(){
|
$('#sel_hair').change(function(){
|
||||||
sendInfo('{"char_hair" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
sendInfo('{"char_hair" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||||
sys.load('wizard_visuals');});
|
|
||||||
$('#sel_hair_color').change(function(){
|
$('#sel_hair_color').change(function(){
|
||||||
sendInfo('{"char_hair_color" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
sendInfo('{"char_hair_color" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||||
sys.load('wizard_visuals');});
|
|
||||||
$('#sel_face').change(function(){
|
$('#sel_face').change(function(){
|
||||||
sendInfo('{"char_face" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
sendInfo('{"char_face" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||||
sys.load('wizard_visuals');});
|
|
||||||
$('#sel_facial_hair').change(function(){
|
$('#sel_facial_hair').change(function(){
|
||||||
sendInfo('{"char_facial_hair" : "'+$(this).val()+'"}','wizard_visuals_toolbar');
|
sendInfo('{"char_facial_hair" : "'+$(this).val()+'"}','wizard_visuals');});
|
||||||
sys.load('wizard_visuals');});
|
|
||||||
|
|
||||||
//$('.item').draggable();
|
//$('.item').draggable();
|
||||||
}
|
}
|
||||||
@ -123,4 +123,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></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