corpus carre vide et plus petit

hover audio link -> node_popup on map
index sort title
corpus map : white safety zone arround squares
aside squares not collisioning
square faded not interactive (article filtre)
node_popup show chutier icon only if action not add
fade not active entries in entrees block
closing notice|index doesn't close entree on block
and many little things
This commit is contained in:
2018-04-17 15:07:57 +02:00
parent 76ff40f8bb
commit a3a4e3922c
26 changed files with 7318 additions and 372 deletions
@@ -81,7 +81,9 @@
history.pushState(state, null, e.url);
}
})
.on('close_entree', backToFrontPage);
.on('close_entree', function(e){
backToFrontPage();
});
}
// ___ _ _ ___
@@ -203,8 +205,10 @@
if(typeof state.selector != 'undefined'){
// in case of entree link (actualy, selector is used only for entries links)
// TODO: unfortunatly on initFirstLoad there is no selector property
console.log('selector', state.selector);
$('a[selector="'+state.selector+'"]').addClass('is-active');
initAudioLinksInContent();
}else{
if(typeof state.view_mode != 'undefined'){
$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');
@@ -297,6 +301,31 @@
}
};
function initAudioLinksInContent(){
// console.log('initAudioLinksInContent');
_$row.find('a.audio-link')
.on('mouseover', function(event) {
event.preventDefault();
// console.log('onmouseover audio-link');
if(_corpus_ready){
_$corpus_canvas.trigger({
type:'mouseover-audio-link',
nid:$(this).attr('nid')
});
}
})
.on('mouseout', function(event) {
event.preventDefault();
// console.log('onmouseout audio-link');
if(_corpus_ready){
_$corpus_canvas.trigger({
type:'mouseout-audio-link',
nid:$(this).attr('nid')
});
}
});
};
function addCloseModalBtnToCols(){
$('.col', _$row).each(function(index, el) {
@@ -305,25 +334,28 @@
$(this).children('.wrapper').prepend($('<span>')
.addClass('close-col-btn')
.on('click', function(e){
// check for theme attribute and emmit event
var $col = $(this).parents('.col');
var theme = $col.attr('theme');
if(theme != ''){
_$body.trigger({'type':theme+'-col-closed'});
}
// remove the col
$col.remove();
// if row is empty and we are not in productions call closeAllModals()
if(!$('.col', _$row).length
&& !_$body.is('.entity-type-node.bundle-page')){
backToFrontPage();
}
})
.on('click', onCloseModal)
);
});
};
function onCloseModal(e){
// check for theme attribute and emmit event
var $col = $(this).parents('.col');
var theme = $col.attr('theme');
if(theme != ''){
_$body.trigger({'type':theme+'-col-closed'});
}
// remove the col
$col.remove();
// if row is empty and we are not in productions or entree notice|index call closeAllModals()
if(!$('.col', _$row).length
&& !_$body.is('.entity-type-node.bundle-page')
&& !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
backToFrontPage();
}
};
// _ _ ___ _ _
// /_\ (_)__ ___ __ | _ ) |___ __| |__ ___
// / _ \ | / _` \ \ / | _ \ / _ \/ _| / /(_-<
@@ -367,37 +399,47 @@
// var origin_sys_path = window.localStorage.getItem('edlp_origin_path');
var edlp_origin = JSON.parse(window.localStorage.getItem('edlp_origin'));
console.log('edlp_origin', edlp_origin);
if(edlp_origin != null && edlp_origin.sys_path){
// var origin_url = window.localStorage.getItem('edlp_origin_url');
// origin_hash is used as viewmode for taxonomy term entrees load (index or notice)
// var origin_hash = window.localStorage.getItem('edlp_origin_hash');
// hash is used as viewmode for taxonomy term entrees load (index or notice)
// and for audio contents (article|transcript)
var view_mode = edlp_origin.hash.replace('#', '');
// // TODO: refactorize with new infos from edlp_origin
if(view_mode){
var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+view_mode+'"]');
var selector = $link.attr('selector') || null;
if(selector){
// create history state
var state = getSysPathState(edlp_origin.sys_path, view_mode);
// 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(view_mode){
if(edlp_origin.entity_type == "taxonomy_term"
&& edlp_origin.entity_bundle == "entrees"
&& view_mode){
// var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+view_mode+'"]');
// var selector = $link.attr('selector') || null;
// record the selector in the state for actions after ajaxContentLoaded
state.selector = 'entree-'+view_mode+'-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:$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)
// but what if corpus ready before onAjaxLoaded >> use a promise !!
$('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');
// $('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');
}
}
// }
}
// create history state
var state = getSysPathState(edlp_origin.sys_path, view_mode);
// check if audio link
if(edlp_origin.audio_url){
var node = {
@@ -1205,13 +1247,16 @@
// |_||_| \___/_||_\__|_| \__,_\__, \___|
// |___/
function backToFrontPage(pop_state){
console.log('backToFrontPage', pop_state);
closeAllModals();
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
if(!pop_state){
if(typeof pop_state == "undefined" || !pop_state){
console.log('backToFrontPage push state');
history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
}
}