small fixes with timing in system.js

This commit is contained in:
Ulf Gebhardt 2015-04-10 19:58:47 +02:00
parent 17e1b0ffe2
commit 00e8c98341

View File

@ -91,7 +91,7 @@ SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached)
SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached) { SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached) {
var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' ); var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' );
//check loaded state of div - reload only if required //check loaded state of div - reload only if required
if(forced || this.state[entry['div']] !== url || !$(entry['div']).length){ if(forced || this.state[entry['div']] !== url || !$(entry['div']).length || $(entry['div']).html() === ''){
//load page //load page
this.call_url(url,function(data){system.handle_call_pages_page(data,entry,id,forced,cached);},{},'html',true); this.call_url(url,function(data){system.handle_call_pages_page(data,entry,id,forced,cached);},{},'html',true);
} else { } else {
@ -100,11 +100,7 @@ SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached) {
} }
//internal function to handle pagestate results //internal function to handle pagestate results
SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) { SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) {
if(data['status']){ if(data['status']){
//clear old state
//this.state = {}
this.state_info = {}
this.log_info('load pages: endpoint '+this.endpoint+' group:'+this.group+' state:'+id+' - '+(cached ? 'cached ' : (forced ? 'forced' : 'success'))); this.log_info('load pages: endpoint '+this.endpoint+' group:'+this.group+' state:'+id+' - '+(cached ? 'cached ' : (forced ? 'forced' : 'success')));
//state not found? //state not found?
if(data['result'].length === 0){ if(data['result'].length === 0){