fixe sound direct link with mobile from desktop, fix #584
This commit is contained in:
@@ -13,13 +13,13 @@ use Drupal\Core\Url;
|
||||
* @param array $attachments
|
||||
*/
|
||||
function edlp_ajax_page_attachments(array &$attachments) {
|
||||
// provied info about available urls needed for ajax purpose
|
||||
$url = Url::fromRoute('edlp_ajax.entityjson');
|
||||
$attachments['#attached']['drupalSettings']['edlp_ajax']['entityjson_path'] = $url->getInternalPath();
|
||||
$url = Url::fromRoute('edlp_ajax.blocksjson');
|
||||
$attachments['#attached']['drupalSettings']['edlp_ajax']['blocksjson_path'] = $url->getInternalPath();
|
||||
|
||||
$redirect = false;
|
||||
|
||||
// provied infos about current entity (node or taxonomy term) and audio files
|
||||
$current_path = \Drupal::service('path.current')->getPath();
|
||||
$current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
$is_front = \Drupal::service('path.matcher')->isFrontPage();
|
||||
@@ -49,6 +49,7 @@ function edlp_ajax_page_attachments(array &$attachments) {
|
||||
|
||||
// do not redirect if not node, term, or custom routing
|
||||
// FIXME: check with routes instead of path as path can change !!!
|
||||
$redirect = false;
|
||||
if(preg_match('/^\/?node\/\d+/', $current_path)
|
||||
|| preg_match('/^\/?taxonomy\/term\/\d+/', $current_path)
|
||||
|| preg_match('/^\/?productions/', $current_path)
|
||||
|
||||
@@ -1 +1 @@
|
||||
canvas#corpus-map{position:absolute;box-sizing:border-box;top:0;left:0;z-index:0}canvas#corpus-map.de-activated{background-color:#f4f4f4}div.node-popup{z-index:10;position:absolute;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.6em;outline:red solid 1px;background-color:#fff}div.node-popup:before{content:"";position:absolute;width:60px;height:0;border-top:1px solid red}div.node-popup[pos=bottom-right]{-webkit-transform:translateY(42px) translateX(42px);transform:translateY(42px) translateX(42px)}div.node-popup[pos=bottom-right]:before{top:-1px;left:-61px;-webkit-transform-origin:bottom right;transform-origin:bottom right;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=bottom-left]{-webkit-transform:translateX(-100%) translateY(42px) translateX(-42px);transform:translateX(-100%) translateY(42px) translateX(-42px)}div.node-popup[pos=bottom-left]:before{top:calc(100% +1px);left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}div.node-popup[pos=top-left]{-webkit-transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px);transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px)}div.node-popup[pos=top-left]:before{bottom:0;left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=top-right]{-webkit-transform:translateY(-100%) translateY(-42px) translateX(42px);transform:translateY(-100%) translateY(-42px) translateX(42px)}div.node-popup[pos=top-right]:before{top:calc(100% + 1px);left:-61px;-webkit-transform-origin:top right;transform-origin:top right;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}
|
||||
canvas#corpus-map{position:absolute;box-sizing:border-box;top:0;left:0;z-index:0}canvas#corpus-map.de-activated{background-color:#f4f4f4}div.node-popup{z-index:10;position:absolute;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.6em;outline:red solid 1px;background-color:#fff}div.node-popup:before{content:"";position:absolute;width:60px;height:0;border-top:1px solid red}div.node-popup[pos=bottom-right]{transform:translateY(42px) translateX(42px)}div.node-popup[pos=bottom-right]:before{top:-1px;left:-61px;transform-origin:bottom right;transform:rotateZ(45deg)}div.node-popup[pos=bottom-left]{transform:translateX(-100%) translateY(42px) translateX(-42px)}div.node-popup[pos=bottom-left]:before{top:calc(100% +1px);left:100%;transform-origin:top left;transform:rotateZ(-45deg)}div.node-popup[pos=top-left]{transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px)}div.node-popup[pos=top-left]:before{bottom:0;left:100%;transform-origin:top left;transform:rotateZ(45deg)}div.node-popup[pos=top-right]{transform:translateY(-100%) translateY(-42px) translateX(42px)}div.node-popup[pos=top-right]:before{top:calc(100% + 1px);left:-61px;transform-origin:top right;transform:rotateZ(-45deg)}
|
||||
@@ -52,6 +52,8 @@ function edlp_mobile_help($route_name, RouteMatchInterface $route_match) {
|
||||
|
||||
/**
|
||||
* Implements hook_page_attachments().
|
||||
* the porpuse of this hooks is to collect registered domains informations to set it available to redirect.js file provided by edlptheme
|
||||
* it does nothing by it's own
|
||||
* @param array $attachments
|
||||
*/
|
||||
function edlp_mobile_page_attachments(array &$attachments) {
|
||||
@@ -60,20 +62,19 @@ function edlp_mobile_page_attachments(array &$attachments) {
|
||||
global $base_root;
|
||||
// dpm($base_root, '$base_root');
|
||||
|
||||
// get the current hostname (domain)
|
||||
$current_hostname = preg_replace('/http:\/\/|https:\/\//i', '', $base_root);
|
||||
// dpm($current_hostname, '$current_hostname');
|
||||
|
||||
// get domains from domain module
|
||||
$domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
|
||||
|
||||
$mobile_domain = $domain_storage->load('m_encyclopediedelaparole_org');
|
||||
// dpm($mobile_domain, 'mobile_domain');
|
||||
|
||||
$desktop_domain = $domain_storage->load('encyclopediedelaparole_org');
|
||||
// dpm($desktop_domain, 'desktop_domain');
|
||||
|
||||
$expo_domain = $domain_storage->load('expo_encyclopediedelaparole_org');
|
||||
// dpm($expo_domain, 'expo_domain');
|
||||
|
||||
// get the current domain
|
||||
$current_domain = $domain_storage->loadByHostname($current_hostname);
|
||||
// dpm($current_domain, 'current_domain');
|
||||
|
||||
|
||||
Generated
+477
-447
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ if(_is_mobile){initMobile();}
|
||||
initEvents();_audioPlayer=new AudioPlayer();_compoPlayer=new CompoPlayer();initAjaxLinks();initHistory();if(!_is_mobile){checkLayout();initAudioLinksHover();}
|
||||
if(_is_mobile){if(drupalSettings.path.isFront){initHomeMobile();}
|
||||
_$body.attr('booted','booted');}};function initLogForm(){void 0;_$log_form=$('#user-login-form:not(ajax-enebled)').on('submit',onSubmitLogForm).addClass('ajax-enabled');};function onSubmitLogForm(e){e.preventDefault();var args={name:$('input#edit-name[type="text"]',this).val(),pass:$('input#edit-pass[type="password"]',this).val()};logIn(args).then(logedin);return false;};function logIn(args){void 0;_$log_form.addClass('ajax-loading');_$body.addClass('ajax-loading');return $.ajax({type:'POST',headers:{'Content-Type':'application/json'},xhrFields:{withCredentials:true},url:_origin+_base_url+"user/login?_format=json",data:JSON.stringify(args),success:function(response){_user_tokens=response;},error:function(xhr,ajaxOptions,thrownError){void 0;void 0;}});};function logedin(){$('body').addClass('user-logged-in');getStudioLinkBlock();};function getStudioLinkBlock(){var path=_origin+_base_url+'edlp/ajax/blocks/json/';$.getJSON(path+"studiolinkblock",{}).done(onStudioLinkBlockLoaded).fail(function(jqxhr,textStatus,error){void 0;});};function onStudioLinkBlockLoaded(data){void 0;$('#block-studiouserlogin').replaceWith(data.blocks.studiolinkblock.rendered);initAjaxLinks();refreshFavoritesLinks();_$log_form.removeClass('ajax-loading');_$body.removeClass('ajax-loading');}
|
||||
function initMobile(){$('h2, a','#block-mainnavigation').add('h2, a','#block-mainnavigation-2').on('click',onclickHomeMobileMenu);}
|
||||
function initMobile(){void 0;$('h2, a','#block-mainnavigation').add('h2, a','#block-mainnavigation-2').on('click',onclickHomeMobileMenu);}
|
||||
function onclickHomeMobileMenu(e){$('#block-mainnavigation-2').toggleClass('opened');};function initHomeMobile(){};function initEvents(){var $corpus_df=$.Deferred();_corpus_promise=$corpus_df.promise();_$body.on('corpus-map-ready',function(e){onCorpusMapReady(e);$corpus_df.resolve();}).on('on-studio-chutier-updated',initAjaxLinks).on('studio-initialized',function(e){_compoPlayer.newCompo();}).on('studio-not-active',function(e){_compoPlayer.deactivate();}).on('on-studio-compo-updated',function(e){initAjaxLinks();_compoPlayer.refresh();}).on('on-studio-compo-opened',function(e){initAjaxLinks();_compoPlayer.newCompo();}).on('search-results-loaded',function(e){initAjaxLinks();initAudioLinksHover();checkVisibleCorpusMapSpace();}).on('open_entree',function(e){void 0;closeAllModals();checkLayout();_$body.removeClass();if(typeof e.url!='undefined'){var state=getSysPathState(e.sys_path);history.pushState(state,null,e.url);if(typeof _paq!=='undefined'){_paq.push(['setCustomUrl',e.url]);_paq.push(['setDocumentTitle',e.title]);_paq.push(['trackPageView']);}}}).on('close_entree',function(e){backToFrontPage();checkLayout();});window.addEventListener('resize',checkLayout,false);}
|
||||
function checkLayout(){var $audioplayer=$("#audio-player");if($audioplayer.length){var navpos=$('#block-mainnavigation').position();if(typeof navpos!='undefined'){$audioplayer.css({'width':navpos.left+'px'});}}
|
||||
checkGridBlockHeight();checkGridBlockVisible();};function initScrollbars(){};function getSysPathState(sys_path,view_mode){var state={'sys_path':sys_path,'ajax_path':sys_path};var node_match=state.ajax_path.match(/^\/?(node\/(\d+))$/i);void 0;var term_match=state.ajax_path.match(/^\/?(taxonomy\/term\/(\d+))$/i);void 0;if(node_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+node_match[1];state.node_nid=node_match[2];if(view_mode){state.ajax_path+='/'+view_mode;state.view_mode=view_mode;}}else if(term_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+term_match[1];state.ajax_path=state.ajax_path.replace(/taxonomy\/term/,'taxonomy_term');state.entree_tid=term_match[2];if(view_mode){state.ajax_path+='/'+view_mode;state.view_mode=view_mode;}else{state.ajax_path=null;}}else{state.ajax_path+='/ajax'}
|
||||
@@ -32,12 +32,12 @@ if(_states_history[0].caller=="entree-index"){for(var i=0;i<_states_history.leng
|
||||
if(_states_history[0].caller=="entree-notice"){for(var i=0;i<_states_history.length;i++){if(_states_history[i].context=="entree-notice"){void 0;ajaxLoadContent(_states_history[i]);return;}}}}
|
||||
var $col=$(this).parents('.col');var theme=$col.attr('theme');if(theme!=''){_$body.trigger({'type':theme+'-col-closed'});}
|
||||
if(_$body.is('.entity-type-node.bundle-page')&&$(this).next().is('.node--type-page')){$col.add($col.siblings('.col')).remove();}else{$col.remove();}
|
||||
checkRowEmpty();checkVisibleCorpusMapSpace();if($col.attr('view_mode')&&$col.attr('sys_path')){$('a[data-drupal-link-system-path="'+$col.attr('sys_path')+'"][viewmode="'+$col.attr('view_mode')+'"]').removeClass('is-active');}};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;void 0;var edlp_origin=JSON.parse(window.localStorage.getItem('edlp_origin'));void 0;if(edlp_origin!=null&&edlp_origin.sys_path){var hash=edlp_origin.hash.replace('#','');var state=getSysPathState(edlp_origin.sys_path,hash);if(edlp_origin.entity_type=="taxonomy_term"&&edlp_origin.entity_bundle=="entrees"&&hash){state.selector='entree-'+hash+'-link-'+edlp_origin.entity_id;if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:edlp_origin.entity_id});}else{$('li.entree[tid="'+edlp_origin.entity_id+'"] a.term-link').addClass('is-active');}}
|
||||
if(edlp_origin.audio_url){var node={nid:edlp_origin.entity_id,audio_url:edlp_origin.audio_url};_audioPlayer.openDocument(node,'history_first_load');closeAllModals();if(hash==""||hash=='random'){state.audio=true;state.node=node;_$body.attr('booted','booted');}else{ajaxLoadContent(state);}}
|
||||
checkRowEmpty();checkVisibleCorpusMapSpace();if($col.attr('view_mode')&&$col.attr('sys_path')){$('a[data-drupal-link-system-path="'+$col.attr('sys_path')+'"][viewmode="'+$col.attr('view_mode')+'"]').removeClass('is-active');}};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;void 0;var edlp_origin=JSON.parse(window.localStorage.getItem('edlp_origin'));void 0;if(edlp_origin!=null&&edlp_origin.sys_path){var hash=edlp_origin.hash.replace('#','');var state=getSysPathState(edlp_origin.sys_path,hash);state.historic_index=0;if(edlp_origin.entity_type=="taxonomy_term"&&edlp_origin.entity_bundle=="entrees"&&hash){state.selector='entree-'+hash+'-link-'+edlp_origin.entity_id;if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:edlp_origin.entity_id});}else{$('li.entree[tid="'+edlp_origin.entity_id+'"] a.term-link').addClass('is-active');}}
|
||||
if(edlp_origin.audio_url){var node={nid:edlp_origin.entity_id,audio_url:edlp_origin.audio_url};_audioPlayer.openDocument(node,'history_first_load');closeAllModals();if(hash==""||hash=='random'){void 0;state.audio=true;state.node=node;if(!_is_mobile){_$body.attr('booted','booted');}else{ajaxLoadContent(state);}}else{void 0;ajaxLoadContent(state);}}
|
||||
else if(state.ajax_path){ajaxLoadContent(state);}
|
||||
if(state.entree_tid){openEntree(state.entree_tid);}
|
||||
history.replaceState(state,null,edlp_origin.url+edlp_origin.hash);window.localStorage.removeItem("edlp_origin");}else{history.replaceState({home:true},null,window.location.pathname+window.location.hash);initGrid();_$body.attr('booted','booted');}};function onHistoryPopState(e){void 0;if(e.state.home){backToFrontPage(true);}
|
||||
else if(e.state.audio){_audioPlayer.openDocument(e.state.node,'popstate',e.state.historic_index);}
|
||||
else if(e.state.audio){void 0;_audioPlayer.openDocument(e.state.node,'popstate',e.state.historic_index);if(_is_mobile){ajaxLoadContent(e.state)}}
|
||||
else{if(e.state.entree_tid){openEntree(e.state.entree_tid);}
|
||||
if(e.state.ajax_path){e.state.url=null;ajaxLoadContent(e.state);}}};function initAjaxLinks(){$('a','#block-mainnavigation').add('a','#block-mainnavigation-2').add('a','#block-footer.menu--footer').add('a','#block-productions').add('a','article.node:not(.node--type-enregistrement) h2.node-title').add('a','.productions-subtree').add('a','.productions-parent').add('a','.field--name-field-son').addClass('ajax-link');if(!_is_mobile){$('a.site-name','#block-edlptheme-branding').addClass('ajax-link');}
|
||||
_$ajaxLinks=$('.ajax-link');activateAjaxLinks();};function activateAjaxLinks(){_$ajaxLinks.each(function(i,e){var $this=$(this);if($this.is('.ajax-enable'))return;if($this.attr('data-drupal-link-system-path')||$this.is('[type^="audio"]')){$this.on('click',onClickAjaxLink).addClass('ajax-enable');}});};function onClickAjaxLink(e){e.preventDefault();var $link=$(this);if($link.is('.is-active')&&!$link.is('.site-name'))
|
||||
@@ -63,7 +63,7 @@ this.$previous.on('click',this.playPrevious.bind(this));this.$playpause.on('clic
|
||||
if(typeof caller=='undefined'||caller!='popstate'){void 0;this.historic.push(node);this.currentHistoricIndex=this.historic.length-1;if(caller!="history_first_load"){if(typeof node.document_url=='undefined'){void 0;}else{var state={audio:true,node:{nid:node.nid,audio_url:node.audio_url,document_url:node.document_url,title:node.title||null,},historic_index:this.currentHistoricIndex,};var url=node.document_url+(caller=='random'?'#random':'');history.pushState(state,null,url);}}}else{this.currentHistoricIndex=historic_index;}
|
||||
if(_$body.is('.path-frontpage')&&caller!=='lastdocs'&&!_is_mobile){closeAllModals();}
|
||||
this.emmit('audio-open-document',{caller:caller});if(typeof _paq!=='undefined'){if(typeof node.title!='undefined'){_paq.push(['trackEvent','Audio','play',node.title]);}}
|
||||
this.launch();},launch(){this.clearTimeOutToHide();this.clearIntervalAutoCartelSwitch();this.setSRC(this.historic[this.currentHistoricIndex].audio_url);if(!_is_mobile){this.loadNode(this.historic[this.currentHistoricIndex].nid);}
|
||||
this.launch();},launch(){this.clearTimeOutToHide();this.clearIntervalAutoCartelSwitch();void 0;void 0;this.setSRC(this.historic[this.currentHistoricIndex].audio_url);if(!_is_mobile){this.loadNode(this.historic[this.currentHistoricIndex].nid);}
|
||||
try{_$corpus_canvas.trigger({'type':'audio-node-opened','nid':this.historic[this.currentHistoricIndex].nid});}catch(e){void 0;var that=this;_corpus_promise.done(function(){_$corpus_canvas.trigger({'type':'audio-node-opened','nid':that.historic[that.currentHistoricIndex].nid});});}
|
||||
this.showHidePreviousBtn();this.showHideNextBtn();this.show();},openSound(url,title){this.hide();this.clearTimeOutToHide();this.$cartel.html("");this.setSRC(url);this.show();if(typeof _paq!=='undefined'){_paq.push(['trackEvent','Audio','play',url]);}},setSRC(url){void 0;this.audio.src=url;this.play();},onLoadedmetadata(){var rem=parseInt(this.audio.duration,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$duration.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');this.updateLoadingBar();},updateLoadingBar(){void 0;if(this.audio.buffered.length>0){this.$loader.css({'width':parseInt((100*this.audio.buffered.end(0)/this.audio.duration),10)+'%'});if(this.audio.buffered.end(0)<this.audio.duration){window.requestAnimationFrame(this.updateLoadingBar.bind(this));}else{void 0;}}else{window.requestAnimationFrame(this.updateLoadingBar.bind(this));}},onError(){void 0;},play(){this.clearTimeOutToHide();var promise=this.audio.play();if(promise!==undefined){promise.catch(function(error){void 0;}).then(function(){void 0;});}},playPrevious(){if(this.currentHistoricIndex>0){this.currentHistoricIndex-=1;this.launch();}},playNext(){if(this.currentHistoricIndex<this.historic.length-1){this.currentHistoricIndex+=1;this.launch();}else{this.emmit('audio-play-next');}},togglePlayPause(e){if(this.audio.paused){this.play();}else{this.stop();}},stop(){this.audio.pause();if(!(_$body.is('.path-node-'+this.historic[this.currentHistoricIndex].nid)&&(_$body.is('.view-mode-article')||_$body.is('.view-mode-transcript')))){this.timeOutToHide();}},seek(e){var seek=e.originalEvent.layerX/this.timeline_w*this.audio.duration
|
||||
void 0;this.audio.currentTime=seek;},seekToEnd(){if(this.audio.duration>40){void 0;this.audio.currentTime=this.audio.duration-20;}},onPlaying(){this.$btns.addClass('is-playing');this.emmit('audio-play');},onPause(){this.$btns.removeClass('is-playing');this.emmit('audio-pause');},onTimeupdate(){this.$cursor.css({'left':(this.audio.currentTime/this.audio.duration*this.timeline_w)+"px"});var rem=parseInt(this.audio.currentTime,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$currentTime.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');},onEnded(){void 0;this.stop();this.emmit('audio-ended');},reloadNode(){if(this.visible){if(!_is_mobile){void 0;this.loadNode(this.historic[this.currentHistoricIndex].nid);}}},loadNode(nid){this.$cartel.addClass('loading');var vm='player_cartel';var ajax_path=_ajax_settings.entityjson_path+'/node/'+nid+'/'+vm;var path=_origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(this.onNodeLoaded.bind(this)).fail(this.onNodeLoadFail.bind(this));},onNodeLoaded(data){void 0;this.$cartel.html(data.rendered).removeClass('loading');_$body.trigger({'type':'new-audio-cartel-loaded'});initAjaxLinks();this.scndCartel_visible=0;this.$cartel.removeClass('second-visible');if(!_is_expo){if(this.$cartel.find('.second-cartel .col-left').children().length>1||this.$cartel.find('.second-cartel').children('.col-right').length){this.cartelSwitchInterval=setInterval(this.switchCartel.bind(this),this.cartelSwitchIntervalMS);}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
void 0;function checkMobile(){var user_agent=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge|maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(user_agent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(user_agent.substr(0,4));}
|
||||
if(typeof edlp_mobile!="undefined"){var device_redirect=false;var device_is_mobile=checkMobile();edlp_mobile.device_is_mobile=device_is_mobile;switch(true){case(device_is_mobile&&!edlp_mobile.is_mobile_domain):device_redirect=true;window.location.replace(window.location.protocol+'//'+edlp_mobile.mobile_url);break;case(edlp_mobile.is_mobile_domain&&!device_is_mobile):device_redirect=true;window.location.replace(window.location.protocol+'//'+edlp_mobile.desktop_url);break;default:break;}
|
||||
if(typeof edlp_mobile!="undefined"){var device_redirect=false;var device_is_mobile=checkMobile();edlp_mobile.device_is_mobile=device_is_mobile;switch(true){case(device_is_mobile&&!edlp_mobile.is_mobile_domain):device_redirect=true;window.location.replace(window.location.protocol+'//'+edlp_mobile.mobile_url+location.pathname);break;case(edlp_mobile.is_mobile_domain&&!device_is_mobile):device_redirect=true;window.location.replace(window.location.protocol+'//'+edlp_mobile.desktop_url);break;default:break;}
|
||||
if(device_is_mobile){document.documentElement.className+="is-mobile";}}
|
||||
if(edlp.redirect&&!device_redirect&&!device_is_mobile){void 0;void 0;edlp.sys_path=edlp.sys_path.replace(/^\//,'');edlp.url=window.location.pathname;edlp.hash=window.location.hash;window.localStorage.setItem('edlp_origin',JSON.stringify(edlp));window.location.replace(window.location.origin+'/'+edlp.lang_code+edlp.hash);}else{void 0;}
|
||||
if(edlp.redirect&&!device_redirect){void 0;void 0;edlp.sys_path=edlp.sys_path.replace(/^\//,'');edlp.url=window.location.pathname;edlp.hash=window.location.hash;window.localStorage.setItem('edlp_origin',JSON.stringify(edlp));window.location.replace(window.location.origin+'/'+edlp.lang_code+edlp.hash);}else{void 0;}
|
||||
@@ -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