#334 fixed #!startnull problem
This commit is contained in:
parent
7e79b07f8c
commit
5379288610
@ -128,7 +128,7 @@ SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached,
|
|||||||
//update state
|
//update state
|
||||||
this.state[entry['div']] = url;
|
this.state[entry['div']] = url;
|
||||||
callback();
|
callback();
|
||||||
}
|
};
|
||||||
SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached, 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) : '' );
|
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
|
||||||
@ -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');
|
system.log_info('load page: '+id+entry['div']+' '+url+' - cached');
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
//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) {
|
||||||
var hash = null;
|
var hash = null;
|
||||||
if (id.indexOf('#') != -1) {
|
if (id.indexOf('#') !== -1) {
|
||||||
var splinters = id.split('#');
|
var splinters = id.split('#');
|
||||||
hash = splinters.pop()
|
hash = splinters.pop()
|
||||||
id = splinters.pop();}
|
id = splinters.pop();}
|
||||||
@ -164,7 +164,7 @@ SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) {
|
|||||||
//update history?
|
//update history?
|
||||||
if( !(id === this.start_state && this.cur_state() === '') && //avoid start state in url unless called explicit
|
if( !(id === this.start_state && this.cur_state() === '') && //avoid start state in url unless called explicit
|
||||||
id !== this.cur_state()){//new state?
|
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
|
//Syncronous Call to system.handle_call_pages_entry and done-function
|
||||||
var done = function(){
|
var done = function(){
|
||||||
|
|||||||
@ -9,12 +9,11 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function sys_hashchange(state){
|
function sys_hashchange(state){
|
||||||
console.log(state);
|
var state_ = state ? state.split(';')[0].split('(')[0] : state;
|
||||||
state = state ? state.split(';')[0].split('(')[0] : state;
|
|
||||||
$('.nav li,#sai_navbar li, #project_navbar li').each(function(){
|
$('.nav li,#sai_navbar li, #project_navbar li').each(function(){
|
||||||
$(this).removeClass('active');});
|
$(this).removeClass('active');});
|
||||||
if($('#menu_'+state).parent().length){
|
if($('#menu_'+state_).parent().length){
|
||||||
$('#menu_'+state).parent().addClass('active');
|
$('#menu_'+state_).parent().addClass('active');
|
||||||
} else {
|
} else {
|
||||||
$('#menu_start').parent().addClass('active');}
|
$('#menu_start').parent().addClass('active');}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user