Browse Source

js bug fix

Bachir Soussi Chiadmi 7 years ago
parent
commit
7e073fdfa0

+ 1 - 1
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js

@@ -16,7 +16,7 @@ $('ul','.block.language-switcher-language-url').replaceWith($links);}
 initAjaxLinks();_$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);}};function addCloseModalBtnToCols(){$('.col',_$row).each(function(index,el){if($('span.close-col-btn',this).length)
 return true;$(this).children('.wrapper').prepend($('<span>').addClass('close-col-btn').on('click',function(e){var $col=$(this).parents('.col');var theme=$col.attr('theme');if(theme!=''){_$body.trigger({'type':theme+'-col-closed'});}
 $col.remove();if(!$('.col',_$row).length&&!_$body.is('.entity-type-node.bundle-page')){backToFrontPage();}}));});};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'));if(edlp_origin!=null&&edlp_origin.sys_path){var view_mode=edlp_origin.hash.replace('#','');if(view_mode){var $link=$('[href="'+edlp_origin.url+'"][viewmode="'+view_mode+'"]');var selector=$link.attr('selector')||null;if(selector){if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:$link.attr('tid')});}else{$('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');}}}
-var state=getSysPathState(edlp_origin.sys_path,view_mode);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;}else{ajaxLoadContent(state);}}
+var state=getSysPathState(edlp_origin.sys_path,view_mode);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);}

+ 2 - 0
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -409,6 +409,8 @@
             // 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');
           }else{
             // ajax load content for audio only if article or transcript
             ajaxLoadContent(state);