(function($,Drupal,drupalSettings){EdlpTheme=function(){var _origin=window.location.origin;var _base_url=drupalSettings.path.baseUrl;var _ajax_settings=drupalSettings.edlp_ajax;var _$body=$('body');var _corpus_ready=false;var _$corpus_canvas;var _$row=$('main[role="main"]>.layout-content>.row');var _$ajaxLinks;var _audioPlayer;var _randomPlayer;var _compoPlayer;var _ajax_timing={start:0,end:0};var _corpus_promise;var _is_mobile=edlp_mobile.device_is_mobile;var _is_loggedin=drupalSettings.user.uid===0?false:true;var _$log_form;var _user_tokens;var _states_history=[];var _is_expo=$('body').hasClass('domain-expo-encyclopediedelaparole-org');function init(){void 0;if(!_is_loggedin){initLogForm();} if(_is_mobile){initMobile();}else if(drupalSettings.path.isFront){initDesktopHome();} 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(){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 initDesktopHome(){void 0;var $prods=$('.grid .col .node--type-page');$r=Math.floor(Math.random()*$prods.length);$prods.each(function(index){if(index!=$r){$(this).parents('.col').remove();}});void 0;} 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';} return state;};function ajaxLoadContent(state){void 0;_$body.addClass('ajax-loading');_ajax_timing.start=performance.now();var path=_origin+Drupal.url(state.ajax_path);$.getJSON(path,{}).done(function(data){onAjaxLoaded(data,state);}).fail(function(jqxhr,textStatus,error){onAjaxLoadError(jqxhr,textStatus,error,state.sys_path);});};function onAjaxLoadError(jqxhr,textStatus,error,sys_path){void 0;$('.ajax-loading').removeClass('ajax-loading');_$body.removeClass('ajax-loading');};function onAjaxLoaded(data,state){void 0;var $rendered=$(data.rendered);$rendered.attr({'sys_path':state.sys_path,'view_mode':state.view_mode});if(data.entity_type=="node"&&data.bundle=="evenement"){if(_$row.find('.col.event').length){_$row.find('.col.event').replaceWith($rendered);}else if(_$row.find('.col.aside').length){_$row.find('.col.aside').replaceWith($rendered);}else{_$row.append($rendered);}}else if((state.context=='document-transcript'||state.context=='document-artcile')&&state.caller=="search"){_$row.append($rendered);}else{_$row.removeAttr('style').html($rendered);} if(data.entity_type=="node"&&data.bundle=="static"||state.sys_path=="docsindex"){$('.ajax-link.is-active.articles-link').removeClass('is-active');} var body_classes=['path-'+state.sys_path.replace(/\//g,'-'),'entity-type-'+data.entity_type,'bundle-'+data.bundle,'view-mode-'+data.view_mode];_$body.removeClass().addClass(body_classes.join(' '));if(state.node_nid)_$body.addClass('path-edlp-node');$('.ajax-loading').removeClass('ajax-loading');$('.ajax-link.is-active:not(.articles-link)').removeClass('is-active');$('.is-active-trail').removeClass('is-active-trail');if(typeof state.selector!='undefined'){void 0;$('a[selector="'+state.selector+'"]').addClass('is-active');initAudioLinksHover();}else{if(typeof state.view_mode!='undefined'){$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');}else{_corpus_promise.done(function(){$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');});} _$body.trigger({'type':'new-content-not-entree-ajax-loaded'});} if(typeof data.bundle!='undefined'&&data.bundle=="page"){$('a[data-drupal-link-system-path="productions"]').addClass('is-active-trail');} if(typeof data.menu_parents!='undefined'){for(var i=0;i').addClass('close-col-btn').on('click',onCloseModal));});};function onCloseModal(e){void 0;void 0;if(['document-transcript','document-article'].indexOf(_states_history[0].context)!=-1){if(_states_history[0].caller=="production"){for(var i=0;i<_states_history.length;i++){if(_states_history[i].context=="production"){void 0;ajaxLoadContent(_states_history[i]);return;}}} if(_states_history[0].caller=="entree-index"){for(var i=0;i<_states_history.length;i++){if(_states_history[i].context=="entree-index"){void 0;ajaxLoadContent(_states_history[i]);return;}}} 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);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){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-edlptheme-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'))return false;if($link.is('.audio-link')){caller=$link.parents('.lastdocs, .lastdocs-home').length?'lastdocs':null;if(!caller){caller=$link.parents('.composition_ui').length?'studio-compo':null;} if(caller=='studio-compo'){var index=$link.parents('.field__item').index();void 0;_compoPlayer.start(index);}else{_audioPlayer.emmit('stop-shuffle').openDocument({nid:$link.attr('nid'),audio_url:$link.attr('audio_url'),title:$link.find('.field--name-title').html()},caller);} return false;} if($link.is('[type^="audio"]')){_audioPlayer.emmit('stop-shuffle').openSound($link.attr('href'),$link.html());return false;} var sys_path=$(this).attr('data-drupal-link-system-path');if(sys_path==''){if(!_is_mobile){if($link.is('.is-active')&&_corpus_ready){_$corpus_canvas.trigger({'type':'shuffle-collection'});}else{backToFrontPage();} return false;}} var view_mode=$link.attr('viewmode');var state=getSysPathState(sys_path,view_mode);state.url=$(this).attr('href');if(view_mode){state.url+="#"+view_mode;} var contexts=/^.*\/(productions|documents|entrees|search)(\/.*)?/g.exec(state.url);void 0;if(contexts){switch(contexts[1]){case'productions':state.context="production";break;case'entrees':switch(view_mode){case'index':state.context="entree-index";break;case'notice':state.context="entree-notice";break;} break;case'search':state.context="search";break;case'documents':switch(view_mode){case'transcript':state.context="document-transcript";break;case'article':state.context="document-article";break;default:state.context="document";} if(typeof _states_history[0]!="undefined"){if(_states_history[0].caller){state.caller=_states_history[0].caller;}else{state.caller=_states_history[0].context;}}else{state.caller=null;} break;}}else{state.context=null;} if($link.is('[selector]')){state.selector=$link.attr('selector');} $link.addClass('ajax-loading');ajaxLoadContent(state);return false;};function refreshFavoritesLinks(){void 0;_audioPlayer.reloadNode();if(_states_history[0].view_mode=='index'||_states_history[0].sys_path=="docsindex"){ajaxLoadContent(_states_history[0]);}} function onCorpusMapReady(e){_corpus_ready=true;_$corpus_canvas=$('canvas#corpus-map');_$corpus_canvas.on('corpus-cliked-on-map',function(e){backToFrontPage();}).on('corpus-cliked-on-node',function(e){_audioPlayer.emmit('stop-shuffle').openDocument(e.target_node);});_randomPlayer=new RandomPlayer(e.playlist);if(_is_expo){initExpo();} initAjaxLinks();_$body.attr('corpus-map','ready');} function openEntree(tid){if(tid){closeAllModals();_$body.removeClass();if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:tid});}else{$('li.entree[tid="'+tid+'"] a.term-link').addClass('is-active');}}};function checkVisibleCorpusMapSpace(){var left_limit=0,right_limit=0;_$row.find('.col').each(function(i,e){var $col=$(this);var offset=$col.offset();void 0;switch(true){case $col.is('.float-right'):right_limit=Math.max(right_limit,Math.abs(offset.left-15-window.innerWidth));break;default:left_limit=Math.max(left_limit,offset.left+$col.width()+15);break;}});void 0;if(_corpus_ready){_$body.trigger({type:'visible-space-changed',left_limit:left_limit,right_limit:right_limit});}else{_corpus_promise.done(function(){_$body.trigger({type:'visible-space-changed',left_limit:left_limit,right_limit:right_limit});});}};function AudioPlayer(){var that=this;this.fid;this.audio=new Audio();this.audio_events=["loadedmetadata","playing","pause","timeupdate","ended","error"];this.$container=$('
');this.$btns=$('
').addClass('btns').appendTo(this.$container);this.$previous=$('
').addClass('previous').appendTo(this.$btns);this.$playpause=$('
').addClass('play-pause').appendTo(this.$btns);this.$next=$('
').addClass('next').appendTo(this.$btns);this.$timelinecont=$('
').addClass('time-line-container').appendTo(this.$container);this.$timeline=$('
').addClass('time-line').appendTo(this.$timelinecont);this.$loader=$('
').addClass('loader').appendTo(this.$timeline);this.$cursor=$('
').addClass('cursor').appendTo(this.$timeline);this.$time=$('
').addClass('time').appendTo(this.$container);this.$currentTime=$('
').addClass('current-time').html('00:00').appendTo(this.$time);this.$duration=$('
').addClass('duration').html('00:00').appendTo(this.$time);this.$fav=$('
').addClass('favoris').appendTo(this.$container);this.$cartel=$('
').addClass('cartel').appendTo(this.$container);this.scndCartel_visible=0;this.cartelSwitchIntervalMS=7000;this.cartelSwitchInterval=false;this.visible=false;this.hideTimer=false;this.hideTimeMS=15000;this.currentHistoricIndex=null;this.historic=[];this.shuffle_is_active=false;this.auto_open_article=false;this.event_handlers={'audio-open-document':[],'audio-play':[],'audio-pause':[],'audio-play-next':[],'audio-ended':[],'stop-shuffle':[]};this.init();};AudioPlayer.prototype={init(){if(!_is_expo){this.$container_parent=$('header[role="banner"] .region-header');}else{this.$container_parent=$('main[role="main"]');} this.$container.appendTo(this.$container_parent);this.timeline_w=parseInt(this.$timeline.width());this.$loader.on('click',this.seek.bind(this));var fn='';for(var i=0;i'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'');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)0){this.currentHistoricIndex-=1;this.launch();}},playNext(){if(this.currentHistoricIndex40){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(''+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'');},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);} void 0;Drupal.attachBehaviors(this.$cartel.get(0));} this.setAutoOpenArticle();if(this.auto_open_article){this.$cartel.find('a.link-article').trigger('click');this.auto_open_article=false;}},onNodeLoadFail(jqxhr,textStatus,error){void 0;this.$cartel.removeClass('loading').html('');},setAutoOpenArticle(art){this.auto_open_article=$('a.articles-link').is('.is-active');return this;},show(){this.visible=true;this.$container_parent.addClass('audio-player-visible');this.$container.addClass('visible');},showHidePreviousBtn(){if(this.historic.length>1&&this.currentHistoricIndex>0){this.$previous.addClass('is-active');}else{this.$previous.removeClass('is-active');}},showHideNextBtn(){if(this.currentHistoricIndex=0;i--){handler=this.event_handlers[event_name][i];(function(handler,args){setTimeout(function(){handler(args);},0);})(handler,args);} return this;}};function RandomPlayer(playlist){this.active=false;this.playlist=playlist;this.path=_base_url+drupalSettings.path.pathPrefix+'#random';this.$btn=$('').html('Shuffle').attr('href',this.path).attr('alt',drupalSettings.edlp_corpus.random_link_title).addClass('random-player-btn');this.init();};RandomPlayer.prototype={init(){$('
').addClass('block random-player').append(this.$btn).prependTo('.region-footer-right');this.$btn.on('click',this.toggleActive.bind(this));_audioPlayer.on('audio-play-next',this.onAudioPlayNext.bind(this)).on('audio-ended',this.onAudioPlayerEnded.bind(this)).on('stop-shuffle',this.stop.bind(this));_$corpus_canvas.on('update-random-playlist',this.updatePlaylist.bind(this));if(window.location.hash=='#random'){this.start();}},updatePlaylist(e){if(!_is_expo){this.playlist=e.playlist;this.shuffle();}},shuffle(){var tempPLaylist=[];for(var i=this.playlist.length-1;i>=0;i--){tempPLaylist.push(this.playlist[i]);} this.shuffledPlaylist=[];while(tempPLaylist.length>0){var r=Math.floor(Math.random()*tempPLaylist.length);this.shuffledPlaylist.push(tempPLaylist.splice(r,1)[0]);}},toggleActive(e){e.preventDefault();if(this.active){this.stop();}else{this.start();} return false;},start(){this.active=_audioPlayer.shuffle_is_active=true;this.$btn.addClass('is-active');this.shuffle();this.next();if(typeof _paq!=='undefined'){_paq.push(['trackEvent','RandomPlayer','start']);}},stop(){this.active=false;this.$btn.removeClass('is-active');history.replaceState(history.state,null,window.location.pathname);_audioPlayer.deActivateRandom();if(typeof _paq!=='undefined'){_paq.push(['trackEvent','RandomPlayer','stop']);}},next(){void 0;if(this.active){if(this.shuffledPlaylist.length==0){this.shuffle();} _audioPlayer.openDocument(this.shuffledPlaylist.splice(0,1)[0],'random');}},onAudioPlayNext(){void 0;if(this.active){this.next();}},onAudioPlayerEnded(){void 0;if(this.active){this.next();if(_is_expo){_$corpus_canvas.trigger({'type':'scramble-collection'});}}}};function CompoPlayer(){this.active=false;this.playing=false;this.paused=false;this.playlist=[];this.current_index=0;this.$composer=null;this.$compo=null;this.$controls=null;this.init();};CompoPlayer.prototype={init(){_audioPlayer.on('audio-open-document',this.onAudioOpenDocument.bind(this)).on('audio-play',this.onAudioPlayerPlay.bind(this)).on('audio-pause',this.onAudioPlayerPause.bind(this)).on('audio-ended',this.onAudioPlayerEnded.bind(this));},newCompo(){void 0;this.initControls();},initControls(){this.$composer=$('.composition_ui .composer');this.$compo=$('.composition_ui .composer .composition');this.$controls=$('.composition_ui .composer .compo-player-controls');if(!this.$controls.is('.ready')&&this.$compo){this.$previous=$('
').addClass('previous').on('click',this.prev.bind(this)).appendTo(this.$controls);this.$playpause=$('
').addClass('play-pause').on('click',this.togglePlayPause.bind(this)).appendTo(this.$controls);this.$next=$('
').addClass('next').on('click',this.next.bind(this)).appendTo(this.$controls);this.$controls.addClass('ready');this.active=true;} this.refresh();},refresh(){this.stop();this.playlist=[];var that=this;$('.field--name-documents .field__item',this.$compo).each(function(i,el){var $link=$('a.audio-link',this);that.playlist.push({item:$(this),audio_url:$link.attr("audio_url"),nid:$link.attr("nid")});});this.showHideControls();},togglePlayPause(){if(this.playing&&!this.paused){this.pause();}else{if(this.playing&&this.paused){this.play();}else{this.start();}}},start(i){this.current_index=i||0;this.playing=true;this.play();},play(){void 0;if(this.paused){this.paused=false;_audioPlayer.play();}else{void 0;_audioPlayer.emmit('stop-shuffle').openDocument(this.playlist[this.current_index],this);} this.setActiveItem().showHideControls();},pause(){this.paused=true;this.showHideControls();_audioPlayer.stop();},next(){void 0;if(this.playing){this.current_index+=1;if(this.current_index=0){this.play();}else{this.stop();}}},stop(){if(this.playing){_audioPlayer.stop();} this.reset();},reset(){this.playing=false;this.paused=false;this.resetIndex();},resetIndex(){this.current_index=0;this.showHideControls().resetActiveItems();},setActiveItem(){this.resetActiveItems();if(this.playing&&this.current_index>=0){this.playlist[this.current_index].item.addClass('is-active');} this.showHideControls();return this;},resetActiveItems(){for(var n=0;n0){this.$playpause.addClass('is-active');}else{this.$playpause.removeClass('is-active');}} if(this.$next){if(this.playing&&this.playlist.length>1&&this.current_index1&&this.current_index>0){this.$previous.addClass('is-active');}else{this.$previous.removeClass('is-active');}} return this;},deactivate(){this.stop();this.active=false;},onAudioOpenDocument(args){void 0;if(args.caller!==this){this.reset();}},onAudioPlayerPlay(){if(this.playing&&this.paused){this.paused=false;this.showHideControls();}},onAudioPlayerPause(){if(this.playing&&!this.paused){this.paused=true;this.showHideControls();}},onAudioPlayerEnded(){void 0;if(this.playing){this.paused=false;this.next();}}};function initExpo(){void 0;document.title=edlp.site_name;if(window.location.hash=='#black'){$('body').addClass('expo-black');} _$body.on('map-node-opened',checkExpoPlayerPositionning);_randomPlayer.start();initKeyboard();} function checkExpoPlayerPositionning(e){void 0;switch(true){case e.node.x>window.innerWidth-610&&e.node.y<200:_audioPlayer.$container.attr('pos','bottom-left');break;case e.node.x>window.innerWidth-610:_audioPlayer.$container.attr('pos','top-left');break;case e.node.y<200:_audioPlayer.$container.attr('pos','bottom-right');break;default:_audioPlayer.$container.attr('pos','top-right');} _audioPlayer.$container.css({'display':"block",'left':e.node.x+"px",'top':e.node.y+"px"});} function initKeyboard(){$(document).bind('keyup','alt+n',function(){_randomPlayer.next();});} function initGrid(){void 0;if(!_is_mobile){checkGridBlockHeight();_$row.find('.col').addClass('offfield');} if(false){var $grid=$('.grid',_$row).masonry({itemSelector:'.col',columnWidth:'.col-2',containerStyle:null,resizeContainer:false,transitionDuration:0});$grid.imagesLoaded().progress(function(){$grid.masonry('layout');});$grid.imagesLoaded(function(){$grid.masonry('layout');});$grid.on('layoutComplete',checkGridBlockVisible);}else{if(!_is_mobile){checkGridBlockVisible();}}};function checkGridBlockHeight(){var $r_h=_$row.height();var $this;$('.grid .col',_$row).each(function(i,e){$this=$(this);if(!$this.is('[init-height]')){$this.attr('init-height',$this.outerHeight());} $this.height(Math.min($this.attr('init-height'),_$row.height()));});};function checkGridBlockVisible(){var $r_h=_$row.height();var $this,pos;$('.grid .col',_$row).each(function(i,e){$this=$(this);pos=$this.position();if(pos.top+$this.height()<=$r_h){$this.removeClass('offfield');}else{$this.addClass('offfield');}});} function initCollectionNav(){void 0;$('.field--name-field-notice, .index','.taxonomy-term.vocabulary-entrees.home_mobile').addClass('closed');$('.field--name-field-notice>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionNotice);$('.index>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionIndex);};function onClickCollectionNotice(e){toggleEntreeOpening($(this).parent(),'notice');};function onClickCollectionIndex(e){toggleEntreeOpening($(this).parent(),'index');};function toggleEntreeOpening($e,part){$e.toggleClass('closed').parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');} function initSearch(){$('#edit-entries--wrapper legend','#edlp-search-form').on('click',function(){$(this).parent().toggleClass('opened');});};function initEnregistrementTranscript(){void 0;var $node=_$row.find('article.node--type-enregistrement.node--view-mode-transcript');var $nav=$('