|
@@ -534,75 +534,75 @@
|
|
|
// and for audio contents (article|transcript)
|
|
|
var hash = edlp_origin.hash.replace('#', '');
|
|
|
|
|
|
- // if hash is random, RandomPlayer will be started when playlist sent by corpus.js
|
|
|
- if(hash != "random"){
|
|
|
- // create history state
|
|
|
- var state = getSysPathState(edlp_origin.sys_path, hash);
|
|
|
-
|
|
|
- // open entree tray in case of entree index|notice
|
|
|
- // (index or notice will be opened with ajaxLoadContent)
|
|
|
- // refactorized with new infos from edlp_origin
|
|
|
- // if(hash){
|
|
|
- if(edlp_origin.entity_type == "taxonomy_term"
|
|
|
- && edlp_origin.entity_bundle == "entrees"
|
|
|
- && hash){
|
|
|
- // var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+hash+'"]');
|
|
|
- // var selector = $link.attr('selector') || null;
|
|
|
-
|
|
|
- // record the selector in the state for actions after ajaxContentLoaded
|
|
|
- state.selector = 'entree-'+hash+'-link-'+edlp_origin.entity_id; // entree-index-link-125
|
|
|
- // if(selector){
|
|
|
- // in case of entree link (actualy, selector is used only for entries links)
|
|
|
- // TODO: use a promise
|
|
|
- // TODO: but what if corpus ready before onAjaxLoaded >> use a promise !!
|
|
|
- if(_corpus_ready){
|
|
|
- _$corpus_canvas.trigger({
|
|
|
- type:'open-entree',
|
|
|
- // tid:$link.attr('tid')
|
|
|
- tid:edlp_origin.entity_id
|
|
|
- });
|
|
|
- }else{
|
|
|
- // else : EdlpCorpus will check when ready if entry item (notice or index) is already .is-active
|
|
|
- // .is-active class is added by onAjaxLoaded() (when content is loaded)
|
|
|
- // $('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');
|
|
|
- $('li.entree[tid="'+edlp_origin.entity_id+'"] a.term-link').addClass('is-active');
|
|
|
- }
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
- // check if audio link
|
|
|
- // only if not random link
|
|
|
- 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(hash == ""){
|
|
|
- // 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');
|
|
|
+ // create history state
|
|
|
+ var state = getSysPathState(edlp_origin.sys_path, hash);
|
|
|
+
|
|
|
+ // open entree tray in case of entree index|notice
|
|
|
+ // (index or notice will be opened with ajaxLoadContent)
|
|
|
+ // refactorized with new infos from edlp_origin
|
|
|
+ // if(hash){
|
|
|
+ if(edlp_origin.entity_type == "taxonomy_term"
|
|
|
+ && edlp_origin.entity_bundle == "entrees"
|
|
|
+ && hash){
|
|
|
+ // var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+hash+'"]');
|
|
|
+ // var selector = $link.attr('selector') || null;
|
|
|
+
|
|
|
+ // record the selector in the state for actions after ajaxContentLoaded
|
|
|
+ state.selector = 'entree-'+hash+'-link-'+edlp_origin.entity_id; // entree-index-link-125
|
|
|
+ // if(selector){
|
|
|
+ // in case of entree link (actualy, selector is used only for entries links)
|
|
|
+ // TODO: use a promise
|
|
|
+ // TODO: but what if corpus ready before onAjaxLoaded >> use a promise !!
|
|
|
+ if(_corpus_ready){
|
|
|
+ _$corpus_canvas.trigger({
|
|
|
+ type:'open-entree',
|
|
|
+ // tid:$link.attr('tid')
|
|
|
+ tid:edlp_origin.entity_id
|
|
|
+ });
|
|
|
}else{
|
|
|
- // ajax load content for audio only if article or transcript
|
|
|
- ajaxLoadContent(state);
|
|
|
+ // else : EdlpCorpus will check when ready if entry item (notice or index) is already .is-active
|
|
|
+ // .is-active class is added by onAjaxLoaded() (when content is loaded)
|
|
|
+ // $('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');
|
|
|
+ $('li.entree[tid="'+edlp_origin.entity_id+'"] a.term-link').addClass('is-active');
|
|
|
}
|
|
|
- }
|
|
|
- // only if not entree path
|
|
|
- // only if not audio (without article or transcript) path
|
|
|
- else if(state.ajax_path){
|
|
|
- // load content through ajax
|
|
|
- // ajaxLoadContent(null, state.sys_path, state.ajax_path, selector);
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ // check if audio link
|
|
|
+ // only if not random link
|
|
|
+ if(edlp_origin.audio_url){
|
|
|
+ var node = {
|
|
|
+ nid:edlp_origin.entity_id,
|
|
|
+ audio_url:edlp_origin.audio_url
|
|
|
+ };
|
|
|
+ _audioPlayer.openDocument(node, 'history_first_load');
|
|
|
+ // close home
|
|
|
+ closeAllModals();
|
|
|
+ if(hash == "" || hash == 'random'){
|
|
|
+ // 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');
|
|
|
+ }else{
|
|
|
+ // ajax load content for audio only if article or transcript
|
|
|
ajaxLoadContent(state);
|
|
|
}
|
|
|
+ }
|
|
|
+ // only if not entree path
|
|
|
+ // only if not audio (without article or transcript) path
|
|
|
+ else if(state.ajax_path){
|
|
|
+ // load content through ajax
|
|
|
+ // ajaxLoadContent(null, state.sys_path, state.ajax_path, selector);
|
|
|
+ ajaxLoadContent(state);
|
|
|
+ }
|
|
|
|
|
|
- if(state.entree_tid){
|
|
|
- openEntree(state.entree_tid);
|
|
|
- }
|
|
|
- // record history state
|
|
|
- history.replaceState(state, null, edlp_origin.url+edlp_origin.hash);
|
|
|
+ if(state.entree_tid){
|
|
|
+ openEntree(state.entree_tid);
|
|
|
}
|
|
|
+ // record history state
|
|
|
+ history.replaceState(state, null, edlp_origin.url+edlp_origin.hash);
|
|
|
|
|
|
// reset the storage
|
|
|
window.localStorage.removeItem("edlp_origin");
|
|
@@ -976,7 +976,15 @@
|
|
|
'nid':this.historic[this.currentHistoricIndex].nid
|
|
|
});
|
|
|
} catch (e) {
|
|
|
- console.info('AudioPlayer : _$corpus_canvas does not exists');
|
|
|
+ console.info('AudioPlayer : _$corpus_canvas does not exists, testing promise');
|
|
|
+ var that = this;
|
|
|
+ _corpus_promise.done(function(){
|
|
|
+ _$corpus_canvas.trigger({
|
|
|
+ 'type':'audio-node-opened',
|
|
|
+ 'nid':that.historic[that.currentHistoricIndex].nid
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
this.showHidePreviousBtn();
|