pagestate system, updated system reference
This commit is contained in:
parent
ff8a8f5fe9
commit
b9e7cb2cbf
@ -33,35 +33,53 @@ person.speak(); // alerts "Howdy, my name is Bob"
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function SYSTEM(endpoint){
|
function SYSTEM(endpoint, group){
|
||||||
this.endpoint = endpoint;
|
this.endpoint = endpoint;
|
||||||
this.statedef = null;
|
this.group = group;
|
||||||
|
this.pagestates = null;
|
||||||
}
|
}
|
||||||
SYSTEM.prototype.load_statedef = function(){
|
SYSTEM.prototype.load_pagestates = function(){
|
||||||
if(!this.statedef){
|
result = false;
|
||||||
$.getJSON(this.endpoint+'?call=statedef', function (data) {
|
newps = null;
|
||||||
|
if(!this.pagestates){
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
dataType: "json",
|
||||||
|
url: this.endpoint+'?call=pagestates&group='+this.group,
|
||||||
|
data: {},
|
||||||
|
success: function (data) {
|
||||||
if(data['status']){
|
if(data['status']){
|
||||||
this.statedef = data['result'];
|
newps = data['result'];
|
||||||
|
console.log('SYSTEM: loaded Pagestates');
|
||||||
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
alert("Problem with the statedef");}
|
console.log('SYSTEM: Problem with your Pagestates.');
|
||||||
|
result = false;}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
this.pagestates = newps;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
SYSTEM.prototype.load = function(id){
|
SYSTEM.prototype.load = function(id){
|
||||||
this.load_statedef();
|
if(!this.load_pagestates()){
|
||||||
|
console.log(id+'2');
|
||||||
|
return false;}
|
||||||
var push = true;
|
var push = true;
|
||||||
this.statedef.forEach(function(entry) {
|
this.pagestates.forEach(function(entry) {
|
||||||
if(entry['id'] == id){
|
console.log(entry);
|
||||||
|
if(entry['id'] === id){
|
||||||
if(push){
|
if(push){
|
||||||
window.history.pushState(null, "", id);
|
window.history.pushState(null, "", '#'+id);
|
||||||
push = false;}
|
push = false;}
|
||||||
var fn = window[settings.entry['function']];
|
var fn = window[entry['func']];
|
||||||
if(typeof fn !== 'function') {
|
if(typeof fn !== 'function') {
|
||||||
fn = null;}
|
fn = null;}
|
||||||
$(entry['div']).load(entry['url'],fn);
|
$(entry['div']).load(entry['url'],fn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
return push ? false : true;
|
||||||
|
};
|
||||||
|
|
||||||
SYSTEM.prototype.cur_state = function() {
|
SYSTEM.prototype.cur_state = function() {
|
||||||
var pathName = window.location.pathname,
|
var pathName = window.location.pathname,
|
||||||
@ -77,6 +95,16 @@ SYSTEM.prototype.cur_state = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
register_login();
|
||||||
|
$('#start a').click(function() {
|
||||||
|
load_wizard_details();});
|
||||||
|
load_visualisation('mojopulse');
|
||||||
|
|
||||||
|
sys = new SYSTEM('./api.php',1);
|
||||||
|
sys.load('default');
|
||||||
|
});
|
||||||
|
|
||||||
|
function register_login(){
|
||||||
$("#login_form input").not("[type=submit]").jqBootstrapValidation({
|
$("#login_form input").not("[type=submit]").jqBootstrapValidation({
|
||||||
preventSubmit: true,
|
preventSubmit: true,
|
||||||
submitError: function($form, event, errors) {},
|
submitError: function($form, event, errors) {},
|
||||||
@ -96,12 +124,7 @@ $(document).ready(function() {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
$('#start a').click(function() {
|
|
||||||
load_wizard_details();});
|
|
||||||
|
|
||||||
load_visualisation('mojopulse');
|
|
||||||
});
|
|
||||||
|
|
||||||
function load_wizard_details(){
|
function load_wizard_details(){
|
||||||
$('#frame_content').load('?action=wizard_details', function (){
|
$('#frame_content').load('?action=wizard_details', function (){
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
<a class="dwarf human fadein info" info="class_paladin" cclass="paladin" href="#" style="padding-left:30px;"><img src="${WOWICONS}paladin.png" /></a>
|
<a class="dwarf human fadein info" info="class_paladin" cclass="paladin" href="#" style="padding-left:30px;"><img src="${WOWICONS}paladin.png" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="lifecraft link-color" id="details_info" style="float: left; margin-top: 15px; width: 190px; height: 300px; overflow-y: hidden; padding: 8px; font-size: 14px; background: url(${PICPATH}infotext_background.png) no-repeat;">
|
<div class="lifecraft link-color" id="details_info" style="float: left; margin-top: 15px; width: 190px; height: 300px; overflow-y: hidden; padding: 8px; font-size: 14px; background: url(${PICPATH}infotext_background.png) no-repeat;">
|
||||||
<h3 style="padding-left: 20px;"><img src="${WOWICONS}help_questionmark.png" width="25px"/> Info</h3>
|
<h3><img src="${WOWICONS}help_questionmark.png" width="25px"/> Info</h3>
|
||||||
<div id="info_content">${infotext_default}</div>
|
<div id="info_content">${infotext_default}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|||||||
2
system
2
system
@ -1 +1 @@
|
|||||||
Subproject commit 51b7c6857ae7efbfdb4652652db527368332308c
|
Subproject commit b196e1cb7a403e4fabefc8ae686e6597b3f3eee5
|
||||||
Loading…
x
Reference in New Issue
Block a user