Compare commits

..
10 Commits
11 changed files with 335 additions and 128 deletions
@@ -40,3 +40,17 @@ edlp_admin.add_entry:
title: 'New Entry'
appears_on:
- view.entree_s_.page_1
edlp_admin.add_genre:
route_name: 'entity.taxonomy_term.add_form'
route_parameters:
taxonomy_vocabulary: 'genres'
title: 'New Genre'
appears_on:
- view.entree_s_.page_2
edlp_admin.add_langue:
route_name: 'entity.taxonomy_term.add_form'
route_parameters:
taxonomy_vocabulary: 'langues'
title: 'New Langue'
appears_on:
- view.entree_s_.page_3
@@ -1,21 +1,21 @@
(function($,Drupal,drupalSettings){EdlpCorpus=function(){var _activated=true;var _$body=$('body');var _$container=_$body;var _$canvas=$('<canvas id="corpus-map">').appendTo(_$container);var _canvas=_$canvas[0];var _ctx=_canvas.getContext('2d');var _canvas_props={'margin_top':100,'margin_right':0,'margin_bottom':100,'margin_left':0};var _physics=new Physics();var _nodes=[];var _articles_nodes=[];var _no_articles_nodes=[];var _nodes_by_entries={};var _nodes_by_nid={};var _nodes_Nid_Id={};var _nodes_centered=[];var _nodes_centered_attractions=[];var _playlist=[];var _p_velocity_factor=0.5;var _mouse_in=true;var _m_pos={x:0,y:0};var _node_hover_id=-1;var _node_opened_id=-1;var _$entrees_block=$('#block-edlpentreesblock');var _$entrees_block_termlinks=$('a.term-link',_$entrees_block);var _$articles_link;var _node_pop_up;var _settings=drupalSettings.edlp_corpus;var _ecolors=_settings.colors;var _attracter,_repulser_top,_repulser_center,_repulser_bottom,_scrambler_TL,_scrambler_TR,_scrambler_BR,_scrambler_BL,_scrambler_CL,_scrambler_CR;function init(){initCanvas();if(_activated){loadCorpus();}else{_$canvas.addClass('de-activated');}};function initCanvas(){window.addEventListener('resize',onResizeCanvas,false);onResizeCanvas();};function onResizeCanvas(){_canvas.width=window.innerWidth;_canvas.height=window.innerHeight;for(var i=0;i<_nodes.length;i++){_nodes[i].onResizeCanvas();resizePhysics();}};function loadCorpus(){var ajax_path=_settings.load_corpus_ajax_url;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(function(data){onCorpusLoaded(data);}).fail(function(jqxhr,textStatus,error){onCorpusLoadError(jqxhr,textStatus,error);});};function onCorpusLoadError(jqxhr,textStatus,error){void 0;};function onCorpusLoaded(data){initPhysics();buildNodes(data.nodes);initArtilesLink();initNodePopup();initEvents();checkPreOpenedEntry();startAnime();};function initPhysics(){_attracter=_physics.makeParticle(1000);_attracter.fixed=true;_repulser_top=_physics.makeParticle(100);_repulser_top.fixed=true;_repulser_center=_physics.makeParticle(100);_repulser_center.fixed=true;_repulser_bottom=_physics.makeParticle(100);_repulser_bottom.fixed=true;_scrambler_TL=_physics.makeParticle(100);_scrambler_TL.fixed=true;_scrambler_TR=_physics.makeParticle(100);_scrambler_TR.fixed=true;_scrambler_BR=_physics.makeParticle(100);_scrambler_BR.fixed=true;_scrambler_BL=_physics.makeParticle(100);_scrambler_BL.fixed=true;_scrambler_CR=_physics.makeParticle(100);_scrambler_CR.fixed=true;_scrambler_CL=_physics.makeParticle(100);_scrambler_CL.fixed=true;resizePhysics();};function resizePhysics(){_attracter.position={x:_canvas.width/2,y:_canvas.height/2};_repulser_top.position={x:_canvas.width/2,y:0};_repulser_center.position={x:_canvas.width/2,y:_canvas.height/2};_repulser_bottom.position={x:_canvas.width/2,y:_canvas.height};_scrambler_TL.position={x:-200,y:_canvas.height/40};_scrambler_BL.position={x:-200,y:_canvas.height-_canvas.height/40};_scrambler_TR.position={x:_canvas.width+200,y:_canvas.height/40};_scrambler_BR.position={x:_canvas.width+200,y:_canvas.height-_canvas.height/40};};function buildNodes(nodes){var d;for(var i in nodes){d=i<1?true:false;new Node(i,nodes[i],d);_playlist.push({'id':i,'nid':nodes[i].nid,'audio_url':nodes[i].audio_url});}};function Node(i,node,d){this.id=i;for(key in node)
(function($,Drupal,drupalSettings){EdlpCorpus=function(){var _activated=true;var _$body=$('body');var _$container=_$body;var _$canvas=$('<canvas id="corpus-map">').appendTo(_$container);var _canvas=_$canvas[0];var _ctx=_canvas.getContext('2d');var _canvas_props={'margin_top':90,'margin_right':0,'margin_bottom':65,'margin_left':0};var _physics=new Physics();var _nodes=[];var _articles_nodes=[];var _no_articles_nodes=[];var _nodes_by_entries={};var _nodes_by_nid={};var _nodes_Nid_Id={};var _nodes_centered=[];var _nodes_centered_attractions=[];var _playlist=[];var _p_velocity_factor=0.5;var _mouse_in=true;var _m_pos={x:0,y:0};var _node_hover_id=-1;var _node_opened_id=-1;var _$entrees_block=$('#block-edlpentreesblock');var _$entrees_block_termlinks=$('a.term-link',_$entrees_block);var _$articles_link;var _node_pop_up;var _settings=drupalSettings.edlp_corpus;var _ecolors=_settings.colors;var _attracter,_repulser_top,_repulser_center,_repulser_bottom,_scrambler_TL,_scrambler_TR,_scrambler_BR,_scrambler_BL,_scrambler_CL,_scrambler_CR;function init(){initCanvas();if(_activated){loadCorpus();}else{_$canvas.addClass('de-activated');}};function initCanvas(){window.addEventListener('resize',onResizeCanvas,false);onResizeCanvas();};function onResizeCanvas(){_canvas.width=window.innerWidth;_canvas.height=window.innerHeight;for(var i=0;i<_nodes.length;i++){_nodes[i].onResizeCanvas();resizePhysics();}};function loadCorpus(){var ajax_path=_settings.load_corpus_ajax_url;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(function(data){onCorpusLoaded(data);}).fail(function(jqxhr,textStatus,error){onCorpusLoadError(jqxhr,textStatus,error);});};function onCorpusLoadError(jqxhr,textStatus,error){void 0;};function onCorpusLoaded(data){initPhysics();buildNodes(data.nodes);initArtilesLink();initNodePopup();initEvents();checkPreOpenedEntry();startAnime();};function initPhysics(){_attracter=_physics.makeParticle(1000);_attracter.fixed=true;resizePhysics();};function resizePhysics(){_attracter.position={x:_canvas.width/2,y:_canvas.height/2};};function buildNodes(nodes){var d;for(var i in nodes){d=i<1?true:false;new Node(i,nodes[i],d);_playlist.push({'id':i,'nid':nodes[i].nid,'audio_url':nodes[i].audio_url});}};function Node(i,node,d){this.id=i;for(key in node)
this[key]=node[key];_nodes.push(this);_nodes_by_nid[this.nid]=this;_nodes_Nid_Id[this.nid]=this.id;if(this.has_article==1){_articles_nodes.push(this);}else{_no_articles_nodes.push(this);}
for(var j=0;j<this.entrees.length;j++){if(typeof _nodes_by_entries[this.entrees[j]]=='undefined')
_nodes_by_entries[this.entrees[j]]=[];_nodes_by_entries[this.entrees[j]].push(this);}
this.debug=d;this.mass=Math.max(1,this.entrees.length);this.velocity_threshold=0.01;switch(true){case this.entrees.length>3:this.r=10;break;case this.entrees.length>1&&this.entrees.length<=3:this.r=7;break;default:this.r=4;break;}
this.e_color='e_col_'+this.entrees[Math.floor(Math.random(this.entrees.length))];this.hover=false;this.opened=false;this.faded=false;this.center=false;this.aside=false;this.scrambling=false;this.n_repulses={};if(typeof Node.initialized=="undefined"){Node.prototype.init=function(){this.calcWallLimits();this.x=this.wall_limits.left+Math.random()*(this.wall_limits.right-this.wall_limits.left);this.y=this.wall_limits.top+Math.random()*(this.wall_limits.bottom-this.wall_limits.top);this.initPhysics();};Node.prototype.initPhysics=function(){this.p=_physics.makeParticle(this.mass,this.x,this.y);this.p.velocity=new Physics.Vector((Math.random()-0.5)*_p_velocity_factor,(Math.random()-0.5)*_p_velocity_factor);this.attract=_physics.makeAttraction(_attracter,this.p,1000,_canvas.width*2);this.attract.on=false;this.repulse_top=_physics.makeAttraction(_repulser_top,this.p,-60,_canvas.height/6);this.repulse_center=_physics.makeAttraction(_repulser_center,this.p,-50,_canvas.height/6);this.repulse_bottom=_physics.makeAttraction(_repulser_bottom,this.p,-60,_canvas.height/6);this.repulse_top.on=false;this.repulse_center.on=false;this.repulse_bottom.on=false;this.scramble_TL=_physics.makeAttraction(_scrambler_TL,this.p,-100,_canvas.height/2.5);this.scramble_TR=_physics.makeAttraction(_scrambler_TR,this.p,-100,_canvas.height/2.5);this.scramble_BR=_physics.makeAttraction(_scrambler_BR,this.p,-100,_canvas.height/2.5);this.scramble_BL=_physics.makeAttraction(_scrambler_BL,this.p,-100,_canvas.height/2.5);this.scramble_TL.on=false;this.scramble_TR.on=false;this.scramble_BR.on=false;this.scramble_BL.on=false;};Node.prototype.calcWallLimits=function(){this.wall_limits={top:_canvas_props.margin_top+this.r,right:_canvas.width-_canvas_props.margin_right-this.r,bottom:_canvas.height-_canvas_props.margin_bottom-this.r,left:_canvas_props.margin_left+this.r}};Node.prototype.onResizeCanvas=function(){this.calcWallLimits();};Node.prototype.onUpdate=function(){if(this.hover||this.opened){this.p.fixed=true;}else{this.p.fixed=false;}
this.e_color='e_col_'+this.entrees[Math.floor(Math.random(this.entrees.length))];this.hover=false;this.opened=false;this.faded=false;this.center=false;this.aside=false;this.scrambling=false;this.n_repulses={};if(typeof Node.initialized=="undefined"){Node.prototype.init=function(){this.calcWallLimits();this.x=this.wall_limits.left+Math.random()*(this.wall_limits.right-this.wall_limits.left);this.y=this.wall_limits.top+Math.random()*(this.wall_limits.bottom-this.wall_limits.top);this.ori_pos={x:this.x,y:this.y};this.initPhysics();};Node.prototype.initPhysics=function(){this.p=_physics.makeParticle(this.mass,this.x,this.y);this.p.velocity=new Physics.Vector((Math.random()-0.5)*_p_velocity_factor,(Math.random()-0.5)*_p_velocity_factor);this.ori_p=_physics.makeParticle(1000,this.ori_pos.x,this.ori_pos.y);this.ori_p.fixed=true;this.ori_p_attract=_physics.makeAttraction(this.ori_p,this.p,1000,_canvas.width*2);this.ori_p_attract.on=false;this.attract=_physics.makeAttraction(_attracter,this.p,1000,_canvas.width*2);this.attract.on=false;};Node.prototype.calcWallLimits=function(){this.wall_limits={top:_canvas_props.margin_top+this.r,right:_canvas.width-_canvas_props.margin_right-this.r,bottom:_canvas.height-_canvas_props.margin_bottom-this.r,left:_canvas_props.margin_left+this.r}};Node.prototype.onResizeCanvas=function(){this.calcWallLimits();this.shuffleOriP();};Node.prototype.shuffleOriP=function(){this.ori_pos.x=this.wall_limits.left+Math.random()*(this.wall_limits.right-this.wall_limits.left);this.ori_pos.y=this.wall_limits.top+Math.random()*(this.wall_limits.bottom-this.wall_limits.top);this.scramble();};Node.prototype.onUpdate=function(){if(this.hover||this.opened){this.p.fixed=true;}else{this.p.fixed=false;}
if(this.center)
this.limitEvolutionZone();if(!this.p.resting()){this.checkWallBouncing();this.updatePos();}
this.limitEvolutionZone();if(!this.p.resting()){this.checkWallBouncing();this.updatePos();if(this.scrambling){this.checkOriPDist();}}
if(_mouse_in&&!this.aside)
this.checkMouse();this.draw();};Node.prototype.checkVelocityThreshold=function(){if(!this.centered||!this.aside){if(Math.abs(this.p.velocity.x)<this.velocity_threshold&&Math.abs(this.p.velocity.y)<this.velocity_threshold){this.p.velocity.multiplyScalar(0);}}};Node.prototype.checkWallBouncing=function(){switch(true){case this.x<this.wall_limits.left&&this.p.velocity.x<0:this.p.position.x=this.wall_limits.left;this.p.velocity.multiplyScalarXY(-1,1).multiplyScalar(0.75);break;case this.x>this.wall_limits.right&&this.p.velocity.x>0:this.p.position.x=this.wall_limits.right;this.p.velocity.multiplyScalarXY(-1,1).multiplyScalar(0.75);break;case this.y<this.wall_limits.top&&this.p.velocity.y<0:this.p.position.y=this.wall_limits.top;this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75);break;case this.y>this.wall_limits.bottom&&this.p.velocity.y>0:this.p.position.y=this.wall_limits.bottom;this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75);break;}};Node.prototype.updatePos=function(){this.x=this.p.position.x;this.y=this.p.position.y;};Node.prototype.checkMouse=function(){if(_m_pos.x>this.x-this.r&&_m_pos.x<this.x+this.r&&_m_pos.y>this.y-this.r&&_m_pos.y<this.y+this.r){if(_node_hover_id==-1||_node_hover_id!==this.id){this.hover=true;_node_hover_id=this.id;_node_pop_up.setNode(this);}}else{this.hover=false;if(_node_hover_id==this.id){_node_hover_id=-1;_node_pop_up.removeNode();}}};Node.prototype.open=function(){this.opened=true;_node_opened_id=this.id;};Node.prototype.close=function(){this.opened=false;};Node.prototype.fade=function(){this.faded=true;};Node.prototype.unFade=function(){this.faded=false;};Node.prototype.setCenteredOnEntree=function(tid){this.e_color='e_col_'+tid;this.setCentered();};Node.prototype.setCentered=function(){this.center=true;this.stopScrambling();this.unsetAside();this.attract.on=true;}
Node.prototype.unsetCentered=function(){this.center=false;this.attract.on=false;}
Node.prototype.limitEvolutionZone=function(){this.dist_to_attracter=this.p.distanceTo(_attracter);if(this.dist_to_attracter<_canvas.width/4){if(this.p.velocity.length()>0.4){this.p.velocity.multiplyScalar(0.995);}}
if(Math.abs(_attracter.position.x-this.x)>_canvas.width/3||Math.abs(_attracter.position.y-this.y)>_canvas.height/3){this.attract.on=true;}else{this.attract.on=false;}}
Node.prototype.setAside=function(){this.aside=true;this.stopScrambling();this.unsetCentered();this.repulse_top.on=true;this.repulse_center.on=true;this.repulse_bottom.on=true;}
Node.prototype.unsetAside=function(){this.aside=false;this.repulse_top.on=false;this.repulse_center.on=false;this.repulse_bottom.on=false;}
Node.prototype.scramble=function(){this.scrambling=true;this.unsetCentered();this.unsetAside();this.scramble_TL.on=true;this.scramble_TR.on=true;this.scramble_BR.on=true;this.scramble_BL.on=true;}
Node.prototype.stopScrambling=function(){this.scrambling=false;this.scramble_TL.on=false;this.scramble_TR.on=false;this.scramble_BR.on=false;this.scramble_BL.on=false;}
Node.prototype.setAside=function(){this.aside=true;this.stopScrambling();this.unsetCentered();this.ori_p.position.x=this.x<_canvas.width/2?this.wall_limits.left:this.wall_limits.right;this.ori_p_attract.on=true;}
Node.prototype.unsetAside=function(){void 0;this.aside=false;this.ori_p_attract.on=false;this.ori_p.position.x=this.ori_pos.x;}
Node.prototype.scramble=function(){this.scrambling=true;this.unsetCentered();this.unsetAside();this.ori_p.position.x=this.ori_pos.x;this.ori_p.position.y=this.ori_pos.y;this.ori_p_attract.on=true;}
Node.prototype.checkOriPDist=function(){if(this.p.distanceTo(this.ori_p)<50){this.stopScrambling();}};Node.prototype.stopScrambling=function(){this.scrambling=false;this.ori_p_attract.on=false;}
Node.prototype.draw=function(){_ctx.beginPath();_ctx.globalAlpha=this.faded?0.1:1;_ctx.fillStyle=_ecolors[this.e_color];_ctx.fillRect(this.x-this.r,this.y-this.r,this.r*2,this.r*2);if(this.opened){_ctx.lineWidth='1px';_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);}
_ctx.globalAlpha=1;_ctx.closePath();};Node.initialized=true;}
this.init();};function checkParticulesCollisions(){var na,nb,ma,mb,w,h,dx,dy,makeup,newVelX1,newVelY1,newVelX2,newVelY2;for(var n=0,l=_nodes.length;n<l;n++){na=_nodes[n];ma=na.p.mass;if(na.scrambling)continue;for(var q=n+1;q<l;q++){nb=_nodes[q];mb=nb.p.mass;if((na.center&&nb.aside)||(na.aside&&nb.center))
@@ -25,13 +25,12 @@ newVelY1=(ma-mb)/(ma+mb)*na.p.velocity.y+2*mb/(ma+mb)*nb.p.velocity.y;newVelY2=(
newVelX1=(ma-mb)/(ma+mb)*na.p.velocity.x+2*mb/(ma+mb)*nb.p.velocity.x;newVelX2=(mb-ma)/(mb+ma)*nb.p.velocity.x+2*ma/(mb+ma)*na.p.velocity.x;na.p.velocity.x=newVelX1;nb.p.velocity.x=newVelX2;}
na.p.velocity.multiplyScalar(0.90);nb.p.velocity.multiplyScalar(0.90);}}};function openNodeByNid(nid){closeNode();if(typeof _nodes_Nid_Id[nid]!='undefined'){_node_opened_id=_nodes_Nid_Id[nid];_nodes[_nodes_Nid_Id[nid]].open();}}
function closeNode(){if(_node_opened_id!=-1){_nodes[_node_opened_id].close();_node_opened_id=-1;}}
function createNodesRepulsions(){purgeNodesRepulsions();for(var n=0;n<_nodes_centered.length;n++){for(var q=n+1;q<_nodes_centered.length;q++){_physics.makeAttraction(_nodes_centered[n].p,_nodes_centered[q].p,-0.4,10);}}};function purgeNodesRepulsions(){for(var a=_physics.attractions.length-1;a>=0;a--){if(Math.abs(_physics.attractions[a].constant)<1){_physics.attractions.splice(a,1);}else{break;}}};function openEntree(tid,bubbling){var $link=_$entrees_block_termlinks.filter('[tid="'+tid+'"]');var $li=$link.parents('li');var sys_path=$link.attr('data-drupal-link-system-path');var url=$link.attr('href');if(!$li.is('.opened')){_$entrees_block_termlinks.parents('li').removeClass('opened');$li.addClass('opened');filterEntree(tid);if(bubbling){_$body.trigger({'type':'open_entree','tid':tid,'url':url,'sys_path':sys_path});}}else if(bubbling){$li.removeClass('opened');scrambleCollection();_$body.trigger({'type':'close_entree','tid':tid});}};function filterEntree(t){shutDownArticles();_nodes_centered=[];for(var n=0;n<_nodes.length;n++){if(_nodes[n].entrees.indexOf(t)==-1){_nodes[n].setAside();}else{_nodes[n].setCenteredOnEntree(t);_nodes_centered.push(_nodes[n]);}}
function createNodesRepulsions(){purgeNodesRepulsions();for(var n=0;n<_nodes_centered.length;n++){for(var q=n+1;q<_nodes_centered.length;q++){_physics.makeAttraction(_nodes_centered[n].p,_nodes_centered[q].p,-0.4,10);}}};function purgeNodesRepulsions(){for(var a=_physics.attractions.length-1;a>=0;a--){if(Math.abs(_physics.attractions[a].constant)<1){_physics.attractions.splice(a,1);}else{break;}}};function toggleEntree(tid,bubbling){var $link=_$entrees_block_termlinks.filter('[tid="'+tid+'"]');var $li=$link.parents('li');var sys_path=$link.attr('data-drupal-link-system-path');var url=$link.attr('href');if(!$li.is('.opened')){_$entrees_block_termlinks.parents('li').removeClass('opened');$li.addClass('opened');filterEntree(tid);if(bubbling){_$body.trigger({'type':'open_entree','tid':tid,'url':url,'sys_path':sys_path});}}else if(bubbling){$li.removeClass('opened');scrambleCollection();_$body.trigger({'type':'close_entree','tid':tid});}};function filterEntree(t){shutDownArticles();_nodes_centered=[];for(var n=0;n<_nodes.length;n++){if(_nodes[n].entrees.indexOf(t)==-1){_nodes[n].setAside();}else{_nodes[n].setCenteredOnEntree(t);_nodes_centered.push(_nodes[n]);}}
createNodesRepulsions();};function highlightEntries(){_$entrees_block_termlinks.removeClass('highlighted');var id=-1;if(_node_hover_id!=-1){id=_node_hover_id;}else if(_node_opened_id!=-1){id=_node_opened_id;}
var entree;if(id!=-1){for(var i=0;i<_nodes[id].entrees.length;i++){entree=_nodes[id].entrees[i];_$entrees_block_termlinks.filter(function(){return $(this).attr('tid')==entree;}).addClass('highlighted');}}};function filterSearchResults(nids){shutDownArticles();_nodes_centered=[];for(var n=0;n<_nodes.length;n++){if(nids.indexOf(_nodes[n].nid)==-1){_nodes[n].setAside();}else{_nodes[n].setCentered();_nodes_centered.push(_nodes[n]);}}
createNodesRepulsions();};function scrambleCollection(){for(var i=0;i<_nodes.length;i++){_nodes[i].scramble();}
stopScrambling();};function stopScrambling(){for(var i=0;i<_nodes.length;i++){setTimeout(function(n){n.stopScrambling();}.bind(this,_nodes[i]),1000+Math.random()*4000);}};function closeAllEntries(){_$entrees_block_termlinks.each(function(index,el){if($(this).parents('li').is('.opened')){$(this).trigger('click');return false;}});};function initArtilesLink(){_$articles_link=$('<a>').html('Articles').attr("href","#articles").addClass('articles-link').on('click',onCLickedOnArticles);$('.item-list ul',_$entrees_block).append($('<li>').append($('<span class="oblique-wrapper">').append(_$articles_link)));};function onCLickedOnArticles(e){e.preventDefault();$(this).toggleClass('is-active');if($(this).is('.is-active')){filterArticles();closeAllEntries();}else{resetArticlesFilter();}
createNodesRepulsions();};function scrambleCollection(){for(var i=0;i<_nodes.length;i++){_nodes[i].scramble();}};function closeAllEntries(){_$entrees_block_termlinks.each(function(index,el){if($(this).parents('li').is('.opened')){$(this).trigger('click');return false;}});};function initArtilesLink(){_$articles_link=$('<a>').html('Articles').attr("href","#articles").addClass('articles-link').on('click',onCLickedOnArticles);$('.item-list ul',_$entrees_block).append($('<li>').append($('<span class="oblique-wrapper">').append(_$articles_link)));};function onCLickedOnArticles(e){e.preventDefault();$(this).toggleClass('is-active');if($(this).is('.is-active')){filterArticles();closeAllEntries();}else{resetArticlesFilter();}
return false;};function filterArticles(){for(var i=0;i<_no_articles_nodes.length;i++){_no_articles_nodes[i].fade();}};function resetArticlesFilter(){for(var i=0;i<_no_articles_nodes.length;i++){_no_articles_nodes[i].unFade();}};function shutDownArticles(){if(_$articles_link.is('.is-active'))
_$articles_link.trigger('click');};function initEvents(){void 0;_$canvas.on('mousemove',function(event){event.preventDefault();_m_pos.x=event.originalEvent.clientX;_m_pos.y=event.originalEvent.clientY;}).on('mouseenter',function(event){_mouse_in=true;}).on('mouseout',function(event){_mouse_in=false;_node_pop_up.removeNode();}).on('click',function(event){if(event.target.tagName!="A"&&event.target.tagName!="INPUT"){event.preventDefault();if(_node_hover_id!=-1){var event={'type':'corpus-cliked-on-node','target_node':{'id':_node_hover_id,'nid':_nodes[_node_hover_id].nid,'audio_url':_nodes[_node_hover_id].audio_url},};_$canvas.trigger(event);}else{_$canvas.trigger('corpus-cliked-on-map');}}}).on('audio-node-opened',function(e){openNodeByNid(e.nid);}).on('audio-node-closed',function(e){closeNode();}).on('open-entree',function(e){openEntree(e.tid);}).on('close-all-entree',function(e){closeAllEntries();});_$entrees_block_termlinks.on('click',function(event){void 0;event.preventDefault();openEntree($(this).attr('tid'),true);return false;});_$body.on('chutier-action-done',function(e){_nodes_by_nid[e.target_id].chutier_action=e.new_action;}).on('search-results-loaded',function(e){filterSearchResults(e.results);}).on('search-closed',function(e){scrambleCollection();}).on('new-content-not-entree-ajax-loaded',function(e){if(_$entrees_block_termlinks.parents('li.opened').length){_$entrees_block_termlinks.parents('li').removeClass('opened');scrambleCollection();}});};function checkPreOpenedEntry(){_$entrees_block.find('li.entree').each(function(index,el){var $li=$(this);if($('a.is-active',$li).length){$li.addClass('opened');filterEntree($li.attr('tid'));return false;}});};function initNodePopup(){_node_pop_up=new NodePopUp();};function NodePopUp(){this.visible=false;this.node;this.$dom=$('<div>').addClass('node-popup').attr('pos','top-right').appendTo('body');this.$content=$('<div>').addClass('inner').appendTo(this.$dom);if(typeof NodePopUp.initialized=="undefined"){NodePopUp.prototype.setNode=function(n){this.node=n;this.setPositioning();this.setContent();};NodePopUp.prototype.setPositioning=function(){switch(true){case this.node.x>this.node.wall_limits.right-350&&this.node.y<this.node.wall_limits.top+200:this.$dom.attr('pos','bottom-left');break;case this.node.x>this.node.wall_limits.right-350:this.$dom.attr('pos','top-left');break;case this.node.y<this.node.wall_limits.top+200:this.$dom.attr('pos','bottom-right');break;default:this.$dom.attr('pos','top-right');}};NodePopUp.prototype.setContent=function(){this.$content.html('');var $entrees=$('<div>').addClass('entrees');for(var i=0;i<this.node.entrees.length;i++){var tid=this.node.entrees[i];$entrees.append($('<span>').addClass('entree').attr('tid',tid));}
_$articles_link.trigger('click');};function initEvents(){void 0;_$canvas.on('mousemove',function(event){event.preventDefault();_m_pos.x=event.originalEvent.clientX;_m_pos.y=event.originalEvent.clientY;}).on('mouseenter',function(event){_mouse_in=true;}).on('mouseout',function(event){_mouse_in=false;_node_pop_up.removeNode();}).on('click',function(event){if(event.target.tagName!="A"&&event.target.tagName!="INPUT"){event.preventDefault();if(_node_hover_id!=-1){var event={'type':'corpus-cliked-on-node','target_node':{'id':_node_hover_id,'nid':_nodes[_node_hover_id].nid,'audio_url':_nodes[_node_hover_id].audio_url},};_$canvas.trigger(event);}else{_$canvas.trigger('corpus-cliked-on-map');}}}).on('audio-node-opened',function(e){openNodeByNid(e.nid);}).on('audio-node-closed',function(e){closeNode();}).on('open-entree',function(e){toggleEntree(e.tid);}).on('close-all-entree',function(e){closeAllEntries();});_$entrees_block_termlinks.on('click',function(event){event.preventDefault();toggleEntree($(this).attr('tid'),true);return false;});_$body.on('chutier-action-done',function(e){_nodes_by_nid[e.target_id].chutier_action=e.new_action;}).on('search-results-loaded',function(e){filterSearchResults(e.results);}).on('search-closed',function(e){scrambleCollection();}).on('new-content-not-entree-ajax-loaded',function(e){if(_$entrees_block_termlinks.parents('li.opened').length){_$entrees_block_termlinks.parents('li').removeClass('opened');scrambleCollection();}});};function checkPreOpenedEntry(){_$entrees_block.find('li.entree').each(function(index,el){var $li=$(this);if($('a.is-active',$li).length){$li.addClass('opened');filterEntree($li.attr('tid'));return false;}});};function initNodePopup(){_node_pop_up=new NodePopUp();};function NodePopUp(){this.visible=false;this.node;this.$dom=$('<div>').addClass('node-popup').attr('pos','top-right').appendTo('body');this.$content=$('<div>').addClass('inner').appendTo(this.$dom);if(typeof NodePopUp.initialized=="undefined"){NodePopUp.prototype.setNode=function(n){this.node=n;this.setPositioning();this.setContent();};NodePopUp.prototype.setPositioning=function(){switch(true){case this.node.x>this.node.wall_limits.right-350&&this.node.y<this.node.wall_limits.top+200:this.$dom.attr('pos','bottom-left');break;case this.node.x>this.node.wall_limits.right-350:this.$dom.attr('pos','top-left');break;case this.node.y<this.node.wall_limits.top+200:this.$dom.attr('pos','bottom-right');break;default:this.$dom.attr('pos','top-right');}};NodePopUp.prototype.setContent=function(){this.$content.html('');var $entrees=$('<div>').addClass('entrees');for(var i=0;i<this.node.entrees.length;i++){var tid=this.node.entrees[i];$entrees.append($('<span>').addClass('entree').attr('tid',tid));}
var $chutier_action=$('<span>').addClass('chutier-icon').attr('action',this.node.chutier_action);this.$content.append($entrees).append('<h2 class="title">'+this.node.title+'</h2>').append('<section class="description">'+this.node.description+'</section>').append($chutier_action);};NodePopUp.prototype.removeNode=function(){this.node=false;};NodePopUp.prototype.draw=function(){if(this.node){this.$dom.css({'display':"block",'left':this.node.x+"px",'top':this.node.y+"px",});}else{this.$dom.css({'display':"none",});}};NodePopUp.initialized=true;}}
function render(){_ctx.clearRect(0,0,_canvas.width,_canvas.height);checkParticulesCollisions();for(var i=0;i<_nodes.length;i++){_nodes[i].onUpdate();}
_node_pop_up.draw();if(_node_hover_id!=-1){_canvas.style.cursor='pointer';}else{_canvas.style.cursor='auto';}
@@ -25,9 +25,9 @@
var _canvas = _$canvas[0];
var _ctx = _canvas.getContext('2d');
var _canvas_props = {
'margin_top':100,
'margin_top':90,
'margin_right':0,
'margin_bottom':100,
'margin_bottom':65,
'margin_left':0
};
var _physics = new Physics();
@@ -142,41 +142,12 @@
function initPhysics(){
_attracter = _physics.makeParticle(1000);
_attracter.fixed = true;
_repulser_top = _physics.makeParticle(100);
_repulser_top.fixed = true;
_repulser_center = _physics.makeParticle(100);
_repulser_center.fixed = true;
_repulser_bottom = _physics.makeParticle(100);
_repulser_bottom.fixed = true;
_scrambler_TL = _physics.makeParticle(100);
_scrambler_TL.fixed = true;
_scrambler_TR = _physics.makeParticle(100);
_scrambler_TR.fixed = true;
_scrambler_BR = _physics.makeParticle(100);
_scrambler_BR.fixed = true;
_scrambler_BL = _physics.makeParticle(100);
_scrambler_BL.fixed = true;
_scrambler_CR = _physics.makeParticle(100);
_scrambler_CR.fixed = true;
_scrambler_CL = _physics.makeParticle(100);
_scrambler_CL.fixed = true;
// move _attracter and _repulser on window resize
// move _attracter on window resize
resizePhysics();
};
function resizePhysics(){
// attracters
_attracter.position = {x:_canvas.width/2, y:_canvas.height/2};
// repulsers
_repulser_top.position = {x:_canvas.width/2, y:0};
_repulser_center.position = {x:_canvas.width/2, y:_canvas.height/2};
_repulser_bottom.position = {x:_canvas.width/2, y:_canvas.height};
// scramblers
_scrambler_TL.position = {x:-200, y:_canvas.height/40};
_scrambler_BL.position = {x:-200, y:_canvas.height-_canvas.height/40};
// _scrambler_CL.position = {x:-200, y:_canvas.height/2};
_scrambler_TR.position = {x:_canvas.width+200, y:_canvas.height/40};
_scrambler_BR.position = {x:_canvas.width+200, y:_canvas.height-_canvas.height/40};
// _scrambler_CR.position = {x:_canvas.width+200, y:_canvas.height/2};
};
// _ _ _
@@ -265,40 +236,26 @@
this.x = this.wall_limits.left + Math.random()*(this.wall_limits.right - this.wall_limits.left);
this.y = this.wall_limits.top + Math.random()*(this.wall_limits.bottom - this.wall_limits.top);
this.ori_pos = {x:this.x,y:this.y};
// TODO: don't forget to move ori_pos on window resize
this.initPhysics();
// if(this.id == '620'){
// _node_pop_up.setNode(this);
// }
};
Node.prototype.initPhysics = function(){
// particule
this.p = _physics.makeParticle(this.mass, this.x, this.y);
this.p.velocity = new Physics.Vector((Math.random()-0.5)*_p_velocity_factor, (Math.random()-0.5)*_p_velocity_factor);
// origin position particule
this.ori_p = _physics.makeParticle(1000, this.ori_pos.x, this.ori_pos.y);
this.ori_p.fixed = true;
// TODO: don't forget to move ori_p on window resize
this.ori_p_attract = _physics.makeAttraction(this.ori_p, this.p, 1000, _canvas.width*2);
this.ori_p_attract.on = false;
// attracter
this.attract = _physics.makeAttraction(_attracter, this.p, 1000, _canvas.width*2);
this.attract.on = false;
// repulsers
this.repulse_top = _physics.makeAttraction(_repulser_top, this.p, -60, _canvas.height/6);
this.repulse_center = _physics.makeAttraction(_repulser_center, this.p, -50, _canvas.height/6);
this.repulse_bottom = _physics.makeAttraction(_repulser_bottom, this.p, -60, _canvas.height/6);
this.repulse_top.on = false;
this.repulse_center.on = false;
this.repulse_bottom.on = false;
// Scramblers
this.scramble_TL = _physics.makeAttraction(_scrambler_TL, this.p, -100, _canvas.height/2.5);
this.scramble_TR = _physics.makeAttraction(_scrambler_TR, this.p, -100, _canvas.height/2.5);
this.scramble_BR = _physics.makeAttraction(_scrambler_BR, this.p, -100, _canvas.height/2.5);
this.scramble_BL = _physics.makeAttraction(_scrambler_BL, this.p, -100, _canvas.height/2.5);
// this.scramble_CR = _physics.makeAttraction(_scrambler_CR, this.p, -50, _canvas.height/4);
// this.scramble_CL = _physics.makeAttraction(_scrambler_CL, this.p, -50, _canvas.height/4);
this.scramble_TL.on = false;
this.scramble_TR.on = false;
this.scramble_BR.on = false;
this.scramble_BL.on = false;
// this.scramble_CR.on = false;
// this.scramble_CL.on = false;
};
Node.prototype.calcWallLimits = function(){
@@ -312,9 +269,16 @@
Node.prototype.onResizeCanvas = function(){
this.calcWallLimits();
this.shuffleOriP();
// TODO: when canvas is smaller what about nodes hors champs, they are coming back alone but it's too long
};
Node.prototype.shuffleOriP = function(){
this.ori_pos.x = this.wall_limits.left + Math.random()*(this.wall_limits.right - this.wall_limits.left);
this.ori_pos.y = this.wall_limits.top + Math.random()*(this.wall_limits.bottom - this.wall_limits.top);
this.scramble();
};
Node.prototype.onUpdate = function(){
// this.p.velocity.multiplyScalar(0.99);
@@ -331,7 +295,11 @@
// this.checkVelocityThreshold();
this.checkWallBouncing();
this.updatePos();
if(this.scrambling){
this.checkOriPDist();
}
}
if(_mouse_in && !this.aside)
this.checkMouse();
@@ -451,35 +419,37 @@
// this.fade();
this.stopScrambling();
this.unsetCentered();
this.repulse_top.on = true;
this.repulse_center.on = true;
this.repulse_bottom.on = true;
this.ori_p.position.x = this.x < _canvas.width /2 ? this.wall_limits.left : this.wall_limits.right;
this.ori_p_attract.on = true;
}
Node.prototype.unsetAside = function(){
console.log('unsetAside');
this.aside = false;
this.ori_p_attract.on = false;
this.ori_p.position.x = this.ori_pos.x;
// this.unFade();
this.repulse_top.on = false;
this.repulse_center.on = false;
this.repulse_bottom.on = false;
}
Node.prototype.scramble = function(){
this.scrambling = true;
this.unsetCentered();
this.unsetAside();
this.scramble_TL.on = true;
this.scramble_TR.on = true;
this.scramble_BR.on = true;
this.scramble_BL.on = true;
// this.scramble_CR.on = true;
// this.scramble_CL.on = true;
this.ori_p.position.x = this.ori_pos.x;
this.ori_p.position.y = this.ori_pos.y;
this.ori_p_attract.on = true;
}
Node.prototype.checkOriPDist = function(){
if(this.p.distanceTo(this.ori_p) < 50){
this.stopScrambling();
}
};
Node.prototype.stopScrambling = function(){
this.scrambling = false;
this.scramble_TL.on = false;
this.scramble_TR.on = false;
this.scramble_BR.on = false;
this.scramble_BL.on = false;
this.ori_p_attract.on = false;
// this.scramble_TL.on = false;
// this.scramble_TR.on = false;
// this.scramble_BR.on = false;
// this.scramble_BL.on = false;
// this.scramble_CR.on = false;
// this.scramble_CL.on = false;
}
@@ -646,9 +616,7 @@
// | __|_ _| |_ _ _ ___ ___ ___
// | _|| ' \ _| '_/ -_) -_|_-<
// |___|_||_\__|_| \___\___/__/
// TODO : this functionn is not clear as it should be called toggleEntry
function openEntree(tid, bubbling){
//var $link = $('a.term-link[tid="'+tid+'"]');
function toggleEntree(tid, bubbling){
var $link = _$entrees_block_termlinks.filter('[tid="'+tid+'"]');
var $li = $link.parents('li');
var sys_path = $link.attr('data-drupal-link-system-path');
@@ -660,6 +628,7 @@
if(bubbling){
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
}
// bubbling is true only when event is a real click on entree link
}else if(bubbling){
$li.removeClass('opened');
scrambleCollection();
@@ -726,19 +695,14 @@
// |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
// |___/
function scrambleCollection(){
// console.log('scrambleCollection');
for (var i = 0; i < _nodes.length; i++) {
_nodes[i].scramble();
}
// setTimeout(stopScrambling, 2000);
stopScrambling();
};
function stopScrambling(){
for (var i = 0; i < _nodes.length; i++) {
setTimeout(function(n){
n.stopScrambling();
}.bind(this, _nodes[i]), 1000 + Math.random()*4000);
}
// stopScrambling();
};
function closeAllEntries(){
_$entrees_block_termlinks.each(function(index, el) {
if($(this).parents('li').is('.opened')){
@@ -850,16 +814,16 @@
closeNode();
})
.on('open-entree', function(e){
openEntree(e.tid);
toggleEntree(e.tid);
})
.on('close-all-entree', function(e){
closeAllEntries();
});
_$entrees_block_termlinks.on('click', function(event) {
console.log('_$entrees_block_termlinks click', this);
// console.log('_$entrees_block_termlinks click', this);
event.preventDefault();
openEntree($(this).attr('tid'), true);
toggleEntree($(this).attr('tid'), true);
// var $link = $(this);
// var tid = $link.attr('tid');
// var $li = $link.parents('li');
@@ -868,7 +832,7 @@
// if(!$li.is('.opened')){
// _$entrees_block_termlinks.parents('li').removeClass('opened');
// $li.addClass('opened');
// openEntree(tid);
// toggleEntree(tid);
// _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
// }else{
// $li.removeClass('opened');
@@ -93,8 +93,6 @@ class EdlpSearchController extends ControllerBase {
$response = new JsonResponse($this->matches);
return $response;
// dpm($this->matches, 'matches');
//
// return array(
// "#markup" => "autocomplete"
// );
@@ -7,14 +7,14 @@ _$body.addClass('path-edlp-node');$('.ajax-loading').removeClass('ajax-loading')
if(typeof data.bundle!='undefined'&&data.bundle=="page"){$('a[data-drupal-link-system-path="productions"]').addClass('is-active-trail');}
if(typeof data.menu_parents!='undefined'){for(var i=0;i<data.menu_parents.length;i++){var menu_sys_path=data.menu_parents[i];$('a[data-drupal-link-system-path="'+menu_sys_path+'"]').addClass('is-active-trail');}}
if(typeof data.block!='undefined'){if(!$('#'+data.block.id,'.region-'+data.block.region).length){$('.region-'+data.block.region).append(data.block.rendered);}}
if(state.sys_path=="productions"){initProductions();}else{addCloseBtnToCols();}
initAjaxLinks();_$body.trigger({'type':'new-content-ajax-loaded'});Drupal.attachBehaviors(_$row[0]);_$body.attr('booted','booted');_$body.removeClass('ajax-loading');if(state.url){history.pushState(state,null,state.url);}};function addCloseBtnToCols(){$('.col',_$row).each(function(index,el){if($('span.close-col-btn',this).length)
return true;$(this).children('.wrapper').append($('<span>').addClass('close-col-btn').on('click',function(e){var $col=$(this).parents('.col');var theme=$col.attr('theme');if(theme!=''){_$body.trigger({'type':theme+'-col-closed'});}
$col.remove();if(!$('.col',_$row).length){backToFrontPage();}}));});};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;var origin_sys_path=window.localStorage.getItem('edlp_origin_path');if(origin_sys_path){var origin_url=window.localStorage.getItem('edlp_origin_url');var origin_hash=window.localStorage.getItem('edlp_origin_hash');var view_mode=origin_hash.replace('#','');if(view_mode){var $link=$('[href="'+origin_url+'"][viewmode="'+view_mode+'"]');var selector=$link.attr('selector')||null;if(selector){if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:$link.attr('tid')});}else{$('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');}}}
if(state.sys_path=="productions"){initProductions();}else{addCloseModalBtnToCols();}
initAjaxLinks();_$body.trigger({'type':'new-content-ajax-loaded'});Drupal.attachBehaviors(_$row[0]);_$body.attr('booted','booted');_$body.removeClass('ajax-loading');if(state.url){history.pushState(state,null,state.url);}};function addCloseModalBtnToCols(){$('.col',_$row).each(function(index,el){if($('span.close-col-btn',this).length)
return true;$(this).children('.wrapper').prepend($('<span>').addClass('close-col-btn').on('click',function(e){var $col=$(this).parents('.col');var theme=$col.attr('theme');if(theme!=''){_$body.trigger({'type':theme+'-col-closed'});}
$col.remove();if(!$('.col',_$row).length&&!_$body.is('.entity-type-node.bundle-page')){backToFrontPage();}}));});};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;var origin_sys_path=window.localStorage.getItem('edlp_origin_path');if(origin_sys_path){var origin_url=window.localStorage.getItem('edlp_origin_url');var origin_hash=window.localStorage.getItem('edlp_origin_hash');var view_mode=origin_hash.replace('#','');if(view_mode){var $link=$('[href="'+origin_url+'"][viewmode="'+view_mode+'"]');var selector=$link.attr('selector')||null;if(selector){if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:$link.attr('tid')});}else{$('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');}}}
var state=getSysPathState(origin_sys_path,view_mode);if(state.ajax_path){ajaxLoadContent(state);}
if(state.entree_tid){openEntree(state.entree_tid);}
history.replaceState(state,null,origin_url+origin_hash);window.localStorage.removeItem("edlp_origin_path");window.localStorage.removeItem("edlp_origin_url");}else{history.replaceState({home:true},null,window.location.pathname);_$body.attr('booted','booted');}};function onHistoryPopState(e){void 0;if(e.state.home){backToFrontPage();}else{if(e.state.entree_tid){openEntree(e.state.entree_tid);}
if(e.state.ajax_path){e.state.url=null;ajaxLoadContent(e.state);}}};function initAjaxLinks(){$('a','#block-mainnavigation').add('a','#block-footer.menu--footer').add('a','#block-productions').add('a','article.node:not(.node--type-enregistrement) h2.node-title').add('a','.productions-subtree').add('a','.productions-parent').addClass('ajax-link');_$ajaxLinks=$('.ajax-link:not(.ajax-enabled)').each(function(i,e){var $this=$(this);if($this.is('.ajax-enable'))return;if($this.attr('data-drupal-link-system-path')){$this.on('click',onClickAjaxLink).addClass('ajax-enable');}});};function onClickAjaxLink(e){e.preventDefault();var $link=$(this);if($link.is('.is-active'))
history.replaceState(state,null,origin_url+origin_hash);window.localStorage.removeItem("edlp_origin_path");window.localStorage.removeItem("edlp_origin_url");}else{history.replaceState({home:true},null,window.location.pathname);_$body.attr('booted','booted');}};function onHistoryPopState(e){void 0;if(e.state.home){backToFrontPage(true);}else{if(e.state.entree_tid){openEntree(e.state.entree_tid);}
if(e.state.ajax_path){e.state.url=null;ajaxLoadContent(e.state);}}};function initAjaxLinks(){$('a.site-name','#block-edlptheme-branding').add('a','#block-mainnavigation').add('a','#block-footer.menu--footer').add('a','#block-productions').add('a','article.node:not(.node--type-enregistrement) h2.node-title').add('a','.productions-subtree').add('a','.productions-parent').addClass('ajax-link');_$ajaxLinks=$('.ajax-link:not(.ajax-enabled)').each(function(i,e){var $this=$(this);if($this.is('.ajax-enable'))return;if($this.attr('data-drupal-link-system-path')){$this.on('click',onClickAjaxLink).addClass('ajax-enable');}});};function onClickAjaxLink(e){e.preventDefault();var $link=$(this);if($link.is('.is-active'))
return false;if($link.is('.audio-link')){_audioPlayer.emmit('stop-shuffle').openDocument({nid:$link.attr('nid'),audio_url:$link.attr('audio_url')});return false;}
var sys_path=$(this).attr('data-drupal-link-system-path');if(sys_path=='<front>'){backToFrontPage();return false;}
var view_mode=$link.attr('viewmode');var state=getSysPathState(sys_path,view_mode);state.url=$(this).attr('href');if(view_mode){state.url+="#"+view_mode;}
@@ -35,7 +35,7 @@ return this;},showHideControls(){if(this.$controls){if(this.playing&&!this.pause
if(this.$playpause){if(this.playlist.length>0){this.$playpause.addClass('is-active');}else{this.$playpause.removeClass('is-active');}}
if(this.$next){if(this.playing&&this.playlist.length>1&&this.current_index<this.playlist.length-1){this.$next.addClass('is-active');}else{this.$next.removeClass('is-active');}}
if(this.$previous){if(this.playing&&this.playlist.length>1&&this.current_index>0){this.$previous.addClass('is-active');}else{this.$previous.removeClass('is-active');}}
return this;},deactivate(){this.stop();this.active=false;},onAudioOpenDocument(args){if(args.caller!==this){this.reset();}},onAudioPlayerPlay(){if(this.playing&&this.paused){this.paused=false;this.showHideControls();}},onAudioPlayerPause(){if(this.playing&&!this.paused){this.paused=true;this.showHideControls();}},onAudioPlayerEnded(){this.next();},};function backToFrontPage(){closeAllModals();$('body').removeClass().addClass('path-frontpage');$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');_$corpus_canvas.trigger({'type':'close-all-entree'});}
function initHome(){addCloseBtnToCols();var $grid=$('.grid',_$row).masonry({itemSelector:'.col',columnWidth:'.col-2',horizontalOrder:true,containerStyle:null,});$grid.imagesLoaded().progress(function(){$grid.masonry('layout');});$grid.imagesLoaded(function(){$grid.masonry('layout');});}
return this;},deactivate(){this.stop();this.active=false;},onAudioOpenDocument(args){if(args.caller!==this){this.reset();}},onAudioPlayerPlay(){if(this.playing&&this.paused){this.paused=false;this.showHideControls();}},onAudioPlayerPause(){if(this.playing&&!this.paused){this.paused=true;this.showHideControls();}},onAudioPlayerEnded(){this.next();},};function backToFrontPage(pop_state){closeAllModals();$('body').removeClass().addClass('path-frontpage');$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');_$corpus_canvas.trigger({'type':'close-all-entree'});if(!pop_state){history.pushState({home:true},null,window.location.origin);}}
function initHome(){addCloseModalBtnToCols();var $grid=$('.grid',_$row).masonry({itemSelector:'.col',columnWidth:'.col-2',horizontalOrder:true,containerStyle:null,});$grid.imagesLoaded().progress(function(){$grid.masonry('layout');});$grid.imagesLoaded(function(){$grid.masonry('layout');});}
function initProductions(){var $grid=$('.grid',_$row).masonry({itemSelector:'.col',columnWidth:'.col-2',horizontalOrder:true,containerStyle:null,});$grid.imagesLoaded().progress(function(){$grid.masonry('layout');});$grid.imagesLoaded(function(){$grid.masonry('layout');});};function closeAllModals(){_$row.html('');_$ajaxLinks.removeClass('is-active');_$body.trigger({'type':'all-modal-closed'});};init();}
$(document).ready(function($){var edlptheme=new EdlpTheme();});})(jQuery,Drupal,drupalSettings);
File diff suppressed because one or more lines are too long
@@ -225,7 +225,7 @@
if(state.sys_path == "productions"){
initProductions();
}else{
addCloseBtnToCols();
addCloseModalBtnToCols();
}
initAjaxLinks();
@@ -254,13 +254,13 @@
}
};
function addCloseBtnToCols(){
function addCloseModalBtnToCols(){
$('.col', _$row).each(function(index, el) {
if($('span.close-col-btn', this).length)
return true;
$(this).children('.wrapper').append($('<span>')
$(this).children('.wrapper').prepend($('<span>')
.addClass('close-col-btn')
.on('click', function(e){
// check for theme attribute and emmit event
@@ -271,9 +271,10 @@
}
// remove the col
$col.remove();
// if row is empty call closeAllModals()
if(!$('.col', _$row).length){
backToFrontPage();
// if row is empty and we are not in productions call closeAllModals()
if(!$('.col', _$row).length
&& !_$body.is('.entity-type-node.bundle-page')){
backToFrontPage();
}
})
);
@@ -347,7 +348,7 @@
function onHistoryPopState(e){
console.log('onPopState',e.state);
if(e.state.home){
backToFrontPage();
backToFrontPage(true);
}else{
if(e.state.entree_tid){
openEntree(e.state.entree_tid);
@@ -368,7 +369,8 @@
function initAjaxLinks(){
// console.log('initAjaxLinks');
$('a', '#block-mainnavigation')
$('a.site-name', '#block-edlptheme-branding')
.add('a', '#block-mainnavigation')
.add('a', '#block-footer.menu--footer')
.add('a', '#block-productions')
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
@@ -1069,17 +1071,20 @@
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
// |_||_| \___/_||_\__|_| \__,_\__, \___|
// |___/
function backToFrontPage(){
function 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){
history.pushState({home:true}, null, window.location.origin);
}
}
function initHome(){
addCloseBtnToCols();
addCloseModalBtnToCols();
// console.log('theme : initHome');
// console.log('theme : initProductions');
var $grid = $('.grid',_$row).masonry({
@@ -266,12 +266,14 @@ main[role="main"]{
// z-index: 10;
pointer-events: all;
cursor: pointer;
position:absolute;
top:0; right:0;
padding:0!important; margin:0.5em;
position:sticky;
top:0.5em;
padding:0!important;
margin:0.5em;
display: block;
$s:10px;
width:$s; height:$s;
float: right;
background-image: url(../img/close.svg);
background-repeat: no-repeat;
background-position: center;
@@ -1199,6 +1201,7 @@ footer{
ul{
margin:0;
padding:0;
white-space: nowrap;
li{
pointer-events: all;
// @include oblique-list;
@@ -17,12 +17,12 @@
{% if site_logo or site_name %}
<h1>
{% if site_logo %}
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo">
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo" data-drupal-link-system-path="<front>">
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
</a>
{% endif %}
{% if site_name %}
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" data-drupal-link-system-path="<front>">{{ site_name }}</a>
{% endif %}
</h1>
{% endif %}
@@ -981,7 +981,7 @@ display:
path: admin/content/production
menu:
type: tab
title: Content
title: Production
description: ''
expanded: false
parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175'
@@ -3201,6 +3201,7 @@ display:
filters: false
filter_groups: false
fields: false
title: false
filters:
status_extra:
id: status_extra
@@ -3755,6 +3756,7 @@ display:
plugin_id: field
entity_type: node
entity_field: changed
title: Agenda
display_plugin: page
display_title: Agenda
id: page_3
@@ -96,9 +96,10 @@ display:
name: name
field_synonyms: field_synonyms
operations: operations
changed: changed
info:
name:
sortable: false
sortable: true
default_sort_order: asc
align: ''
separator: '<br/>'
@@ -114,6 +115,13 @@ display:
separator: ''
empty_column: false
responsive: ''
changed:
sortable: true
default_sort_order: desc
align: ''
separator: ''
empty_column: false
responsive: ''
default: '-1'
empty_table: false
row:
@@ -473,6 +481,73 @@ display:
separator: ', '
field_api_classes: false
plugin_id: field
changed:
id: changed
table: taxonomy_term_field_data
field: changed
relationship: none
group_type: group
admin_label: ''
label: 'Date de mise à jour'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: timestamp
settings:
date_format: medium
custom_date_format: ''
timezone: ''
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: taxonomy_term
entity_field: changed
plugin_id: field
filters:
vid:
id: vid
@@ -642,7 +717,14 @@ display:
entity_type: taxonomy_term
entity_field: langcode
plugin_id: language
sorts: { }
sorts:
changed:
id: changed
table: taxonomy_term_field_data
field: changed
entity_type: taxonomy_term
entity_field: changed
plugin_id: date
title: Langues
header:
result:
@@ -868,11 +950,13 @@ display:
filters: false
filter_groups: false
title: false
sorts: false
filter_groups:
operator: AND
groups:
1: AND
title: Entrees
sorts: { }
cache_metadata:
max-age: -1
contexts:
@@ -899,7 +983,7 @@ display:
description: ''
expanded: false
parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175'
weight: 200
weight: -95
context: '0'
menu_name: admin
rendering_language: '***LANGUAGE_entity_translation***'
@@ -1067,11 +1151,79 @@ display:
destination: true
entity_type: taxonomy_term
plugin_id: entity_operations
changed:
id: changed
table: taxonomy_term_field_data
field: changed
relationship: none
group_type: group
admin_label: ''
label: 'Date de mise à jour'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: timestamp
settings:
date_format: medium
custom_date_format: ''
timezone: ''
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: taxonomy_term
entity_field: changed
plugin_id: field
defaults:
fields: false
filters: false
filter_groups: false
title: false
sorts: false
filters:
vid:
id: vid
@@ -1247,6 +1399,7 @@ display:
groups:
1: AND
title: Genres
sorts: { }
cache_metadata:
max-age: -1
contexts:
@@ -1271,7 +1424,7 @@ display:
description: ''
expanded: false
parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175'
weight: 201
weight: -93
context: '0'
menu_name: admin
rendering_language: '***LANGUAGE_entity_translation***'
@@ -1376,10 +1529,78 @@ display:
destination: true
entity_type: taxonomy_term
plugin_id: entity_operations
changed:
id: changed
table: taxonomy_term_field_data
field: changed
relationship: none
group_type: group
admin_label: ''
label: 'Date de mise à jour'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: timestamp
settings:
date_format: medium
custom_date_format: ''
timezone: ''
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: taxonomy_term
entity_field: changed
plugin_id: field
defaults:
fields: false
filters: false
filter_groups: false
sorts: false
filters:
vid:
id: vid
@@ -1511,6 +1732,7 @@ display:
operator: AND
groups:
1: AND
sorts: { }
cache_metadata:
max-age: -1
contexts: