|
@@ -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);}
|