fixe sound direct link with mobile from desktop, fix #584

This commit is contained in:
2020-04-29 13:01:16 +02:00
parent 2eb05babe5
commit 67271fc277
8 changed files with 520 additions and 468 deletions
@@ -136,6 +136,7 @@
// | |\/| / _ \ '_ \ | / -_)
// |_| |_\___/_.__/_|_\___|
function initMobile(){
console.log('initMobile');
// $('[data-drupal-link-system-path="<front>"]','#block-mainnavigation')
// .removeClass('is-active')
// .attr('href', '#collection');
@@ -145,10 +146,10 @@
// TODO: remove collection from mobile home
// TODO: replace ajax link to only collection for mobile
$('h2, a', '#block-mainnavigation')
.add('h2, a', '#block-mainnavigation-2')
.on('click', onclickHomeMobileMenu);
}
function onclickHomeMobileMenu(e){
// $('#block-mainnavigation').toggleClass('opened');
@@ -722,6 +723,9 @@
// create history state
var state = getSysPathState(edlp_origin.sys_path, hash);
// add historic_index 0 to state
state.historic_index = 0;
// open entree tray in case of entree index|notice
// (index or notice will be opened with ajaxLoadContent)
// refactorized with new infos from edlp_origin
@@ -764,13 +768,19 @@
// close home
closeAllModals();
if(hash == "" || hash == 'random'){
console.log('first load hash', hash);
// if hash is random, RandomPlayer will be started when playlist sent by corpus.js
// if audio only record in state
state.audio = true;
state.node = node;
// we don't laod ajax content so we boot the home
_$body.attr('booted', 'booted');
if(!_is_mobile){
// if not mobile we don't laod ajax content so we boot the home
_$body.attr('booted', 'booted');
}else{
ajaxLoadContent(state);
}
}else{
console.log('first load load content');
// ajax load content for audio only if article or transcript
ajaxLoadContent(state);
}
@@ -809,7 +819,11 @@
backToFrontPage(true);
}
else if (e.state.audio) {
_audioPlayer.openDocument(e.state.node, 'popstate', e.state.historic_index);
console.log('popstate audio : e.state', e.state);
_audioPlayer.openDocument(e.state.node, 'popstate', e.state.historic_index);
if(_is_mobile){
ajaxLoadContent(e.state)
}
}
else{
if(e.state.entree_tid){
@@ -1205,7 +1219,7 @@
this.$next.on('click', this.playNext.bind(this));
},
openDocument(node, caller, historic_index){
console.log('AudioPlayer openDocument', node, caller);
console.log('AudioPlayer openDocument', node, caller, historic_index);
if(typeof node == 'undefined'
|| typeof node.nid == 'undefined'
|| typeof node.audio_url == 'undefined'){
@@ -1275,6 +1289,8 @@
launch(){
this.clearTimeOutToHide();
this.clearIntervalAutoCartelSwitch();
console.log('this.historic', this.historic);
console.log('this.currentHistoricIndex', this.currentHistoricIndex);
this.setSRC(this.historic[this.currentHistoricIndex].audio_url);
if(!_is_mobile){
this.loadNode(this.historic[this.currentHistoricIndex].nid);