fixe sound direct link with mobile from desktop, fix #584
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -6,6 +6,9 @@ function checkMobile(){
|
||||
}
|
||||
|
||||
// var edlp_mobile is provided by edlp_mobile.module file
|
||||
// TODO: edlp_mobile should be called edlp_domains
|
||||
// if device is mobile but domain not, redirect to mobile domain
|
||||
// if device is desktop but domain is mobile, redirect to desktop domain
|
||||
if(typeof edlp_mobile != "undefined"){
|
||||
// console.log(edlp_mobile);
|
||||
// console.log('window.location', window.location);
|
||||
@@ -19,7 +22,8 @@ if(typeof edlp_mobile != "undefined"){
|
||||
// console.log('redirect to mobile domain', window.location.protocol +'//'+ edlp_mobile.mobile_url);
|
||||
device_redirect = true;
|
||||
// redirect to mobile domain
|
||||
window.location.replace(window.location.protocol +'//'+ edlp_mobile.mobile_url);
|
||||
// TODO: preserve params
|
||||
window.location.replace(window.location.protocol +'//'+ edlp_mobile.mobile_url + location.pathname);
|
||||
break;
|
||||
case (edlp_mobile.is_mobile_domain && !device_is_mobile):
|
||||
// console.log('redirect to desktop domain', window.location.protocol +'//'+ edlp_mobile.desktop_url);
|
||||
@@ -37,7 +41,7 @@ if(typeof edlp_mobile != "undefined"){
|
||||
}
|
||||
|
||||
// var edlp is provided by edlp_ajax.module file
|
||||
if(edlp.redirect && !device_redirect && !device_is_mobile){
|
||||
if(edlp.redirect && !device_redirect){ // && !device_is_mobile
|
||||
console.log('redirect', edlp);
|
||||
console.log('window.location', window.location);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user