#334 fixed #!startnull problem

This commit is contained in:
Ulf Gebhardt 2017-05-06 17:06:37 +02:00
parent 7e79b07f8c
commit 5379288610
2 changed files with 7 additions and 8 deletions

View File

@ -128,7 +128,7 @@ SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached,
//update state
this.state[entry['div']] = url;
callback();
}
};
SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached, callback) {
var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' );
//check loaded state of div - reload only if required
@ -139,12 +139,12 @@ SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached, cal
system.log_info('load page: '+id+entry['div']+' '+url+' - cached');
callback();
}
}
};
//internal function to handle pagestate results
SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) {
var hash = null;
if (id.indexOf('#') != -1) {
if (id.indexOf('#') !== -1) {
var splinters = id.split('#');
hash = splinters.pop()
id = splinters.pop();}
@ -164,7 +164,7 @@ SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) {
//update history?
if( !(id === this.start_state && this.cur_state() === '') && //avoid start state in url unless called explicit
id !== this.cur_state()){//new state?
window.history.pushState(null, "", '#!'+id+(hash ? '#'+hash : null));}
window.history.pushState(null, "", '#!'+id+(hash ? '#'+hash : ''));}
//Syncronous Call to system.handle_call_pages_entry and done-function
var done = function(){

View File

@ -9,12 +9,11 @@ $(document).ready(function() {
});
function sys_hashchange(state){
console.log(state);
state = state ? state.split(';')[0].split('(')[0] : state;
var state_ = state ? state.split(';')[0].split('(')[0] : state;
$('.nav li,#sai_navbar li, #project_navbar li').each(function(){
$(this).removeClass('active');});
if($('#menu_'+state).parent().length){
$('#menu_'+state).parent().addClass('active');
if($('#menu_'+state_).parent().length){
$('#menu_'+state_).parent().addClass('active');
} else {
$('#menu_start').parent().addClass('active');}
}