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
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1 +1,71 @@
canvas#corpus-map{position:absolute;-webkit-box-sizing:border-box;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;-webkit-box-sizing:content-box;box-sizing:content-box;width:300px;min-height:30px;top:60%;left:30%;pointer-events:none}div.node-popup .inner{padding:.4em;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;
-webkit-box-sizing: border-box;
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;
-webkit-box-sizing: content-box;
box-sizing: content-box;
width: 300px;
min-height: 30px;
pointer-events: none;
top: 60%;
left: 30%;
pointer-events: none; }
div.node-popup .inner {
padding: 0.6em;
outline: 1px solid red;
background-color: white; }
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); }
@@ -25,7 +25,8 @@
var _canvas = _$canvas[0]; var _canvas = _$canvas[0];
var _ctx = _canvas.getContext('2d'); var _ctx = _canvas.getContext('2d');
var _canvas_props = { var _canvas_props = {
'margin_top':90, // 'margin_top':90, // with red border on head
'margin_top':75, // without red border on head
'margin_right':0, 'margin_right':0,
'margin_bottom':65, 'margin_bottom':65,
'margin_left':0 'margin_left':0
@@ -206,13 +207,13 @@
// define radius regarding entries length // define radius regarding entries length
switch(true){ switch(true){
case this.entrees.length > 3: case this.entrees.length > 3:
this.r = 10; this.r = 8;//10;
break; break;
case this.entrees.length > 1 && this.entrees.length <= 3: case this.entrees.length > 1 && this.entrees.length <= 3:
this.r = 7; this.r = 5;//7;
break; break;
default: default:
this.r = 4; this.r = 3;//4;
break; break;
} }
@@ -225,7 +226,8 @@
this.aside = false; this.aside = false;
this.scrambling = false; this.scrambling = false;
this.n_repulses = {}; this.wall_bouncing_elasticity = 0.75;
// this.n_repulses = {};
// prototypes // prototypes
if (typeof Node.initialized == "undefined") { if (typeof Node.initialized == "undefined") {
@@ -300,7 +302,7 @@
} }
} }
if(_mouse_in && !this.aside) if(_mouse_in && !this.aside && !this.faded)
this.checkMouse(); this.checkMouse();
// if(this.debug) // if(this.debug)
@@ -322,19 +324,27 @@
switch(true){ switch(true){
case this.x < this.wall_limits.left && this.p.velocity.x < 0: case this.x < this.wall_limits.left && this.p.velocity.x < 0:
this.p.position.x = this.wall_limits.left; this.p.position.x = this.wall_limits.left;
this.p.velocity.multiplyScalarXY(-1, 1).multiplyScalar(0.75); this.p.velocity
.multiplyScalarXY(-1, 1)
.multiplyScalar(this.wall_bouncing_elasticity);
break; break;
case this.x > this.wall_limits.right && this.p.velocity.x > 0: case this.x > this.wall_limits.right && this.p.velocity.x > 0:
this.p.position.x = this.wall_limits.right; this.p.position.x = this.wall_limits.right;
this.p.velocity.multiplyScalarXY(-1, 1).multiplyScalar(0.75); this.p.velocity
.multiplyScalarXY(-1, 1)
.multiplyScalar(this.wall_bouncing_elasticity);
break; break;
case this.y < this.wall_limits.top && this.p.velocity.y < 0 : case this.y < this.wall_limits.top && this.p.velocity.y < 0 :
this.p.position.y = this.wall_limits.top; this.p.position.y = this.wall_limits.top;
this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75); this.p.velocity
.multiplyScalarXY(1,-1)
.multiplyScalar(this.wall_bouncing_elasticity);
break; break;
case this.y > this.wall_limits.bottom && this.p.velocity.y > 0 : case this.y > this.wall_limits.bottom && this.p.velocity.y > 0 :
this.p.position.y = this.wall_limits.bottom; this.p.position.y = this.wall_limits.bottom;
this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75); this.p.velocity
.multiplyScalarXY(1,-1)
.multiplyScalar(this.wall_bouncing_elasticity);
break; break;
} }
}; };
@@ -352,16 +362,23 @@
&& _m_pos.y < this.y + this.r){ && _m_pos.y < this.y + this.r){
if(_node_hover_id == -1 || _node_hover_id !== this.id){ if(_node_hover_id == -1 || _node_hover_id !== this.id){
// console.log("Node hover", this.id); // console.log("Node hover", this.id);
this.hover = true; this.setHover();
_node_hover_id = this.id;
_node_pop_up.setNode(this);
} }
}else{ }else{
this.hover = false; this.unsetHover();
if (_node_hover_id == this.id) { }
_node_hover_id = -1; };
_node_pop_up.removeNode();
} Node.prototype.setHover = function(){
this.hover = true;
_node_hover_id = this.id;
_node_pop_up.setNode(this);
};
Node.prototype.unsetHover = function(){
this.hover = false;
if (_node_hover_id == this.id) {
_node_hover_id = -1;
_node_pop_up.removeNode();
} }
}; };
@@ -421,12 +438,14 @@
this.unsetCentered(); this.unsetCentered();
this.ori_p.position.x = this.x < _canvas.width /2 ? this.wall_limits.left : this.wall_limits.right; this.ori_p.position.x = this.x < _canvas.width /2 ? this.wall_limits.left : this.wall_limits.right;
this.ori_p_attract.on = true; this.ori_p_attract.on = true;
this.wall_bouncing_elasticity = 0.15;
} }
Node.prototype.unsetAside = function(){ Node.prototype.unsetAside = function(){
console.log('unsetAside'); console.log('unsetAside');
this.aside = false; this.aside = false;
this.ori_p_attract.on = false; this.ori_p_attract.on = false;
this.ori_p.position.x = this.ori_pos.x; this.ori_p.position.x = this.ori_pos.x;
this.wall_bouncing_elasticity = 0.75;
// this.unFade(); // this.unFade();
} }
@@ -464,15 +483,25 @@
// actif entouré de rouge // actif entouré de rouge
_ctx.beginPath(); _ctx.beginPath();
_ctx.globalAlpha = this.faded ? 0.1 : 1; _ctx.globalAlpha = this.faded ? 0.15 : 1;
// _ctx.fillStyle = !this.p.resting() ? _ecolors[this.e_color] : 'rgb(0, 0, 0)'; // carre plein
_ctx.fillStyle = _ecolors[this.e_color]; // _ctx.fillStyle = _ecolors[this.e_color];
// _ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
// ou carre contour
_ctx.lineWidth = '2px';
_ctx.fillStyle = 'rgb(255,255,255)';
_ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2); _ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
_ctx.strokeStyle = _ecolors[this.e_color];
_ctx.strokeRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
if(this.opened){ if(this.opened){
_ctx.lineWidth = '1px'; // carre plein
_ctx.strokeStyle = 'rgb(255,0,0)'; // _ctx.lineWidth = '1px';
_ctx.strokeRect(this.x - this.r-3,this.y - this.r-3,this.r*2+6,this.r*2+6); // _ctx.strokeStyle = 'rgb(255,0,0)';
// _ctx.strokeRect(this.x - this.r-3,this.y - this.r-3,this.r*2+6,this.r*2+6);
// ou carre contour
_ctx.fillStyle = _ecolors[this.e_color];
_ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
} }
_ctx.globalAlpha = 1; _ctx.globalAlpha = 1;
_ctx.closePath(); _ctx.closePath();
@@ -507,7 +536,8 @@
nb = _nodes[q]; nb = _nodes[q];
mb = nb.p.mass; mb = nb.p.mass;
// avoid impact between center and aside particules // avoid impact between center and aside particules
if((na.center && nb.aside) || (na.aside && nb.center)) // and between aside particules
if((na.center && nb.aside) || (na.aside && nb.center) || (na.aside && nb.aside))
continue; continue;
// avoid impact between two centered particulses that comes to the center // avoid impact between two centered particulses that comes to the center
@@ -518,6 +548,9 @@
} }
w = h = (na.r+nb.r); w = h = (na.r+nb.r);
// if(!na.aside && !nb.aside){
w = h += 4; // add a saftey zone around squares eccept for aside squares
// }
dx = na.p.position.x - nb.p.position.x; dx = na.p.position.x - nb.p.position.x;
dy = na.p.position.y - nb.p.position.y; dy = na.p.position.y - nb.p.position.y;
@@ -624,6 +657,7 @@
if(!$li.is('.opened')){ if(!$li.is('.opened')){
_$entrees_block_termlinks.parents('li').removeClass('opened'); _$entrees_block_termlinks.parents('li').removeClass('opened');
$li.addClass('opened'); $li.addClass('opened');
$li.parents('.item-list').addClass('opened')
filterEntree(tid); filterEntree(tid);
if(bubbling){ if(bubbling){
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path}); _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
@@ -631,6 +665,7 @@
// bubbling is true only when event is a real click on entree link // bubbling is true only when event is a real click on entree link
}else if(bubbling){ }else if(bubbling){
$li.removeClass('opened'); $li.removeClass('opened');
$li.parents('.item-list').removeClass('opened')
scrambleCollection(); scrambleCollection();
_$body.trigger({'type':'close_entree', 'tid':tid}); _$body.trigger({'type':'close_entree', 'tid':tid});
} }
@@ -651,7 +686,9 @@
createNodesRepulsions(); createNodesRepulsions();
}; };
function highlightEntries(){ function highlightEntries(){
_$entrees_block_termlinks.removeClass('highlighted'); _$entrees_block_termlinks
.parents('li').removeClass('highlighted')
.parents('.item-list').removeClass('highlighted');
var id = -1; var id = -1;
if(_node_hover_id != -1){ if(_node_hover_id != -1){
id = _node_hover_id; id = _node_hover_id;
@@ -664,7 +701,8 @@
entree = _nodes[id].entrees[i]; entree = _nodes[id].entrees[i];
_$entrees_block_termlinks.filter(function(){ _$entrees_block_termlinks.filter(function(){
return $(this).attr('tid') == entree; return $(this).attr('tid') == entree;
}).addClass('highlighted'); }).parents('li').addClass('highlighted')
.parents('.item-list').addClass('highlighted');
} }
} }
}; };
@@ -802,6 +840,18 @@
} }
} }
}) })
.on('mouseover-audio-link', function(e){
console.log("Corpus on mouseover-audio-link", e);
// _node_hover_id = _nodes_Nid_Id[e.nid];
// _node_pop_up.setNode(_nodes_by_nid[e.nid]);
_nodes_by_nid[e.nid].setHover();
})
.on('mouseout-audio-link', function(e){
console.log("Corpus on mouseover-audio-link", e);
// _node_hover_id = -1;
// _node_pop_up.removeNode();
_nodes_by_nid[e.nid].unsetHover();
})
.on('audio-node-opened', function(e){ .on('audio-node-opened', function(e){
// console.log('Corpus audio-node-opened', e); // console.log('Corpus audio-node-opened', e);
openNodeByNid(e.nid); openNodeByNid(e.nid);
@@ -852,8 +902,12 @@
}) })
.on('new-content-not-entree-ajax-loaded', function(e){ .on('new-content-not-entree-ajax-loaded', function(e){
// close all entries only if entry already opened // close all entries only if entry already opened
// TODO: user the function close all entries ?
// closeAllEntries(); not working, is closing also the ajax loaded content
if(_$entrees_block_termlinks.parents('li.opened').length){ if(_$entrees_block_termlinks.parents('li.opened').length){
_$entrees_block_termlinks.parents('li').removeClass('opened'); _$entrees_block_termlinks
.parents('li').removeClass('opened')
.parents('.item-list').removeClass('opened');
scrambleCollection(); scrambleCollection();
} }
}); });
@@ -863,7 +917,8 @@
_$entrees_block.find('li.entree').each(function(index, el) { _$entrees_block.find('li.entree').each(function(index, el) {
var $li = $(this); var $li = $(this);
if($('a.is-active', $li).length){ if($('a.is-active', $li).length){
$li.addClass('opened'); $li.addClass('opened')
.parents('.item-list').addClass('opened');
filterEntree($li.attr('tid')); filterEntree($li.attr('tid'));
return false; return false;
} }
@@ -34,7 +34,7 @@ div.node-popup{
pointer-events: none; pointer-events: none;
.inner{ .inner{
padding:0.4em; padding:0.6em;
outline: 1px solid red; outline: 1px solid red;
background-color: white; background-color: white;
} }
@@ -63,6 +63,7 @@ function edlp_corpus_taxonomy_term_view(array &$build, EntityInterface $entity,
$query = \Drupal::entityQuery('node') $query = \Drupal::entityQuery('node')
->condition('status', 1) ->condition('status', 1)
->condition('type', 'enregistrement') ->condition('type', 'enregistrement')
->sort('title')
->condition('field_entrees', $entity->id()); ->condition('field_entrees', $entity->id());
$documents_nids = $query->execute(); $documents_nids = $query->execute();
@@ -1,4 +1,109 @@
(function ($, Drupal, drupalSettings) {
(function($,Drupal,drupalSettings){var settings=drupalSettings.edlp_search;var _$body=$('body');var _$container;var _$form;function init(){initEvents();initAjax();};function initEvents(){$('body').on('new-content-ajax-loaded',initAjax).on('edlp_search_search_form-col-closed',onSearchClosed);};function initAjax(){_$form=$('#edlp-search-form:not(.ajax-enabled)');if(!_$form.length)return false;_$form=$('#edlp-search-form:not(.ajax-enabled)').on('submit',onSubmitForm).addClass('ajax-enabled');_$container=_$form.parents('.row');if(!_$container.length){_$container=_$form.parent();}};function onSubmitForm(e){e.preventDefault();var args={};args.keys=$('input[type="search"]',this).val();args.entries=[];$('input[type="checkbox"]:checked','#edit-entries').each(function(index,el){args.entries.push($(this).val());});args.langues=$('input[name="langues"]',this).val();args.genres=$('input[name="genres"]',this).val();loadResults(args);return false;};function loadResults(args){_$form.addClass('ajax-loading');_$body.addClass('ajax-loading');$('[theme="edlp_search_results"]',_$container).addClass('ajax-loading');var path=window.location.origin+drupalSettings.path.baseUrl+settings.results_ajax_url;$.getJSON(path,args).done(function(data){onResultsLoaded(data);}).fail(function(jqxhr,textStatus,error){onResultsLoadFail(jqxhr,textStatus,error);});};function onResultsLoaded(data){_$form.removeClass('ajax-loading');_$body.removeClass('ajax-loading');$prev_results=$('[theme="edlp_search_results"]',_$container);if($prev_results.length){$prev_results.replaceWith(data.rendered);}else{_$container.append(data.rendered);} var settings = drupalSettings.edlp_search;
_$body.trigger({'type':'search-results-loaded','results':data.results_nids});};function onResultsLoadFail(jqxhr,textStatus,error){void 0;};function onSearchClosed(e){$('div[theme="edlp_search_results"]').remove();_$body.trigger({'type':'search-closed'});} var _$body = $('body');
init();})(jQuery,Drupal,drupalSettings); var _$container;
var _$form;
function init(){
// console.log('EdlpSearch Init', settings);
initEvents();
initAjax();
};
function initEvents(){
$('body')
.on('new-content-ajax-loaded', initAjax)
.on('edlp_search_search_form-col-closed', onSearchClosed);
};
function initAjax(){
_$form = $('#edlp-search-form:not(.ajax-enabled)');
if(!_$form.length) return false;
//console.log('EdlpSearch initAjaxForm()');
_$form = $('#edlp-search-form:not(.ajax-enabled)')
.on('submit', onSubmitForm)
.addClass('ajax-enabled');
_$container = _$form.parents('.row');
if(!_$container.length){
_$container = _$form.parent();
}
};
function onSubmitForm(e){
e.preventDefault();
// console.log('onSubmitForm',e);
var args = {};
// search for key words
args.keys = $('input[type="search"]', this).val();
// entries filter
args.entries = [];
$('input[type="checkbox"]:checked', '#edit-entries').each(function(index, el) {
args.entries.push($(this).val());
});
// langues
args.langues = $('input[name="langues"]', this).val();
// genres
args.genres = $('input[name="genres"]', this).val();
//console.log('EdlpSearch onSubmitForm() : args',args);
loadResults(args);
return false;
};
function loadResults(args){
//console.log('EdlpSearch loadResults() : args', args);
_$form.addClass('ajax-loading');
_$body.addClass('ajax-loading');
$('[theme="edlp_search_results"]', _$container).addClass('ajax-loading');
var path = window.location.origin + drupalSettings.path.baseUrl +settings.results_ajax_url;
$.getJSON(path, args)
.done(function(data){
onResultsLoaded(data);
})
.fail(function(jqxhr, textStatus, error){
onResultsLoadFail(jqxhr, textStatus, error);
});
};
function onResultsLoaded(data){
// console.log('EdlpSearch onResultsLoaded()', data);
_$form.removeClass('ajax-loading');
_$body.removeClass('ajax-loading');
// insert results col
$prev_results = $('[theme="edlp_search_results"]', _$container);
if($prev_results.length){
$prev_results.replaceWith(data.rendered);
}else{
_$container.append(data.rendered);
}
// trigger event
_$body.trigger({
'type':'search-results-loaded',
'results':data.results_nids
});
};
function onResultsLoadFail(jqxhr, textStatus, error){
console.warn('EdlpSearch : search results ajax load failed : '+error, jqxhr.responseText);
};
function onSearchClosed(e){
// console.log('Edlp Search onSearchClosed()');
$('div[theme="edlp_search_results"]').remove();
// trigger event
_$body.trigger({'type':'search-closed'});
}
init();
})(jQuery, Drupal, drupalSettings);
@@ -1,10 +1,408 @@
(function ($, Drupal, drupalSettings) {
(function($,Drupal,drupalSettings){var _settings=drupalSettings.edlp_studio;var $composer;function init(){initEvents();initStudio();};function initEvents(){$('body').on('new-audio-cartel-loaded',initAjaxChutierLinks).on('new-content-ajax-loaded',initStudio).on('all-modal-closed',initStudio);};function initStudio(){if($('#studio-ui').length){$composer=$('.composition_ui .composer','#studio-ui');initAjaxChutierLinks();initAjaxCompoLinks();initDragAndDropUI();$('body').trigger({'type':'studio-initialized'});}else{$('body').trigger({'type':'studio-not-active'});}} var _settings = drupalSettings.edlp_studio;
function initAjaxChutierLinks(){$('.chutier-ajax-link:not(.ajax-enabled)').addClass('ajax-enabled').on('click',onClickChutierAjaxLink);};function onClickChutierAjaxLink(e){e.preventDefault();addRemoveToChutier($(this));return false;};function addRemoveToChutier($link){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$link.addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onActionToChutierDone($link,data);}).fail(function(jqxhr,textStatus,error){onErrorActionToChutier(jqxhr,textStatus,error,$link);});};function onActionToChutierDone($link,data){$('body').trigger({'type':'chutier-action-done','action_done':data.action_done,'new_action':data.action_done=='add'?'remove':'add','target_id':$link.attr('target_id'),});$link.replaceWith(data.new_link);initAjaxChutierLinks();updateStudioChutier();};function onErrorActionToChutier(jqxhr,textStatus,error,$link){void 0;};function initAjaxCompoLinks(){$('.new-composition-link:not(.ajax-enabled)').on('click',onClickNewCompoLink).addClass('ajax-enabled');$('.composition-link:not(.ajax-enabled)').on('click',onClickCompoLink).addClass('ajax-enabled');$('.delete-composition-link:not(.ajax-enabled)').on('click',onClickDeleteCompoLink).addClass('ajax-enabled');};function onClickCompoLink(e){e.preventDefault();openCompo($(this));return false;};function openCompo($link){var cid=$link.attr('cid');var ajax_path=_settings.open_compo_ajax_url+'/'+cid;var path=window.location.origin+Drupal.url(ajax_path);$link.addClass('ajax-loading');$composer.addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onOpenCompoDone(data,$link);}).fail(function(jqxhr,textStatus,error){onErrorOpenCompo(jqxhr,textStatus,error,$link);});};function onOpenCompoDone(data,$link){$('.composition-link').removeClass('is-active');$link.removeClass('ajax-loading').addClass('is-active');if($('.composition',$composer).length){$('.composition',$composer).replaceWith(data.compo);}else{$('header',$composer).after(data.compo);} var $composer;
$composer.removeClass('ajax-loading');initDragAndDropUI();$('body').trigger({'type':'on-studio-compo-opened'});};function onErrorOpenCompo(jqxhr,textStatus,error,$link){$link.removeClass('ajax-loading');void 0;};function onClickNewCompoLink(e){e.preventDefault();setInputForNewCompoName($(this));return false;};function setInputForNewCompoName($link){var $form=$('<form>').addClass('new-compo-form').append($('<input>').attr('type','text').attr('placeholder','new name')).append($('<button>').attr('type','submit').html('+')).submit(function(e){onNewCompoFormSubmit(e,$link,$(this));});$link.after($form).addClass('folded');$form.children('input[type="text"]').focus();};function onNewCompoFormSubmit(e,$link,$form){var name=$('input[type="text"]',$form).val();if(name!=''){$form.addClass('ajax-loading').children('*').attr('disabled','disabled');createNewCompo(name,$link,$form);}
e.preventDefault();};function createNewCompo(name,$link,$form){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$.getJSON(path,{'new_name':name}).done(function(data){onCreateCompoDone(data,$link,$form);}).fail(function(jqxhr,textStatus,error){onErrorCreateCompo(jqxhr,textStatus,error,$link);});};function onCreateCompoDone(data,$link,$form){var $new_link=$(data.new_link);var $delete_link=$(data.delete_link);$link.removeClass('folded').parents('li').before($('<li>').append($new_link).append($delete_link));$form.remove();initAjaxCompoLinks();openCompo($new_link);};function onErrorCreateCompo(jqxhr,textStatus,error,$link){void 0;};function onClickDeleteCompoLink(e){e.preventDefault();deleteCompo($(this));return false;};function deleteCompo($link){var ajax_path=$link.attr('data-drupal-link-system-path');var path=window.location.origin+Drupal.url(ajax_path);$link.parents('li').addClass('ajax-loading');$.getJSON(path,{}).done(function(data){onDeleteCompoDone(data,$link);}).fail(function(jqxhr,textStatus,error){onErrorDeleteCompo(jqxhr,textStatus,error,$link);});};function onDeleteCompoDone(data,$link,$form){if(data.status=="ok"){$link.parents('li').remove();if($('.composition-link').length){openCompo($('.composition-link').eq(0));}else{$('.composition',$composer).html();}}else{void 0;}};function onErrorDeleteCompo(jqxhr,textStatus,error,$link){$link.parents('li').removeClass('ajax-loading');void 0;};function updateStudioChutier(){$studioChutier=$('#studio-ui .chutier_ui');if($studioChutier.length){var ajax_path=_settings.chutier_ui_ajax;var path=window.location.origin+drupalSettings.path.baseUrl+ajax_path;$studioChutier.addClass('loading');$.getJSON(path,{}).done(function(data){onLoadedChutier($studioChutier,data);}).fail(function(jqxhr,textStatus,error){onLoadChutierError(jqxhr,textStatus,error,$studioChutier);});}};function onLoadedChutier($studioChutier,data){$studioChutier.replaceWith(data.rendered);initAjaxChutierLinks();setChutierDraggable();$('body').trigger({'type':'on-studio-chutier-updated'});} // audio play is handled by edlp_theme
function onLoadChutierError(jqxhr,textStatus,error,$studioChutier){void 0;$studioChutier.removeClass('loading');}
function initDragAndDropUI(){if(!$('.composition_ui .composer .composition .field--name-documents').length){$field_documents=$('<div>').addClass('field').addClass('field--name-documents').appendTo('.composition_ui .composer .composition');}else{$field_documents=$('.composition_ui .composer .composition .field--name-documents');$('.field__item',$field_documents).each(function(i){$(this).prepend($('<span>').addClass('handler'));});} function init(){
var $remove_zone=$('<div>').addClass('remove-drop-zone').appendTo('.composition_ui .composer .composition').droppable({tolerance:'pointer',over:function(e,ui){ui.draggable.addClass('ready-to-remove');},out:function(e,ui){ui.draggable.removeClass('ready-to-remove');},drop:function(e,ui){ui.draggable.remove();}});$field_documents.sortable({revert:false,handle:".handler",receive:function(e,ui){$('.field__item',this).attr('style','');},update:function(e,ui){onOrderChanged(e,ui);},connectWith:$remove_zone,});setChutierDraggable();};function setChutierDraggable(){$('.chutier_ui .item-list li>div').draggable({containment:$('#studio-ui'),scroll:false,helper:function(e){return $('<div>').addClass('field__item').append($('<article>').addClass('node').append($('<h2>').addClass('node-title').append($('.audio-link',this).clone().removeClass('ajax-enable')))).prepend($('<span>').addClass('handler'));},cursorAt:{bottom:10,left:10},zIndex:999,revert:true,revertDuration:0,connectToSortable:$('.composition_ui .composer .composition .field--name-documents'),});} // console.log('Studio Init');
function onOrderChanged(e,ui){var cid=$(e.target).parents('.composition').attr('cid');var documents={};$('a',e.target).each(function(i){documents[i]=$(this).attr('nid');});recordCompoList(cid,documents);};function recordCompoList(cid,docs){var ajax_path=_settings.save_compo_ajax_url+'/'+cid;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{documents:docs}).done(function(data){onRecordCompoDone(data);}).fail(function(jqxhr,textStatus,error){onErrorRecordCompo(jqxhr,textStatus,error);});$('body').trigger({'type':'on-studio-compo-updated'});} initEvents();
function onRecordCompoDone(data){if(data.status=="ok"){}else{void 0;}};function onErrorRecordCompo(jqxhr,textStatus,error){void 0;};init();})(jQuery,Drupal,drupalSettings); initStudio();
};
function initEvents(){
$('body')
.on('new-audio-cartel-loaded', initAjaxChutierLinks)
.on('new-content-ajax-loaded', initStudio)
.on('all-modal-closed', initStudio);
};
function initStudio(){
if($('#studio-ui').length){
$composer = $('.composition_ui .composer', '#studio-ui');
initAjaxChutierLinks();
initAjaxCompoLinks();
initDragAndDropUI();
$('body').trigger({'type':'studio-initialized'});
}else{
$('body').trigger({'type':'studio-not-active'});
}
}
// ___ _ _ _ _ _ _ _ _ _
// / __| |_ _ _| |_(_)___ _ _ | \| |___ __| |___ | | (_)_ _ | |__ ___
// | (__| ' \ || | _| / -_) '_| | .` / _ \/ _` / -_) | |__| | ' \| / /(_-<
// \___|_||_\_,_|\__|_\___|_| |_|\_\___/\__,_\___| |____|_|_||_|_\_\/__/
function initAjaxChutierLinks(){
//console.log('studio initAjaxChutierLinks');
$('.chutier-ajax-link:not(.ajax-enabled)')
.addClass('ajax-enabled')
.on('click', onClickChutierAjaxLink);
};
function onClickChutierAjaxLink(e){
//console.log('studio onClickAjaxLink chutier');
e.preventDefault();
addRemoveToChutier($(this));
return false;
};
function addRemoveToChutier($link){
// var ajax_path = 'edlp_studio/ajax/chutier/add/'+id; // + '/' +cid;
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
$link.addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onActionToChutierDone($link, data);
})
.fail(function(jqxhr, textStatus, error){
onErrorActionToChutier(jqxhr, textStatus, error, $link);
});
};
function onActionToChutierDone($link, data){
//console.log('onActionToChutierDone',data);
$('body').trigger({
'type':'chutier-action-done',
'action_done':data.action_done,
'new_action':data.action_done == 'add' ? 'remove' : 'add',
'target_id':$link.attr('target_id'),
});
$link.replaceWith(data.new_link);
initAjaxChutierLinks();
// reload Studio chutier_ui's documents list
updateStudioChutier();
};
function onErrorActionToChutier(jqxhr, textStatus, error, $link){
console.warn('action to chuttier load failed : '+error, jqxhr.responseText);
};
// ___ _ _ _
// / __|___ _ __ _ __ ___ __(_) |_(_)___ _ _ ___
// | (__/ _ \ ' \| '_ \/ _ (_-< | _| / _ \ ' \(_-<
// \___\___/_|_|_| .__/\___/__/_|\__|_\___/_||_/__/
// |_|
function initAjaxCompoLinks(){
//console.log('studio initAjaxCompoLinks');
$('.new-composition-link:not(.ajax-enabled)')
.on('click', onClickNewCompoLink)
.addClass('ajax-enabled');
$('.composition-link:not(.ajax-enabled)')
.on('click', onClickCompoLink)
.addClass('ajax-enabled');
$('.delete-composition-link:not(.ajax-enabled)')
.on('click', onClickDeleteCompoLink)
.addClass('ajax-enabled');
};
// ___ ___
// / _ \ _ __ ___ _ _ / __|___ _ __ _ __ ___
// | (_) | '_ \/ -_) ' \ | (__/ _ \ ' \| '_ \/ _ \
// \___/| .__/\___|_||_| \___\___/_|_|_| .__/\___/
// |_| |_|
function onClickCompoLink(e){
e.preventDefault();
//console.log('onClickCompoLink');
openCompo($(this));
return false;
};
function openCompo($link){
var cid = $link.attr('cid');
var ajax_path = _settings.open_compo_ajax_url+'/'+cid;
var path = window.location.origin + Drupal.url(ajax_path);
$link.addClass('ajax-loading');
$composer.addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onOpenCompoDone(data, $link);
})
.fail(function(jqxhr, textStatus, error){
onErrorOpenCompo(jqxhr, textStatus, error, $link);
});
};
function onOpenCompoDone(data, $link){
//console.log('onActionToCompoDone',data);
$('.composition-link').removeClass('is-active');
$link.removeClass('ajax-loading').addClass('is-active');
if($('.composition', $composer).length){
$('.composition', $composer).replaceWith(data.compo);
}else{
$('header', $composer).after(data.compo);
}
$composer.removeClass('ajax-loading');
initDragAndDropUI();
$('body').trigger({
'type':'on-studio-compo-opened'
});
};
function onErrorOpenCompo(jqxhr, textStatus, error, $link){
$link.removeClass('ajax-loading');
console.warn('open compo load failed : '+error, jqxhr.responseText);
};
// _ _ _____ __ __ __ ___ _ __ _ __ ___
// | ' \/ -_) V V / / _/ _ \ ' \| '_ \/ _ \
// |_||_\___|\_/\_/ \__\___/_|_|_| .__/\___/
// |_|
function onClickNewCompoLink(e){
e.preventDefault();
setInputForNewCompoName($(this));
return false;
};
function setInputForNewCompoName($link){
var $form = $('<form>').addClass('new-compo-form')
.append($('<input>').attr('type', 'text').attr('placeholder', 'new name'))
.append($('<button>').attr('type', 'submit').html('+'))
.submit(function(e){
onNewCompoFormSubmit(e, $link, $(this));
});
$link
.after($form)
.addClass('folded');
$form.children('input[type="text"]').focus();
};
function onNewCompoFormSubmit(e, $link, $form){
var name = $('input[type="text"]',$form).val();
//console.log('onNewCompoFormSubmit', name);
if(name != ''){
$form.addClass('ajax-loading').children('*').attr('disabled', 'disabled');
createNewCompo(name, $link, $form);
}
e.preventDefault();
};
function createNewCompo(name,$link, $form){
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
// $link.addClass('ajax-loading');
$.getJSON(path, {
'new_name':name
})
.done(function(data){
onCreateCompoDone(data, $link, $form);
})
.fail(function(jqxhr, textStatus, error){
onErrorCreateCompo(jqxhr, textStatus, error, $link);
});
};
function onCreateCompoDone(data, $link, $form){
//console.log('onActionToCompoDone',data);
var $new_link = $(data.new_link);
var $delete_link = $(data.delete_link);
$link
.removeClass('folded')
.parents('li')
.before($('<li>').append($new_link).append($delete_link));
$form.remove();
// open new composition to composer
initAjaxCompoLinks();
openCompo($new_link);
};
function onErrorCreateCompo(jqxhr, textStatus, error, $link){
console.warn('action to compo load failed : '+error, jqxhr.responseText);
};
// ___ _ _
// | \ ___| |___| |_ ___ __ ___ _ __ _ __ ___
// | |) / -_) / -_) _/ -_) / _/ _ \ ' \| '_ \/ _ \
// |___/\___|_\___|\__\___| \__\___/_|_|_| .__/\___/
// |_|
function onClickDeleteCompoLink(e){
e.preventDefault();
// TODO: confirm compo deletion
deleteCompo($(this));
return false;
};
function deleteCompo($link){
var ajax_path = $link.attr('data-drupal-link-system-path');
var path = window.location.origin + Drupal.url(ajax_path);
$link.parents('li').addClass('ajax-loading');
$.getJSON(path, {})
.done(function(data){
onDeleteCompoDone(data, $link);
})
.fail(function(jqxhr, textStatus, error){
onErrorDeleteCompo(jqxhr, textStatus, error, $link);
});
};
function onDeleteCompoDone(data, $link, $form){
//console.log('onDeleteCompoDone',data);
if(data.status == "ok"){
$link.parents('li').remove();
//console.log("$('.composition-link').length", $('.composition-link').length);
if($('.composition-link').length){
openCompo($('.composition-link').eq(0));
}else{
$('.composition', $composer).html();
}
}else{
console.warn(data.message);
}
};
function onErrorDeleteCompo(jqxhr, textStatus, error, $link){
$link.parents('li').removeClass('ajax-loading');
console.warn('delete compo load failed : '+error, jqxhr.responseText);
};
// ___ _ _ _ _
// / __| |_ _ _ __| (_)___ ___ _ _(_)
// \__ \ _| || / _` | / _ \___| || | |
// |___/\__|\_,_\__,_|_\___/ \_,_|_|
// this seems dirty
function updateStudioChutier(){
$studioChutier = $('#studio-ui .chutier_ui');
if($studioChutier.length){
var ajax_path = _settings.chutier_ui_ajax;
var path = window.location.origin + drupalSettings.path.baseUrl + ajax_path;
$studioChutier.addClass('loading');
$.getJSON(path, {})
.done(function(data){
onLoadedChutier($studioChutier, data);
})
.fail(function(jqxhr, textStatus, error){
onLoadChutierError(jqxhr, textStatus, error, $studioChutier);
});
}
};
function onLoadedChutier($studioChutier, data){
$studioChutier.replaceWith(data.rendered);
initAjaxChutierLinks();
// set chutier element draggable again
setChutierDraggable();
$('body').trigger({
'type':'on-studio-chutier-updated'
});
}
function onLoadChutierError(jqxhr, textStatus, error, $studioChutier){
console.warn('Chutier load failed', jqxhr.responseText);
$studioChutier.removeClass('loading');
}
// ___ __ ___ _ _ ___
// | \ _ _ __ _ __ _ / _|___ | \ _ _ ___ _ __ | | | |_ _|
// | |) | '_/ _` / _` | > _|_ _| | |) | '_/ _ \ '_ \ | |_| || |
// |___/|_| \__,_\__, | \_____| |___/|_| \___/ .__/ \___/|___|
// |___/ |_|
function initDragAndDropUI(){
// check if field--name-documents exists
if (!$('.composition_ui .composer .composition .field--name-documents').length) {
// if not create it
$field_documents = $('<div>')
.addClass('field').addClass('field--name-documents')
.appendTo('.composition_ui .composer .composition');
}else{
// add real dom square element to handle sorting
$field_documents = $('.composition_ui .composer .composition .field--name-documents'); $('.field__item', $field_documents).each(function(i){
$(this).prepend($('<span>').addClass('handler'));
});
}
// create remove dropzone
var $remove_zone = $('<div>').addClass('remove-drop-zone')
.appendTo('.composition_ui .composer .composition')
.droppable({
tolerance:'pointer',
// scope:'composition_ui',
over:function(e,ui){
// console.log('on over remove : ui', ui);
ui.draggable.addClass('ready-to-remove');
},
out:function(e,ui){
// console.log('on over remove : ui', ui);
ui.draggable.removeClass('ready-to-remove');
},
drop:function(e,ui){
// console.log('on drop remove : ui', ui);
ui.draggable.remove();
// onOrderChanged(ui);
}
});
// create sortable
$field_documents.sortable({
revert:false,
handle: ".handler",
receive:function(e, ui){
$('.field__item', this).attr('style', '');
// TODO: trigger event to enable new audiolink player
},
update:function(e, ui){
onOrderChanged(e, ui);
},
connectWith : $remove_zone,
});
// set chutier element draggable
setChutierDraggable();
};
function setChutierDraggable(){
$('.chutier_ui .item-list li>div').draggable({
containment:$('#studio-ui'),
scroll:false,
helper:function(e){
// we reproduce here the irem structure of destination sortable elements
// var $audio_link = $('.audio-link',this);
return $('<div>').addClass('field__item')
.append(
$('<article>').addClass('node').append(
$('<h2>').addClass('node-title').append(
// $('<a>')
// .attr('nid', $audio_link.attr('nid'))
// .html($audio_link.html())
$('.audio-link',this).clone().removeClass('ajax-enable')
)
)
)
.prepend($('<span>').addClass('handler'));
},
// cursor:'grab',
cursorAt:{bottom:10,left:10},
zIndex:999,
revert:true,
revertDuration:0,
connectToSortable:$('.composition_ui .composer .composition .field--name-documents'),
});
}
function onOrderChanged(e, ui){
//console.log('onOrderChanged : e', e);
var cid = $(e.target).parents('.composition').attr('cid');
var documents = {};
$('a', e.target).each(function(i) {
// console.log(this);
documents[i] = $(this).attr('nid');
});
// console.log(documents);
recordCompoList(cid, documents);
};
function recordCompoList(cid, docs){
//console.log('recordCompoList '+cid, docs);
var ajax_path = _settings.save_compo_ajax_url+'/'+cid;
var path = window.location.origin + Drupal.url(ajax_path);
//console.log('path', path);
$.getJSON(path, {
documents:docs
})
.done(function(data){
onRecordCompoDone(data);
})
.fail(function(jqxhr, textStatus, error){
onErrorRecordCompo(jqxhr, textStatus, error);
});
$('body').trigger({
'type':'on-studio-compo-updated'
});
}
function onRecordCompoDone(data){
//console.log('onDeleteCompoDone',data);
if(data.status == "ok"){
}else{
console.warn(data.message);
}
};
function onErrorRecordCompo(jqxhr, textStatus, error){
console.warn('record compo failed : '+error, jqxhr.responseText);
};
init();
})(jQuery, Drupal, drupalSettings);
@@ -1,2 +1,20 @@
console.log('EDLP THEME HISTORY.js');
// var edlp is provided by edlp_ajax.module file
if(edlp.redirect){
console.log('history redirect', edlp);
console.log('window.location', window.location);
// window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
edlp.sys_path = edlp.sys_path.replace(/^\//, '');
void 0;if(edlp.redirect){void 0;void 0;edlp.sys_path=edlp.sys_path.replace(/^\//,'');edlp.url=window.location.pathname;edlp.hash=window.location.hash;window.localStorage.setItem('edlp_origin',JSON.stringify(edlp));window.location.replace(window.location.origin+'/'+edlp.lang_code);}else{void 0;} // window.localStorage.setItem('edlp_origin_url', window.location.pathname);
edlp.url = window.location.pathname;
// window.localStorage.setItem('edlp_origin_hash', window.location.hash);
edlp.hash = window.location.hash;
window.localStorage.setItem('edlp_origin', JSON.stringify(edlp));
// redirect to home
window.location.replace(window.location.origin+'/'+edlp.lang_code);
}else{
console.log('history do not redirect');
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -81,7 +81,9 @@
history.pushState(state, null, e.url); 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'){ if(typeof state.selector != 'undefined'){
// in case of entree link (actualy, selector is used only for entries links) // 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); console.log('selector', state.selector);
$('a[selector="'+state.selector+'"]').addClass('is-active'); $('a[selector="'+state.selector+'"]').addClass('is-active');
initAudioLinksInContent();
}else{ }else{
if(typeof state.view_mode != 'undefined'){ if(typeof state.view_mode != 'undefined'){
$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active'); $('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(){ function addCloseModalBtnToCols(){
$('.col', _$row).each(function(index, el) { $('.col', _$row).each(function(index, el) {
@@ -305,25 +334,28 @@
$(this).children('.wrapper').prepend($('<span>') $(this).children('.wrapper').prepend($('<span>')
.addClass('close-col-btn') .addClass('close-col-btn')
.on('click', function(e){ .on('click', onCloseModal)
// 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();
}
})
); );
}); });
}; };
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 origin_sys_path = window.localStorage.getItem('edlp_origin_path');
var edlp_origin = JSON.parse(window.localStorage.getItem('edlp_origin')); var edlp_origin = JSON.parse(window.localStorage.getItem('edlp_origin'));
console.log('edlp_origin', edlp_origin);
if(edlp_origin != null && edlp_origin.sys_path){ if(edlp_origin != null && edlp_origin.sys_path){
// var origin_url = window.localStorage.getItem('edlp_origin_url'); // hash is used as viewmode for taxonomy term entrees load (index or notice)
// origin_hash is used as viewmode for taxonomy term entrees load (index or notice) // and for audio contents (article|transcript)
// var origin_hash = window.localStorage.getItem('edlp_origin_hash');
var view_mode = edlp_origin.hash.replace('#', ''); var view_mode = edlp_origin.hash.replace('#', '');
// // TODO: refactorize with new infos from edlp_origin // create history state
if(view_mode){ var state = getSysPathState(edlp_origin.sys_path, view_mode);
var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+view_mode+'"]');
var selector = $link.attr('selector') || null; // open entree tray in case of entree index|notice
if(selector){ // (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) // in case of entree link (actualy, selector is used only for entries links)
// TODO: use a promise // TODO: use a promise
// TODO: but what if corpus ready before onAjaxLoaded >> use a promise !!
if(_corpus_ready){ if(_corpus_ready){
_$corpus_canvas.trigger({ _$corpus_canvas.trigger({
type:'open-entree', type:'open-entree',
tid:$link.attr('tid') // tid:$link.attr('tid')
tid:edlp_origin.entity_id
}); });
}else{ }else{
// else : EdlpCorpus will check when ready if entry item (notice or index) is already .is-active // 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) // .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 // check if audio link
if(edlp_origin.audio_url){ if(edlp_origin.audio_url){
var node = { var node = {
@@ -1205,13 +1247,16 @@
// |_||_| \___/_||_\__|_| \__,_\__, \___| // |_||_| \___/_||_\__|_| \__,_\__, \___|
// |___/ // |___/
function backToFrontPage(pop_state){ function backToFrontPage(pop_state){
console.log('backToFrontPage', pop_state);
closeAllModals(); closeAllModals();
// assume we are going back to front page // assume we are going back to front page
$('body').removeClass().addClass('path-frontpage'); $('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active'); $('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// close entrees // close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'}); _$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); history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
} }
} }
@@ -339,9 +339,12 @@ main[role="main"]{
} }
div.taxonomy-term{ div.taxonomy-term{
>h2{display:none;} >h2{
// display:none;
@include content_subtitles;
margin: 1em 0 0.5em;
}
>.content{ >.content{
margin-top: 1em;
} }
.field__label{ .field__label{
@include content_titles; @include content_titles;
@@ -1537,185 +1540,195 @@ footer{
display: inline-block; display: inline-block;
// vertical-align: top; // vertical-align: top;
ul{ div.item-list{
margin:0; ul{
white-space: nowrap;
li{
@include oblique-list;
margin:0; margin:0;
white-space: nowrap; white-space: nowrap;
pointer-events: none; li{
span.oblique-wrapper{ @include oblique-list;
height:120px; // this is needed to respect the height of oblique links :( margin:0;
display: inline-block; white-space: nowrap;
vertical-align: bottom; pointer-events: none;
position: relative; span.oblique-wrapper{
width:1.5em; height:120px; // this is needed to respect the height of oblique links :(
} display: inline-block;
vertical-align: bottom;
a.term-link, a.articles-link{ position: relative;
// outline: 1px solid blue; width:1.5em;
pointer-events: all;
background-color: #fff;
padding-right: 0.4em;
&:before{
content: "";
display:inline-block;
$sq:7px;
width: $sq; height:$sq;
border: 1px solid #000;
background-color: #000;
margin-right: 0.5em;
transition: background-color 0.1s ease-in-out;
} }
&.articles-link{ a.term-link, a.articles-link{
margin-left: 4em; // outline: 1px solid blue;
text-transform: capitalize; pointer-events: all;
} // background-color: #fff;
} background-color: rgba(255,255,255, 0.6);
padding-right: 0.4em;
.entree-content{ color:black;
display: inline-block; transition: color 0.3s ease-in-out;
// outline: 1px solid green;
width:0;
overflow: hidden;
opacity: 0;
transition: all 300ms ease-in-out;
transition-property: width,opacity;
span.oblique-wrapper:first-of-type{
margin-left: 0.5em;
}
span.oblique-wrapper a{
text-transform: none;
pointer-events: auto;
&:before{ &:before{
content: ""; content: "";
display:inline-block; display:inline-block;
$sq:5px; $sq:7px;
width: $sq; height:$sq; width: $sq; height:$sq;
border: 1px solid #000; border: 1px solid #000;
background-color: #000;
margin-right: 0.5em; margin-right: 0.5em;
transition: background-color 0.1s ease-in-out;
} }
&.ajax-loading:before{
@include spining-loader-square; &.articles-link{
margin-left: 4em;
text-transform: capitalize;
} }
} }
.term-description{
.entree-content{
display: inline-block; display: inline-block;
margin-left: 1.5em; // outline: 1px solid green;
text-align: left; width:0;
width:250px; overflow: hidden;
word-wrap:break-word; opacity: 0;
// word-break:break-all; transition: all 300ms ease-in-out;
hyphens: auto; transition-property: width,opacity;
white-space: normal; span.oblique-wrapper:first-of-type{
background-color: $transparent-bg; margin-left: 0.5em;
padding:0.5em; }
padding-bottom:0; span.oblique-wrapper a{
p{ text-transform: none;
font-size: 0.65em; pointer-events: auto;
margin:0; &:before{
content: "";
display:inline-block;
$sq:5px;
width: $sq; height:$sq;
border: 1px solid #000;
margin-right: 0.5em;
}
&.ajax-loading:before{
@include spining-loader-square;
}
}
.term-description{
display: inline-block;
margin-left: 1.5em;
text-align: left;
width:250px;
word-wrap:break-word;
// word-break:break-all;
hyphens: auto;
white-space: normal;
background-color: $transparent-bg;
padding:0.5em;
padding-bottom:0;
p{
font-size: 0.65em;
margin:0;
}
} }
} }
}
// TODO: replace variable system by attribute color // TODO: replace variable system by attribute color
// a.term-link:before, .entree-content span.oblique-wrapper a:before{ // a.term-link:before, .entree-content span.oblique-wrapper a:before{
// border-color: attr(color); // border-color: attr(color);
// background-color: attr(color); // background-color: attr(color);
// } // }
&[tid='134']{ &[tid='134']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-134);background-color: var(--e-col-134);}} border-color: var(--e-col-134);background-color: var(--e-col-134);}}
&[tid='121']{ &[tid='121']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-121);background-color: var(--e-col-121);}} border-color: var(--e-col-121);background-color: var(--e-col-121);}}
&[tid='125']{ &[tid='125']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-125);background-color: var(--e-col-125);}} border-color: var(--e-col-125);background-color: var(--e-col-125);}}
&[tid='119']{ &[tid='119']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-119);background-color: var(--e-col-119);}} border-color: var(--e-col-119);background-color: var(--e-col-119);}}
&[tid='132']{ &[tid='132']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-132);background-color: var(--e-col-132);}} border-color: var(--e-col-132);background-color: var(--e-col-132);}}
&[tid='122']{ &[tid='122']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-122);background-color: var(--e-col-122);}} border-color: var(--e-col-122);background-color: var(--e-col-122);}}
&[tid='129']{ &[tid='129']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-129);background-color: var(--e-col-129);}} border-color: var(--e-col-129);background-color: var(--e-col-129);}}
&[tid='120']{ &[tid='120']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-120);background-color: var(--e-col-120);}} border-color: var(--e-col-120);background-color: var(--e-col-120);}}
&[tid='130']{ &[tid='130']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-130);background-color: var(--e-col-130);}} border-color: var(--e-col-130);background-color: var(--e-col-130);}}
&[tid='118']{ &[tid='118']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-118);background-color: var(--e-col-118);}} border-color: var(--e-col-118);background-color: var(--e-col-118);}}
&[tid='127']{ &[tid='127']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-127);background-color: var(--e-col-127);}} border-color: var(--e-col-127);background-color: var(--e-col-127);}}
&[tid='133']{ &[tid='133']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-133);background-color: var(--e-col-133);}} border-color: var(--e-col-133);background-color: var(--e-col-133);}}
&[tid='128']{ &[tid='128']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-128);background-color: var(--e-col-128);}} border-color: var(--e-col-128);background-color: var(--e-col-128);}}
&[tid='124']{ &[tid='124']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-124);background-color: var(--e-col-124);}} border-color: var(--e-col-124);background-color: var(--e-col-124);}}
&[tid='116']{ &[tid='116']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-116);background-color: var(--e-col-116);}} border-color: var(--e-col-116);background-color: var(--e-col-116);}}
&[tid='117']{ &[tid='117']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-117);background-color: var(--e-col-117);}} border-color: var(--e-col-117);background-color: var(--e-col-117);}}
&[tid='131']{ &[tid='131']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-131);background-color: var(--e-col-131);}} border-color: var(--e-col-131);background-color: var(--e-col-131);}}
&[tid='126']{ &[tid='126']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-126);background-color: var(--e-col-126);}} border-color: var(--e-col-126);background-color: var(--e-col-126);}}
&[tid='123']{ &[tid='123']{
a.term-link:before, .entree-content span.oblique-wrapper a:before{ a.term-link:before, .entree-content span.oblique-wrapper a:before{
border-color: var(--e-col-123);background-color: var(--e-col-123);}} border-color: var(--e-col-123);background-color: var(--e-col-123);}}
// &.highlighted{ // &.highlighted{
// a.term_link{ // a.term_link{
// color: red; // color: red;
// } // }
// } // }
.entree-content span.oblique-wrapper a:not(:hover):not(.is-active):before{background-color: #fff!important;} .entree-content span.oblique-wrapper a:not(:hover):not(.is-active):before{background-color: #fff!important;}
a.articles-link:not(:hover):not(.is-active):before{ a.articles-link:not(:hover):not(.is-active):before{
background-color: #fff!important;
}
&:not(.opened){
a.term-link:not(:hover):not(.highlighted):before{
background-color: #fff!important; background-color: #fff!important;
} }
} &:not(.opened):not(.highlighted){
&.opened{ a.term-link:not(:hover):before{
// outline: 1px solid purple; background-color: #fff!important;
a.term-link:after { }
content: '';
position: absolute;
left: 15px; right:0;
bottom: -3px;
border-bottom: 1px solid grey;
} }
.entree-content{ &.opened{
width:350px; // outline: 1px solid purple;
opacity: 1; a.term-link:after {
content: '';
position: absolute;
left: 15px; right:0;
bottom: -3px;
border-bottom: 1px solid grey;
}
.entree-content{
width:350px;
opacity: 1;
}
}
// &:not(:first-of-type) .entree-content{display: none;}
}
}
&.opened, &.highlighted{
li:not(.opened):not(.highlighted){
a.term-link{
color:#a1a1a1;
} }
} }
// &:not(:first-of-type) .entree-content{display: none;}
} }
} }
} }
@@ -1854,6 +1867,9 @@ footer{
} }
} }
.chutier-icon{ .chutier-icon{
&[action="add"]{
display:none;
}
position:absolute; position:absolute;
top:0.4em; right:0.4em; top:0.4em; right:0.4em;
} }
@@ -28,7 +28,7 @@ header[role="banner"]{
>.wrapper{ >.wrapper{
position: relative; position: relative;
padding:0.5em 0; padding:0.5em 0;
border-bottom: 1px solid red; // border-bottom: 1px solid red;
// TODO: what header height to fit well with player ?? // TODO: what header height to fit well with player ??
height:70px; height:70px;
>.region{ >.region{
@@ -69,7 +69,7 @@ function edlptheme_preprocess_edlp_home(&$vars){
$cols = 2; $cols = 2;
break; break;
default: default:
$cols = 2; $cols = 3;
}; };
$node['cols'] = $cols; $node['cols'] = $cols;
} }
@@ -26,7 +26,7 @@
{% endfor %} {% endfor %}
<div class="agenda col col-2"> <div class="agenda col col-3">
<div class="wrapper"> <div class="wrapper">
{{ agenda }} {{ agenda }}
</div> </div>
@@ -18,4 +18,4 @@ matchers:
group_by_bundle: false group_by_bundle: false
include_unpublished: false include_unpublished: false
substitution_type: canonical substitution_type: canonical
metadata: '[node:langcode]' metadata: ''
@@ -223,7 +223,7 @@ display:
tags: { } tags: { }
page_1: page_1:
id: page_1 id: page_1
display_title: Page display_title: Production
display_plugin: page display_plugin: page
position: 2 position: 2
display_options: display_options:
@@ -990,7 +990,7 @@ display:
path: admin/content/production path: admin/content/production
menu: menu:
type: tab type: tab
title: Productions title: Content
description: '' description: ''
expanded: false expanded: false
parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175' parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175'
@@ -938,7 +938,7 @@ display:
page_1: page_1:
display_plugin: page display_plugin: page
id: page_1 id: page_1
display_title: Page display_title: Production
position: 1 position: 1
display_options: display_options:
display_extenders: { } display_extenders: { }
@@ -292,7 +292,7 @@ display:
path: node path: node
display_extenders: { } display_extenders: { }
display_plugin: page display_plugin: page
display_title: Page display_title: Production
id: page_1 id: page_1
position: 1 position: 1
cache_metadata: cache_metadata:
@@ -432,7 +432,7 @@ display:
tags: { } tags: { }
page_1: page_1:
id: page_1 id: page_1
display_title: Page display_title: Production
display_plugin: page display_plugin: page
position: 1 position: 1
display_options: display_options:
@@ -422,7 +422,7 @@ display:
page_1: page_1:
display_plugin: page display_plugin: page
id: page_1 id: page_1
display_title: Page display_title: Production
position: 1 position: 1
display_options: display_options:
path: admin/reports/maillog path: admin/reports/maillog
@@ -583,7 +583,7 @@ display:
page_1: page_1:
display_plugin: page display_plugin: page
id: page_1 id: page_1
display_title: Page display_title: Production
position: 1 position: 1
display_options: display_options:
display_extenders: { } display_extenders: { }
@@ -294,7 +294,7 @@ display:
tags: { } tags: { }
page_1: page_1:
id: page_1 id: page_1
display_title: Page display_title: Production
display_plugin: page display_plugin: page
position: 1 position: 1
display_options: display_options:
@@ -887,7 +887,7 @@ display:
page_1: page_1:
display_plugin: page display_plugin: page
id: page_1 id: page_1
display_title: Page display_title: Production
position: 1 position: 1
display_options: display_options:
path: admin/people/list path: admin/people/list