Pārlūkot izejas kodu

fixe sound direct link with mobile from desktop, fix #584

Bachir Soussi Chiadmi 5 gadi atpakaļ
vecāks
revīzija
67271fc277

+ 3 - 2
web/modules/custom/edlp_ajax/edlp_ajax.module

@@ -13,13 +13,13 @@ use Drupal\Core\Url;
  * @param array $attachments
  */
 function edlp_ajax_page_attachments(array &$attachments) {
+  // provied info about available urls needed for ajax purpose
   $url = Url::fromRoute('edlp_ajax.entityjson');
   $attachments['#attached']['drupalSettings']['edlp_ajax']['entityjson_path'] = $url->getInternalPath();
   $url = Url::fromRoute('edlp_ajax.blocksjson');
   $attachments['#attached']['drupalSettings']['edlp_ajax']['blocksjson_path'] = $url->getInternalPath();
 
-  $redirect = false;
-
+  // provied infos about current entity (node or taxonomy term) and audio files
   $current_path = \Drupal::service('path.current')->getPath();
   $current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
   $is_front = \Drupal::service('path.matcher')->isFrontPage();
@@ -49,6 +49,7 @@ function edlp_ajax_page_attachments(array &$attachments) {
 
   // do not redirect if not node, term, or custom routing
   // FIXME: check with routes instead of path as path can change !!!
+  $redirect = false;
   if(preg_match('/^\/?node\/\d+/', $current_path)
     || preg_match('/^\/?taxonomy\/term\/\d+/', $current_path)
     || preg_match('/^\/?productions/', $current_path)

+ 1 - 1
web/modules/custom/edlp_corpus/assets/dist/styles/corpus.min.css

@@ -1 +1 @@
-canvas#corpus-map{position:absolute;box-sizing:border-box;top:0;left:0;z-index:0}canvas#corpus-map.de-activated{background-color:#f4f4f4}div.node-popup{z-index:10;position:absolute;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.6em;outline:red solid 1px;background-color:#fff}div.node-popup:before{content:"";position:absolute;width:60px;height:0;border-top:1px solid red}div.node-popup[pos=bottom-right]{-webkit-transform:translateY(42px) translateX(42px);transform:translateY(42px) translateX(42px)}div.node-popup[pos=bottom-right]:before{top:-1px;left:-61px;-webkit-transform-origin:bottom right;transform-origin:bottom right;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=bottom-left]{-webkit-transform:translateX(-100%) translateY(42px) translateX(-42px);transform:translateX(-100%) translateY(42px) translateX(-42px)}div.node-popup[pos=bottom-left]:before{top:calc(100% +1px);left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}div.node-popup[pos=top-left]{-webkit-transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px);transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px)}div.node-popup[pos=top-left]:before{bottom:0;left:100%;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:rotateZ(45deg);transform:rotateZ(45deg)}div.node-popup[pos=top-right]{-webkit-transform:translateY(-100%) translateY(-42px) translateX(42px);transform:translateY(-100%) translateY(-42px) translateX(42px)}div.node-popup[pos=top-right]:before{top:calc(100% + 1px);left:-61px;-webkit-transform-origin:top right;transform-origin:top right;-webkit-transform:rotateZ(-45deg);transform:rotateZ(-45deg)}
+canvas#corpus-map{position:absolute;box-sizing:border-box;top:0;left:0;z-index:0}canvas#corpus-map.de-activated{background-color:#f4f4f4}div.node-popup{z-index:10;position:absolute;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.6em;outline:red solid 1px;background-color:#fff}div.node-popup:before{content:"";position:absolute;width:60px;height:0;border-top:1px solid red}div.node-popup[pos=bottom-right]{transform:translateY(42px) translateX(42px)}div.node-popup[pos=bottom-right]:before{top:-1px;left:-61px;transform-origin:bottom right;transform:rotateZ(45deg)}div.node-popup[pos=bottom-left]{transform:translateX(-100%) translateY(42px) translateX(-42px)}div.node-popup[pos=bottom-left]:before{top:calc(100% +1px);left:100%;transform-origin:top left;transform:rotateZ(-45deg)}div.node-popup[pos=top-left]{transform:translateY(-100%) translateX(-100%) translateY(-42px) translateX(-42px)}div.node-popup[pos=top-left]:before{bottom:0;left:100%;transform-origin:top left;transform:rotateZ(45deg)}div.node-popup[pos=top-right]{transform:translateY(-100%) translateY(-42px) translateX(42px)}div.node-popup[pos=top-right]:before{top:calc(100% + 1px);left:-61px;transform-origin:top right;transform:rotateZ(-45deg)}

+ 5 - 4
web/modules/custom/edlp_mobile/edlp_mobile.module

@@ -52,6 +52,8 @@ function edlp_mobile_help($route_name, RouteMatchInterface $route_match) {
 
 /**
  * Implements hook_page_attachments().
+ * the porpuse of this hooks is to collect registered domains informations to set it available to redirect.js file provided by edlptheme
+ * it does nothing by it's own
  * @param array $attachments
  */
 function edlp_mobile_page_attachments(array &$attachments) {
@@ -60,20 +62,19 @@ function edlp_mobile_page_attachments(array &$attachments) {
   global $base_root;
   // dpm($base_root, '$base_root');
 
+  // get the current hostname (domain)
   $current_hostname = preg_replace('/http:\/\/|https:\/\//i', '', $base_root);
   // dpm($current_hostname, '$current_hostname');
 
+  // get domains from domain module
   $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
-
   $mobile_domain = $domain_storage->load('m_encyclopediedelaparole_org');
   // dpm($mobile_domain, 'mobile_domain');
-
   $desktop_domain = $domain_storage->load('encyclopediedelaparole_org');
   // dpm($desktop_domain, 'desktop_domain');
-
   $expo_domain = $domain_storage->load('expo_encyclopediedelaparole_org');
   // dpm($expo_domain, 'expo_domain');
-
+  // get the current domain
   $current_domain = $domain_storage->loadByHostname($current_hostname);
   // dpm($current_domain, 'current_domain');
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 333 - 272
web/modules/custom/package-lock.json


+ 5 - 5
web/themes/custom/edlptheme/assets/dist/scripts/main.min.js

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

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
web/themes/custom/edlptheme/assets/dist/scripts/redirect.min.js


+ 21 - 5
web/themes/custom/edlptheme/assets/scripts/main.js

@@ -136,6 +136,7 @@
     // | |\/| / _ \ '_ \ | / -_)
     // |_|  |_\___/_.__/_|_\___|
     function initMobile(){
+      console.log('initMobile');
       // $('[data-drupal-link-system-path="<front>"]','#block-mainnavigation')
       //   .removeClass('is-active')
       //   .attr('href', '#collection');
@@ -145,10 +146,10 @@
       // TODO: remove collection from mobile home
       // TODO: replace ajax link to only collection for mobile
 
-
       $('h2, a', '#block-mainnavigation')
         .add('h2, a', '#block-mainnavigation-2')
         .on('click', onclickHomeMobileMenu);
+
     }
     function onclickHomeMobileMenu(e){
       // $('#block-mainnavigation').toggleClass('opened');
@@ -722,6 +723,9 @@
         // create history state
         var state = getSysPathState(edlp_origin.sys_path, hash);
 
+        // add historic_index 0 to state
+        state.historic_index = 0;
+
         // open entree tray in case of entree index|notice
         // (index or notice will be opened with ajaxLoadContent)
         // refactorized with new infos from edlp_origin
@@ -764,13 +768,19 @@
           // close home
           closeAllModals();
           if(hash == "" || hash == 'random'){
+            console.log('first load hash', hash);
             // if hash is random, RandomPlayer will be started when playlist sent by corpus.js
             // 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');
+            if(!_is_mobile){
+              // if not mobile we don't laod ajax content so we boot the home
+              _$body.attr('booted', 'booted');
+            }else{
+              ajaxLoadContent(state);
+            }
           }else{
+            console.log('first load load content');
             // ajax load content for audio only if article or transcript
             ajaxLoadContent(state);
           }
@@ -809,7 +819,11 @@
         backToFrontPage(true);
       }
       else if (e.state.audio) {
-          _audioPlayer.openDocument(e.state.node, 'popstate', e.state.historic_index);
+        console.log('popstate audio : e.state', e.state);
+        _audioPlayer.openDocument(e.state.node, 'popstate', e.state.historic_index);
+        if(_is_mobile){
+          ajaxLoadContent(e.state)
+        }
       }
       else{
         if(e.state.entree_tid){
@@ -1205,7 +1219,7 @@
         this.$next.on('click', this.playNext.bind(this));
       },
       openDocument(node, caller, historic_index){
-        console.log('AudioPlayer openDocument', node, caller);
+        console.log('AudioPlayer openDocument', node, caller, historic_index);
         if(typeof node == 'undefined'
           || typeof node.nid ==  'undefined'
           || typeof node.audio_url == 'undefined'){
@@ -1275,6 +1289,8 @@
       launch(){
         this.clearTimeOutToHide();
         this.clearIntervalAutoCartelSwitch();
+        console.log('this.historic', this.historic);
+        console.log('this.currentHistoricIndex', this.currentHistoricIndex);
         this.setSRC(this.historic[this.currentHistoricIndex].audio_url);
         if(!_is_mobile){
           this.loadNode(this.historic[this.currentHistoricIndex].nid);

+ 6 - 2
web/themes/custom/edlptheme/assets/scripts/redirect.js

@@ -6,6 +6,9 @@ function checkMobile(){
 }
 
 // var edlp_mobile is provided by edlp_mobile.module file
+// TODO: edlp_mobile should be called edlp_domains
+// if device is mobile but domain not, redirect to mobile domain
+// if device is desktop but domain is mobile, redirect to desktop domain
 if(typeof edlp_mobile != "undefined"){
   // console.log(edlp_mobile);
   // console.log('window.location', window.location);
@@ -19,7 +22,8 @@ if(typeof edlp_mobile != "undefined"){
       // console.log('redirect to mobile domain', window.location.protocol +'//'+ edlp_mobile.mobile_url);
       device_redirect = true;
       // redirect to mobile domain
-      window.location.replace(window.location.protocol +'//'+ edlp_mobile.mobile_url);
+      // TODO: preserve params
+      window.location.replace(window.location.protocol +'//'+ edlp_mobile.mobile_url + location.pathname);
       break;
     case (edlp_mobile.is_mobile_domain && !device_is_mobile):
       // console.log('redirect to desktop domain', window.location.protocol +'//'+ edlp_mobile.desktop_url);
@@ -37,7 +41,7 @@ if(typeof edlp_mobile != "undefined"){
 }
 
 // var edlp is provided by edlp_ajax.module file
-if(edlp.redirect && !device_redirect && !device_is_mobile){
+if(edlp.redirect && !device_redirect){ //  && !device_is_mobile
   console.log('redirect', edlp);
   console.log('window.location', window.location);
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels