corpus map evolution zone linked to visible space left by modals

This commit is contained in:
2018-04-23 22:38:02 +02:00
parent e4b3ca6c94
commit bf0dade005
10 changed files with 7459 additions and 162 deletions
@@ -323,6 +323,8 @@
initAjaxLinks();
checkVisibleCorpusMapSpace();
// trigger other modules behaviours
_$body.trigger({'type':'new-content-ajax-loaded'});
@@ -407,6 +409,7 @@
// remove the col
$col.remove();
checkRowEmpty();
checkVisibleCorpusMapSpace();
};
// _ _ ___ _ _
@@ -604,7 +607,7 @@
return false;
}
// NOT USED (YET)
// NOT USED ( YET ? )
// if($link.is('.language-link')){
// TODO: change global site current language
// load all blocks translated (exepted language switcher) ... :/
@@ -648,7 +651,6 @@
// | (__/ _ \ '_| '_ \ || (_-<
// \___\___/_| | .__/\_,_/__/
// |_|
function onCorpusMapReady(e){
//console.log('theme : onCorpusReady', e);
_corpus_ready = true;
@@ -690,6 +692,40 @@
}
};
function checkVisibleCorpusMapSpace(){
var left_limit = 0, right_limit = 0;
_$row.find('.col').each(function(i,e){
var $col = $(this);
var offset = $col.offset();
switch(true){
case $col.is('.float-right'):
right_limit = Math.max(right_limit, Math.abs(offset.left-window.innerWidth));
break;
default:
left_limit = Math.max(left_limit, offset.left+$col.width());
break;
}
});
console.log('checkVisibleCorpusMapSpace left_limit:'+left_limit+" right_limit:"+right_limit);
if(_corpus_ready){
_$body.trigger({
type:'visible-space-changed',
left_limit:left_limit,
right_limit:right_limit
});
}else{
_corpus_promise.done(function(){
_$body.trigger({
type:'visible-space-changed',
left_limit:left_limit,
right_limit:right_limit
});
});
}
};
// _ _ _
// /_\ _ _ __| (_)___
// / _ \ || / _` | / _ \
@@ -1473,15 +1509,20 @@
};
function checkRowEmpty(){
// TODO: remove is-active class from index or notice entree links
// if row is empty and we are not in productions or entree notice|index call closeAllModals()
if(!$('.col', _$row).length && !_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
if(!_$body.is('.entity-type-node.bundle-page')){
// we weren't on production or entree, so go back to front page
backToFrontPage();
if(!$('.col', _$row).length){
if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
if(!_$body.is('.entity-type-node.bundle-page')){
// we weren't on production or entree, so go back to front page
backToFrontPage();
}else{
// if we were on production page just scramble collection in case of map was filtered
_$corpus_canvas.trigger({'type':'scramble-collection'});
}
}else{
// if we were on production page just scramble collection in case of map was filtered
_$corpus_canvas.trigger({'type':'scramble-collection'});
// remove is-active class from index or notice entree links
$('.entree-content a.is-active').removeClass('is-active');
// TODO: remove the hash index or notice
}
}
};