|
@@ -1,11 +1,13 @@
|
|
|
|
|
|
(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();}
|
|
|
+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 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 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);}}
|