fixed back to home mobile #423

This commit is contained in:
2020-07-21 10:27:27 +02:00
parent 7883e40c9a
commit 11d54412cd
2 changed files with 26 additions and 20 deletions
@@ -829,7 +829,7 @@
}
};
function onHistoryPopState(e){
console.log('onPopState',e.state);
console.log('onHistoryPopState',e.state);
if(e.state.home){
backToFrontPage(true);
}
@@ -2247,25 +2247,31 @@
// |___/
function backToFrontPage(pop_state){
console.log('backToFrontPage', pop_state);
closeAllModals();
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees
if(_corpus_ready){
_$corpus_canvas.trigger({'type':'close-all-entree'});
_$corpus_canvas.trigger({'type':'scramble-collection'});
}
if(typeof pop_state == "undefined" || !pop_state){
console.log('backToFrontPage push state');
state = {
home:true,
context:"home",
caller:null
if(!_is_mobile){
closeAllModals();
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees
if(_corpus_ready){
_$corpus_canvas.trigger({'type':'close-all-entree'});
_$corpus_canvas.trigger({'type':'scramble-collection'});
}
_states_history.unshift(state);
history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
if(typeof pop_state == "undefined" || !pop_state){
console.log('backToFrontPage push state');
state = {
home:true,
context:"home",
caller:null
}
_states_history.unshift(state);
history.pushState(state, null, _base_url+drupalSettings.path.currentLanguage);
}
}else{
// if mobile reload the front page
ajaxLoadContent({home: true, ajax_path: 'home_m/ajax', sys_path: 'frontpage'});
}
}