|
@ -65,18 +65,26 @@ |
|
|
|
|
|
|
|
|
// attach history events
|
|
|
// attach history events
|
|
|
if(settings.history) { |
|
|
if(settings.history) { |
|
|
|
|
|
module.debug('Initializing page state'); |
|
|
if( $.address === undefined ) { |
|
|
if( $.address === undefined ) { |
|
|
module.error(error.state); |
|
|
module.error(error.state); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
else if(settings.path === false) { |
|
|
|
|
|
module.error(error.path); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
else { |
|
|
module.verbose('Address library found adding state change event'); |
|
|
|
|
|
|
|
|
if(settings.historyType == 'html5') { |
|
|
|
|
|
module.debug('Using HTML5 to manage state'); |
|
|
|
|
|
if(settings.path !== false) { |
|
|
|
|
|
$.address |
|
|
|
|
|
.history(true) |
|
|
|
|
|
.state(settings.path) |
|
|
|
|
|
; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
module.error(error.path); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
$.address |
|
|
$.address |
|
|
.state(settings.path) |
|
|
|
|
|
.unbind('change') |
|
|
.unbind('change') |
|
|
.bind('change', module.event.history.change) |
|
|
.bind('change', module.event.history.change) |
|
|
; |
|
|
; |
|
@ -110,15 +118,16 @@ |
|
|
|
|
|
|
|
|
event: { |
|
|
event: { |
|
|
click: function(event) { |
|
|
click: function(event) { |
|
|
module.debug('Navigation clicked'); |
|
|
|
|
|
var |
|
|
var |
|
|
tabPath = $(this).data(metadata.tab) |
|
|
tabPath = $(this).data(metadata.tab) |
|
|
; |
|
|
; |
|
|
if(tabPath !== undefined) { |
|
|
if(tabPath !== undefined) { |
|
|
if(settings.history) { |
|
|
if(settings.history) { |
|
|
|
|
|
module.verbose('Updating page state', event); |
|
|
$.address.value(tabPath); |
|
|
$.address.value(tabPath); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
|
|
|
module.verbose('Changing tab without state management', event); |
|
|
module.changeTab(tabPath); |
|
|
module.changeTab(tabPath); |
|
|
} |
|
|
} |
|
|
event.preventDefault(); |
|
|
event.preventDefault(); |
|
@ -172,6 +181,12 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
set: { |
|
|
|
|
|
state: function(url) { |
|
|
|
|
|
$.address.value(url); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
changeTab: function(tabPath) { |
|
|
changeTab: function(tabPath) { |
|
|
var |
|
|
var |
|
|
pushStateAvailable = (window.history && window.history.pushState), |
|
|
pushStateAvailable = (window.history && window.history.pushState), |
|
@ -649,7 +664,8 @@ |
|
|
|
|
|
|
|
|
// uses pjax style endpoints fetching content from same url with remote-content headers
|
|
|
// uses pjax style endpoints fetching content from same url with remote-content headers
|
|
|
auto : false, |
|
|
auto : false, |
|
|
history : false, |
|
|
|
|
|
|
|
|
history : true, |
|
|
|
|
|
historyType : 'hash', |
|
|
path : false, |
|
|
path : false, |
|
|
|
|
|
|
|
|
context : 'body', |
|
|
context : 'body', |
|
|