diff --git a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js index 11e060090..6e67d7c6e 100644 --- a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js +++ b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js @@ -16,14 +16,14 @@ if(typeof data.translations_links!='undefined'){void 0;var lang_code=drupalSetti $('ul','.block.language-switcher-language-url').replaceWith($links);} initAjaxLinks();checkVisibleCorpusMapSpace();_$body.trigger({'type':'new-content-ajax-loaded'});Drupal.attachBehaviors(_$row[0]);_$body.attr('booted','booted');_$body.removeClass('ajax-loading');if(state.url){history.pushState(state,null,state.url);if(typeof _paq!=='undefined'){_paq.push(['setCustomUrl',state.url]);_paq.push(['setDocumentTitle',data.title]);_ajax_timing.end=performance.now();_paq.push(['setGenerationTimeMs',_ajax_timing.end-_ajax_timing.start]);_paq.push(['trackPageView']);}}};function initAudioLinksInContent(){_$row.find('a.audio-link').on('mouseover',function(event){event.preventDefault();if(_corpus_ready){_$corpus_canvas.trigger({type:'mouseover-audio-link',nid:$(this).attr('nid')});}}).on('mouseout',function(event){event.preventDefault();if(_corpus_ready){_$corpus_canvas.trigger({type:'mouseout-audio-link',nid:$(this).attr('nid')});}});};function addCloseModalBtnToCols(){$('.col',_$row).each(function(index,el){if($('span.close-col-btn',this).length) return true;$(this).children('.wrapper').prepend($('').addClass('close-col-btn').on('click',onCloseModal));});};function onCloseModal(e){var $col=$(this).parents('.col');var theme=$col.attr('theme');if(theme!=''){_$body.trigger({'type':theme+'-col-closed'});} -$col.remove();checkRowEmpty();checkVisibleCorpusMapSpace();};function refreshAllBlocks(){var path=window.location.origin+Drupal.url(_ajax_settings.blocksjson_path);$.getJSON(path,{}).done(function(data){onAjaxBlockLoaded(data);}).fail(function(jqxhr,textStatus,error){onAjaxBlockLoadError(jqxhr,textStatus,error);});};function onAjaxBlockLoadError(jqxhr,textStatus,error){void 0;};function onAjaxBlockLoaded(data){void 0;for(var blockname in data.blocks){var block=data.blocks[blockname];void 0;$(block.id).replaceWith(block.rendered);}};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;var edlp_origin=JSON.parse(window.localStorage.getItem('edlp_origin'));void 0;if(edlp_origin!=null&&edlp_origin.sys_path){var view_mode=edlp_origin.hash.replace('#','');var state=getSysPathState(edlp_origin.sys_path,view_mode);if(edlp_origin.entity_type=="taxonomy_term"&&edlp_origin.entity_bundle=="entrees"&&view_mode){state.selector='entree-'+view_mode+'-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');}} +$col.remove();checkRowEmpty();checkVisibleCorpusMapSpace();};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;var edlp_origin=JSON.parse(window.localStorage.getItem('edlp_origin'));void 0;if(edlp_origin!=null&&edlp_origin.sys_path){var view_mode=edlp_origin.hash.replace('#','');var state=getSysPathState(edlp_origin.sys_path,view_mode);if(edlp_origin.entity_type=="taxonomy_term"&&edlp_origin.entity_bundle=="entrees"&&view_mode){state.selector='entree-'+view_mode+'-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');if(view_mode==""){state.audio=true;state.node=node;_$body.attr('booted','booted');}else{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);_$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.entree_tid){openEntree(e.state.entree_tid);} -if(e.state.ajax_path){e.state.url=null;ajaxLoadContent(e.state);}}};function initAjaxLinks(){$('a.site-name','#block-edlptheme-branding').add('a','#block-mainnavigation').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');_$ajaxLinks=$('.ajax-link:not(.ajax-enabled)').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')) +if(e.state.ajax_path){e.state.url=null;ajaxLoadContent(e.state);}}};function initAjaxLinks(){$('a.site-name','#block-edlptheme-branding').add('a','#block-mainnavigation').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');$('a[data-drupal-link-system-path=""]','#block-mainnavigation').removeClass('is-active');_$ajaxLinks=$('.ajax-link:not(.ajax-enabled)').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')) return false;if($link.is('.audio-link')){_audioPlayer.emmit('stop-shuffle').openDocument({nid:$link.attr('nid'),audio_url:$link.attr('audio_url'),title:$link.find('.field--name-title').html()});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==''){backToFrontPage();return false;} diff --git a/sites/all/themes/custom/edlptheme/assets/scripts/main.js b/sites/all/themes/custom/edlptheme/assets/scripts/main.js index 41a23218d..f203d5c4e 100644 --- a/sites/all/themes/custom/edlptheme/assets/scripts/main.js +++ b/sites/all/themes/custom/edlptheme/assets/scripts/main.js @@ -436,28 +436,28 @@ // /_/ \_\/ \__,_/_\_\ |___/_\___/\__|_\_\/__/ // |__/ // NOT USED (YET) - function refreshAllBlocks(){ - var path = window.location.origin + Drupal.url(_ajax_settings.blocksjson_path); - $.getJSON(path, {}) - .done(function(data){ - onAjaxBlockLoaded(data); - }) - .fail(function(jqxhr, textStatus, error){ - onAjaxBlockLoadError(jqxhr, textStatus, error); - }); - }; - function onAjaxBlockLoadError(jqxhr, textStatus, error){ - console.warn('ajax block load failed: '+error, jqxhr.responseText); - }; - function onAjaxBlockLoaded(data){ - console.log('onAjaxBlockLoaded', data); - // TODO: update each blocks (exepted language switcher) - for (var blockname in data.blocks) { - var block = data.blocks[blockname]; - console.log(blockname, block); - $(block.id).replaceWith(block.rendered); - } - }; + // function refreshAllBlocks(){ + // var path = window.location.origin + Drupal.url(_ajax_settings.blocksjson_path); + // $.getJSON(path, {}) + // .done(function(data){ + // onAjaxBlockLoaded(data); + // }) + // .fail(function(jqxhr, textStatus, error){ + // onAjaxBlockLoadError(jqxhr, textStatus, error); + // }); + // }; + // function onAjaxBlockLoadError(jqxhr, textStatus, error){ + // console.warn('ajax block load failed: '+error, jqxhr.responseText); + // }; + // function onAjaxBlockLoaded(data){ + // console.log('onAjaxBlockLoaded', data); + // // TODO: update each blocks (exepted language switcher) + // for (var blockname in data.blocks) { + // var block = data.blocks[blockname]; + // console.log(blockname, block); + // $(block.id).replaceWith(block.rendered); + // } + // }; // _ _ _ _ // | || (_)__| |_ ___ _ _ _ _ @@ -597,6 +597,8 @@ .add('a', '.field--name-field-son') .addClass('ajax-link'); + $('a[data-drupal-link-system-path=""]', '#block-mainnavigation').removeClass('is-active'); + _$ajaxLinks = $('.ajax-link:not(.ajax-enabled)') .each(function(i,e){ var $this = $(this);