enregistrement transcription interface is ok

This commit is contained in:
2018-04-15 00:00:40 +02:00
parent 6d88ca7c8d
commit ea435b7517
9 changed files with 196 additions and 20 deletions
@@ -194,7 +194,11 @@
console.log('selector', state.selector);
$('a[selector="'+state.selector+'"]').addClass('is-active');
}else{
$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
if(typeof state.view_mode != 'undefined'){
$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
}else{
$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
}
// as new content is not related to entree, we trigger close entree
_$body.trigger({'type':'new-content-not-entree-ajax-loaded'});
}
@@ -228,6 +232,12 @@
addCloseModalBtnToCols();
}
// enregistrement transcription
if(data.entity_type == "node" && data.bundle == "enregistrement" && data.view_mode == "transcript"){
// window.requestAnimationFrame(initEnregistrementTranscript);
initEnregistrementTranscript();
}
// update the language switcher block if it comes in the response
if(typeof data.translations_links != 'undefined'){
console.log('state',state);
@@ -261,7 +271,6 @@
_$body.attr('booted', 'booted');
_$body.removeClass('ajax-loading');
// url is null means that we are loading content on popState event
// so we don't record the state again
if(state.url){
@@ -271,7 +280,7 @@
// };
// console.log('url:'+url+' ; state',state);
// console.log(window.location);
// we can not pushestate with absolute url
// /!\ we can not pushestate with absolute url /!\
history.pushState(state, null, state.url);
}
};
@@ -713,6 +722,7 @@
stop(){
// console.log('AudioPlayer stop()');
this.audio.pause();
// TODO: don't close player if article or transcript is open
this.timeOutToHide();
},
// audio events
@@ -1201,6 +1211,30 @@
});
};
// ___ _ _ _
// | __|_ _ _ _ ___ __ _(_)__| |_ _ _ ___ _ __ ___ _ _| |_
// | _|| ' \| '_/ -_) _` | (_-< _| '_/ -_) ' \/ -_) ' \ _|
// |___|_||_|_| \___\__, |_/__/\__|_| \___|_|_|_\___|_||_\__|
// |___/
function initEnregistrementTranscript(){
console.log('initEnregistrementTranscript');
var $node = _$row.find('article.node--type-enregistrement.node--view-mode-transcript');
var $nav = $('<nav>').prependTo($node);
$node.find('.field--name-field-transcript-vo').addClass('visible').find('.field__label')
.clone().appendTo($nav).addClass('is-active')
.attr('field_target', '.field--name-field-transcript-vo');
$node.find('.field--name-field-transcript-trad').find('.field__label')
.clone().appendTo($nav)
.attr('field_target', '.field--name-field-transcript-trad');
$nav.find('.field__label').on('click', function(){
var $this = $(this).addClass('is-active');
$this.siblings('.is-active').removeClass('is-active');
$this.parents('article.node').find('.field.visible').removeClass('visible');
$this.parents('article.node').find($this.attr('field_target')).addClass('visible');
});
};
// __ __ _ _
// | \/ |___ __| |__ _| |___
// | |\/| / _ \/ _` / _` | (_-<