Compare commits

...
7 Commits
27 changed files with 611 additions and 130 deletions
@@ -0,0 +1,36 @@
<?php
namespace Drupal\edlp_admin\Plugin\Filter;
use Drupal\Component\Utility\Html;
// use Drupal\Component\Utility\Unicode;
// use Drupal\Component\Utility\Xss;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
// use Drupal\Core\Url;
// use Drupal\Core\Template\Attribute;
/**
* Provides a filter to convert audio links.
*
* @Filter(
* id = "css",
* title = @Translation("Css remove filter"),
* description = @Translation("Remove all style attributes"),
* type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
* )
*/
class CssFilter extends FilterBase {
/**
* {@inheritdoc}
*/
public function process($text, $langcode) {
$result = new FilterProcessResult($text);
$cleaned_text = preg_replace('/style="[^"]*"/i', '', $text);
$result->setProcessedText($cleaned_text);
return $result;
}
}
@@ -24,6 +24,29 @@ function edlp_ajax_page_attachments(array &$attachments) {
$current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
$is_front = \Drupal::service('path.matcher')->isFrontPage();
$entity_type = null;
$entity_bundle = null;
$entity_id = null;
$audio_url = null;
foreach (['node', 'taxonomy_term'] as $type) {
$entity = \Drupal::routeMatch()->getParameter($type);
if($entity){
$entity_type = $type;
$entity_bundle = $entity->bundle();
$entity_id = $entity->id();
if($entity_bundle == 'enregistrement'){
$field_son_values = $entity->get('field_son')->getValue();
$audio_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : null;
if($audio_fid){
$audio_file = \Drupal\file\Entity\File::load($audio_fid);
$son_uri = $audio_file->getFileUri();
$audio_url = file_create_url($son_uri);
}
}
break;
}
}
// do not redirect if not node, term, or custom routing
// FIXME: check with routes instead of path as path can change !!!
if(preg_match('/^\/?node\/\d+/', $current_path)
@@ -41,6 +64,10 @@ function edlp_ajax_page_attachments(array &$attachments) {
is_front:".($is_front ? 'true':'false').",\n
redirect:".($redirect ? 'true':'false').",\n
lang_code:'".$current_language."',\n
entity_type:'".$entity_type."',\n
entity_bundle:'".$entity_bundle."',\n
entity_id:'".$entity_id."',\n
audio_url:'".$audio_url."',\n
};";
$attachments['#attached']['html_head'][] = [
@@ -66,9 +93,11 @@ function edlp_ajax_theme($existing, $type, $theme, $path) {
'edlp_ajax' => array(
'file' => 'includes/edlp_ajax.inc',
'variables' => array(
'entity_type' => 'node',
'entity' => NULL,
'view_mode' => 'default'
'entity_type' => null,
'bundle' => null,
'entity' => null,
'view_mode' => 'default',
'aside' => array(),
),
),
);
@@ -82,6 +111,7 @@ function edlp_ajax_theme_suggestions_edlp_ajax(array $vars) {
$suggestions = [];
// $node = $variables['elements']['#node'];
$sanitized_view_mode = strtr($vars['view_mode'], '.', '_');
// $entity = $vars['entity'];
//
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'];
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'] . '__' . $sanitized_view_mode;
@@ -89,5 +119,8 @@ function edlp_ajax_theme_suggestions_edlp_ajax(array $vars) {
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'] . '__' . $vars['entity']->id();
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'] . '__' . $vars['entity']->id() . '__' . $sanitized_view_mode;
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'] . '__' . $vars['bundle'];
$suggestions[] = 'edlp_ajax__' . $vars['entity_type'] . '__' . $vars['bundle'] . '__' . $sanitized_view_mode;
return $suggestions;
}
@@ -9,4 +9,5 @@ function template_preprocess_edlp_ajax(&$vars){
*/
$view_builder = \Drupal::entityTypeManager()->getViewBuilder($vars['entity_type']);
$vars['content'] = $view_builder->view($vars['entity'], $vars['view_mode']);
}
@@ -7,6 +7,8 @@ use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Url;
use Drupal\Core\Language\LanguageInterface;
use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\Core\Datetime\DrupalDateTime;
// use Symfony\Component\HttpFoundation\JsonResponse;
use \Drupal\block\Entity\Block;
use Drupal\Core\Cache\CacheableJsonResponse;
@@ -18,6 +20,107 @@ class EdlpAjaxController extends ControllerBase {
private function query() {
$this->entity = entity_load($this->entity_type, $this->id);
if($this->entity){
switch($this->entity_type){
case 'node':
$this->bundle = $this->entity->getType();
break;
case 'taxonomy_term':
$this->bundle = $this->entity->bundle();
break;
default:
$this->bundle = NULL;
}
}
}
private function getProductionDatesAside(){
$now = new DrupalDateTime('now');
$now->setTimezone(new \DateTimeZone(DATETIME_STORAGE_TIMEZONE));
$future_dates_query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'evenement')
->condition('field_page_liee.target_id', $this->entity->id(), 'IN')
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '>=')
->sort('field_date');
$future_nids = $future_dates_query->execute();
$past_dates_query = \Drupal::entityQuery('node')
->condition('status', 1)
->condition('type', 'evenement')
->condition('field_page_liee.target_id', $this->entity->id(), 'IN')
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '<')
->sort('field_date', 'DESC');
$past_nids = $past_dates_query->execute();
if(count($future_nids) || count($past_nids)){
$aside = array(
'#type'=>'container',
"#attributes"=>array(
"class"=>['agenda']
)
);
$node_view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
if(count($future_nids)){
$future_nodes = entity_load_multiple('node', $future_nids);
$future_list = array (
'#theme' => 'item_list',
'#items' => [],
);
foreach($future_nodes as $node){
$future_list['#items'][] = $node_view_builder->view($node, 'aside');
}
$aside['future_events'] = array(
"#type"=>"container",
"#attributes"=>array(
"class"=>['future-events']
),
"#markup"=>"<h3>" . t("Future events") . "</h3>",
"future_events"=>$future_list
);
}
if(count($past_nids)){
$past_nodes = entity_load_multiple('node', $past_nids);
$past_list = array (
'#theme' => 'item_list',
'#items' => [],
);
foreach($past_nodes as $node){
$past_list['#items'][] = $node_view_builder->view($node, 'aside');
}
$aside['past_events'] = array(
"#type"=>"container",
"#attributes"=>array(
"class"=>['past-events']
),
"#markup"=>"<h3>" . t("Past events") . "</h3>",
"past_events"=>$past_list
);
}
}else{
$aside = null;
}
return $aside;
}
/**
*
* return a renderable array
*/
private function getAside() {
if($this->bundle == 'page'){
$aside = $this->getProductionDatesAside();
}else{
$aside = null;
}
return $aside;
}
private function toRenderable(){
@@ -29,6 +132,8 @@ class EdlpAjaxController extends ControllerBase {
"#entity_type" => $this->entity_type,
'#entity' => $this->entity,
'#view_mode' => $this->viewmode,
'#aside' => $this->getAside(),
'#bundle' => $this->bundle,
);
}else{
return array(
@@ -55,28 +160,18 @@ class EdlpAjaxController extends ControllerBase {
return render($renderable);
});
switch($this->entity_type){
case 'node':
$bundle = $this->entity->getType();
break;
case 'taxonomy_term':
$bundle = $this->entity->bundle();
break;
default:
$bundle = NULL;
}
$data = [
'date' => time(),
'id' => $this->id,
'view_mode' => $this->viewmode,
'bundle' => $bundle,
'bundle' => $this->bundle,
'entity_type' => $this->entity_type,
'rendered'=> $rendered,
];
// if content type page (productions) get the menu items
if($bundle == "page"){
// if content type page (productions) get the menu items and linked dates
if($this->bundle == "page"){
$menuLinkManager = \Drupal::service('plugin.manager.menu.link');
$links = $menuLinkManager->loadLinksByRoute('entity.node.canonical', array('node' => $this->id), 'productions');
// dpm($links, 'links');
@@ -1 +1,2 @@
{{ content }}
{{ aside }}
@@ -30,7 +30,7 @@ createNodesRepulsions();};function highlightEntries(){_$entrees_block_termlinks.
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();}};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){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));}
_$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':_nodes[_node_hover_id],};_$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';}
@@ -155,7 +155,7 @@
// | .` / _ \/ _` / -_|_-<
// |_|\_\___/\__,_\___/__/
function buildNodes(nodes){
//console.log("buildNodes", nodes);
// console.log("buildNodes", nodes);
var d;
for (var i in nodes) {
d = i < 1 ? true : false;
@@ -791,11 +791,7 @@
// console.log("corpus : click on node", _nodes[_node_hover_id]);
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
},
'target_node':_nodes[_node_hover_id],
};
_$canvas.trigger(event);
// instead of directly opening the doc, create an event listener (e.g. : audio played from random)
@@ -8,6 +8,7 @@ use Drupal\File\Entity\File;
// use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Cache\CacheableJsonResponse;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\core\render\RenderContext;
use Drupal\Core\Ajax\AjaxResponse;
@@ -77,6 +78,10 @@ class CorpusController extends ControllerBase {
// if($has_article && $article_value[0]['value'] == "")
// dpm($article_value);
$document_url = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($node) {
return $node->toUrl()->toString();
});
// favoris marker
$nodes_data[] = array(
"nid" => $node->get('nid')->getString(),
@@ -87,6 +92,7 @@ class CorpusController extends ControllerBase {
"audio_url" => $audio_url,
"has_article" => $has_article,
"chutier_action" => 'add',
"document_url" => $document_url,
);
}
@@ -2,6 +2,6 @@ name: 'edlp_search'
type: module
description: 'Edlp search module'
core: 8.x
package: 'edlp'
package: Edlp
dependencies:
- search_api
@@ -2,6 +2,6 @@ name: 'Edlp Studio'
type: module
description: 'Edlp module that handle chutier and Compositions entities'
core: 8.x
package: 'edlp'
package: Edlp
dependencies:
- entity_reference
@@ -1,2 +1,2 @@
void 0;if(edlp.redirect){void 0;void 0;window.localStorage.setItem('edlp_origin_path',edlp.sys_path.replace(/^\//,''));window.localStorage.setItem('edlp_origin_url',window.location.pathname);window.localStorage.setItem('edlp_origin_hash',window.location.hash);window.location.replace(window.location.origin+'/'+edlp.lang_code);}else{void 0;}
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;}
@@ -1,8 +1,9 @@
(function($,Drupal,drupalSettings){EdlpTheme=function(){var _ajax_settings=drupalSettings.edlp_ajax;var _$body=$('body');var _is_front=_$body.is('.path-frontpage');var _corpus_ready=false;var _$corpus_canvas;var _$row=$('main[role="main"]>.layout-content>.row');var _$ajaxLinks;var _audioPlayer;var _randomPlayer;var _compoPlayer;function init(){void 0;initAjaxLinks();initHistory();if(!drupalSettings.path.isFront)
return;initEvents();_audioPlayer=new AudioPlayer();_compoPlayer=new CompoPlayer();};function initEvents(){_$body.on('corpus-map-ready',onCorpusMapReady).on('on-studio-chutier-updated',initAjaxLinks).on('studio-initialized',function(e){_compoPlayer.newCompo();}).on('studio-not-active',function(e){_compoPlayer.deactivate();}).on('on-studio-compo-updated',function(e){initAjaxLinks();_compoPlayer.refresh();}).on('on-studio-compo-opened',function(e){initAjaxLinks();_compoPlayer.newCompo();}).on('search-results-loaded',initAjaxLinks).on('open_entree',function(e){void 0;closeAllModals();_$body.removeClass();if(typeof e.url!='undefined'){var state=getSysPathState(e.sys_path);history.pushState(state,null,e.url);}}).on('close_entree',backToFrontPage);}
(function($,Drupal,drupalSettings){EdlpTheme=function(){var _ajax_settings=drupalSettings.edlp_ajax;var _$body=$('body');var _corpus_ready=false;var _$corpus_canvas;var _$row=$('main[role="main"]>.layout-content>.row');var _$ajaxLinks;var _audioPlayer;var _randomPlayer;var _compoPlayer;function init(){void 0;_audioPlayer=new AudioPlayer();_compoPlayer=new CompoPlayer();initAjaxLinks();initHistory();if(!drupalSettings.path.isFront)
return;initEvents();};function initEvents(){_$body.on('corpus-map-ready',onCorpusMapReady).on('on-studio-chutier-updated',initAjaxLinks).on('studio-initialized',function(e){_compoPlayer.newCompo();}).on('studio-not-active',function(e){_compoPlayer.deactivate();}).on('on-studio-compo-updated',function(e){initAjaxLinks();_compoPlayer.refresh();}).on('on-studio-compo-opened',function(e){initAjaxLinks();_compoPlayer.newCompo();}).on('search-results-loaded',initAjaxLinks).on('open_entree',function(e){void 0;closeAllModals();_$body.removeClass();if(typeof e.url!='undefined'){var state=getSysPathState(e.sys_path);history.pushState(state,null,e.url);}}).on('close_entree',backToFrontPage);}
function initScrollbars(){};function getSysPathState(sys_path,view_mode){var state={'sys_path':sys_path,'ajax_path':sys_path};var node_match=state.ajax_path.match(/^\/?(node\/(\d+))$/i);void 0;var term_match=state.ajax_path.match(/^\/?(taxonomy\/term\/(\d+))$/i);void 0;if(node_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+node_match[1];state.node_nid=node_match[2];if(view_mode){state.ajax_path+='/'+view_mode;}}else if(term_match){state.ajax_path=_ajax_settings.entityjson_path+'/'+term_match[1];state.ajax_path=state.ajax_path.replace(/taxonomy\/term/,'taxonomy_term');state.entree_tid=term_match[2];if(view_mode){state.ajax_path+='/'+view_mode;state.view_mode=view_mode;}else{state.ajax_path=null;}}else{state.ajax_path+='/ajax'}
return state;};function ajaxLoadContent(state){void 0;_$body.addClass('ajax-loading');var path=window.location.origin+Drupal.url(state.ajax_path);$.getJSON(path,{}).done(function(data){onAjaxLoaded(data,state);}).fail(function(jqxhr,textStatus,error){onAjaxLoadError(jqxhr,textStatus,error,state.sys_path);});};function onAjaxLoadError(jqxhr,textStatus,error,sys_path){void 0;$('.ajax-loading').removeClass('ajax-loading');_$body.removeClass('ajax-loading');};function onAjaxLoaded(data,state){void 0;_$row.removeAttr('style').html(data.rendered);var body_classes=['path-'+state.sys_path.replace(/\//g,'-'),'entity-type-'+data.entity_type,'bundle-'+data.bundle,'view-mode-'+data.view_mode];_$body.removeClass().addClass(body_classes.join(' '));if(state.node_nid)
return state;};function ajaxLoadContent(state){void 0;_$body.addClass('ajax-loading');var path=window.location.origin+Drupal.url(state.ajax_path);$.getJSON(path,{}).done(function(data){onAjaxLoaded(data,state);}).fail(function(jqxhr,textStatus,error){onAjaxLoadError(jqxhr,textStatus,error,state.sys_path);});};function onAjaxLoadError(jqxhr,textStatus,error,sys_path){void 0;$('.ajax-loading').removeClass('ajax-loading');_$body.removeClass('ajax-loading');};function onAjaxLoaded(data,state){void 0;if(data.entity_type=="node"&&data.bundle=="evenement"){if(_$row.find('.col.event').length){_$row.find('.col.event').replaceWith(data.rendered);}else if(_$row.find('.col.aside').length){_$row.find('.col.aside').replaceWith(data.rendered);}else{_$row.append(data.rendered);}}else{_$row.removeAttr('style').html(data.rendered);}
var body_classes=['path-'+state.sys_path.replace(/\//g,'-'),'entity-type-'+data.entity_type,'bundle-'+data.bundle,'view-mode-'+data.view_mode];_$body.removeClass().addClass(body_classes.join(' '));if(state.node_nid)
_$body.addClass('path-edlp-node');$('.ajax-loading').removeClass('ajax-loading');$('.is-active').removeClass('is-active');$('.is-active-trail').removeClass('is-active-trail');if(typeof state.selector!='undefined'){void 0;$('a[selector="'+state.selector+'"]').addClass('is-active');}else{if(typeof state.view_mode!='undefined'){$('a[viewmode="'+state.view_mode+'"][data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');}else{$('a[data-drupal-link-system-path="'+state.sys_path+'"]').addClass('is-active');}
_$body.trigger({'type':'new-content-not-entree-ajax-loaded'});}
if(typeof data.bundle!='undefined'&&data.bundle=="page"){$('a[data-drupal-link-system-path="productions"]').addClass('is-active-trail');}
@@ -14,10 +15,13 @@ if(typeof data.translations_links!='undefined'){void 0;var lang_code=drupalSetti
$('ul','.block.language-switcher-language-url').replaceWith($links);}
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 refreshAllBlocks(){var path=window.location.origin+Drupal.url(_ajax_settings.blocksjson_path);$.getJSON(path,{}).done(function(data){onAjaxBlockLoaded(data);}).fail(function(jqxhr,textStatus,error){onAjaxBlockLoadError(jqxhr,textStatus,error);});};function onAjaxBlockLoadError(jqxhr,textStatus,error){void 0;};function onAjaxBlockLoaded(data){void 0;for(var blockname in data.blocks){var block=data.blocks[blockname];void 0;$(block.id).replaceWith(block.rendered);}};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);}
$col.remove();if(!$('.col',_$row).length&&!_$body.is('.entity-type-node.bundle-page')){backToFrontPage();}}));});};function refreshAllBlocks(){var path=window.location.origin+Drupal.url(_ajax_settings.blocksjson_path);$.getJSON(path,{}).done(function(data){onAjaxBlockLoaded(data);}).fail(function(jqxhr,textStatus,error){onAjaxBlockLoadError(jqxhr,textStatus,error);});};function onAjaxBlockLoadError(jqxhr,textStatus,error){void 0;};function onAjaxBlockLoaded(data){void 0;for(var blockname in data.blocks){var block=data.blocks[blockname];void 0;$(block.id).replaceWith(block.rendered);}};function initHistory(){initFirstLoad();window.addEventListener('popstate',onHistoryPopState);};function initFirstLoad(){void 0;var edlp_origin=JSON.parse(window.localStorage.getItem('edlp_origin'));if(edlp_origin.sys_path){var view_mode=edlp_origin.hash.replace('#','');if(view_mode){var $link=$('[href="'+edlp_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(edlp_origin.sys_path,view_mode);if(edlp_origin.audio_url){var node={nid:edlp_origin.entity_id,audio_url:edlp_origin.audio_url};_audioPlayer.openDocument(node,'history_first_load');if(view_mode==""){state.audio=true;state.node=node;}else{ajaxLoadContent(state);}}
else 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(true);}else{if(e.state.entree_tid){openEntree(e.state.entree_tid);}
history.replaceState(state,null,edlp_origin.url+edlp_origin.hash);window.localStorage.removeItem("edlp_origin");}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.audio){_audioPlayer.openDocument(e.state.node,'popstate',e.state.historic_index);}
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;}
@@ -25,21 +29,23 @@ var view_mode=$link.attr('viewmode');var state=getSysPathState(sys_path,view_mod
if($link.is('[selector]')){state.selector=$link.attr('selector');}
$link.addClass('ajax-loading');ajaxLoadContent(state);return false;};function onCorpusMapReady(e){_corpus_ready=true;_$corpus_canvas=$('canvas#corpus-map');_$corpus_canvas.on('corpus-cliked-on-map',function(e){backToFrontPage();}).on('corpus-cliked-on-node',function(e){_audioPlayer.emmit('stop-shuffle').openDocument(e.target_node);});_randomPlayer=new RandomPlayer(e.playlist);_$body.attr('corpus-map','ready');}
function openEntree(tid){if(tid){closeAllModals();_$body.removeClass();if(_corpus_ready){_$corpus_canvas.trigger({type:'open-entree',tid:tid});}else{$('li.entree[tid="'+tid+'"] a.term-link').addClass('is-active');}}};function AudioPlayer(){var that=this;this.fid;this.audio=new Audio();this.audio_events=["loadedmetadata","canplay","playing","pause","timeupdate","ended"];this.$container=$('<div id="audio-player">');this.$btns=$('<div>').addClass('btns').appendTo(this.$container);this.$previous=$('<div>').addClass('previous').appendTo(this.$btns);this.$playpause=$('<div>').addClass('play-pause').appendTo(this.$btns);this.$next=$('<div>').addClass('next').appendTo(this.$btns);this.$timelinecont=$('<div>').addClass('time-line-container').appendTo(this.$container);this.$timeline=$('<div>').addClass('time-line').appendTo(this.$timelinecont);this.$loader=$('<div>').addClass('loader').appendTo(this.$timeline);this.$cursor=$('<div>').addClass('cursor').appendTo(this.$timeline);this.$time=$('<div>').addClass('time').appendTo(this.$container);this.$currentTime=$('<div>').addClass('current-time').html('00:00').appendTo(this.$time);this.$duration=$('<div>').addClass('duration').html('00:00').appendTo(this.$time);this.$fav=$('<div>').addClass('favoris').appendTo(this.$container);this.$cartel=$('<div>').addClass('cartel').appendTo(this.$container);this.hideTimer=false;this.hideTimeMS=10000;this.currentHistoricIndex=null;this.historic=[];this.shuffle_is_active=false;this.event_handlers={'audio-open-document':[],'audio-play':[],'audio-pause':[],'audio-play-next':[],'audio-ended':[],'stop-shuffle':[]};this.init();};AudioPlayer.prototype={init(){this.$container.appendTo('header[role="banner"] .region-header');this.timeline_w=parseInt(this.$timeline.width());var fn='';for(var i=0;i<this.audio_events.length;i++){fn=this.audio_events[i];fn='on'+fn.charAt(0).toUpperCase()+fn.slice(1);this.audio.addEventListener(this.audio_events[i],this[fn].bind(this),true);}
this.$previous.on('click',this.playPrevious.bind(this));this.$playpause.on('click',this.togglePlayPause.bind(this));this.$next.on('click',this.playNext.bind(this));},openDocument(node,caller){if(typeof node=='undefined'||typeof node.nid=='undefined'||typeof node.audio_url=='undfined'){void 0;return false;}
this.historic.push(node);this.currentHistoricIndex=this.historic.length-1;this.emmit('audio-open-document',{caller:caller});this.launch();},launch(){this.clearTimeOutToHide();this.setSRC(this.historic[this.currentHistoricIndex].audio_url);this.loadNode(this.historic[this.currentHistoricIndex].nid);try{_$corpus_canvas.trigger({'type':'audio-node-opened','nid':this.historic[this.currentHistoricIndex].nid});}catch(e){void 0;}
this.showHidePreviousBtn();this.showHideNextBtn();this.show();},setSRC(url){this.audio.src=url;},onLoadedmetadata(){var rem=parseInt(this.audio.duration,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$duration.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');this.updateLoadingBar();},updateLoadingBar(){this.$loader.css({'width':parseInt((100*this.audio.buffered.end(0)/this.audio.duration),10)+'%'});if(this.audio.buffered.end(0)<this.audio.duration){var that=this;window.requestAnimationFrame(that.updateLoadingBar.bind(that));}else{}},onCanplay(){this.play();},play(){this.clearTimeOutToHide();this.audio.play();},playPrevious(){if(this.currentHistoricIndex>0){this.currentHistoricIndex-=1;this.launch();}},playNext(){if(this.currentHistoricIndex<this.historic.length-1){this.currentHistoricIndex+=1;this.launch();}else{this.emmit('audio-play-next');}},togglePlayPause(e){if(this.audio.paused){this.audio.play();}else{this.audio.pause();}},stop(){this.audio.pause();this.timeOutToHide();},onPlaying(){this.$btns.addClass('is-playing');this.emmit('audio-play');},onPause(){this.$btns.removeClass('is-playing');this.emmit('audio-pause');},onTimeupdate(){this.$cursor.css({'left':(this.audio.currentTime/this.audio.duration*this.timeline_w)+"px"});var rem=parseInt(this.audio.currentTime,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$currentTime.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');},onEnded(){this.emmit('audio-ended');this.stop();},loadNode(nid){this.$cartel.addClass('loading');var vm='player_cartel';var ajax_path=_ajax_settings.entityjson_path+'/node/'+nid+'/'+vm;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(this.onNodeLoaded.bind(this)).fail(this.onNodeLoadFail.bind(this));},onNodeLoaded(data){this.$cartel.html(data.rendered).removeClass('loading');_$body.trigger({'type':'new-audio-cartel-loaded'});initAjaxLinks();},onNodeLoadFail(jqxhr,textStatus,error){void 0;this.$cartel.removeClass('loading').html('');},show(){this.$container.addClass('visible');},showHidePreviousBtn(){if(this.historic.length>1&&this.currentHistoricIndex>0){this.$previous.addClass('is-active');}else{this.$previous.removeClass('is-active');}},showHideNextBtn(){if(this.currentHistoricIndex<this.historic.length-1||this.shuffle_is_active){this.$next.addClass('is-active');}else{this.$next.removeClass('is-active');}},timeOutToHide(){this.clearTimeOutToHide();this.hideTimer=setTimeout(this.hide.bind(this),this.hideTimeMS);},clearTimeOutToHide(){if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=false;}},hide(){this.$container.removeClass('visible');try{_$corpus_canvas.trigger('audio-node-closed');}catch(e){void 0;}},on(event_name,handler){if(typeof this.event_handlers[event_name]=='undefined'){void 0;}
this.$previous.on('click',this.playPrevious.bind(this));this.$playpause.on('click',this.togglePlayPause.bind(this));this.$next.on('click',this.playNext.bind(this));},openDocument(node,caller,historic_index){if(typeof node=='undefined'||typeof node.nid=='undefined'||typeof node.audio_url=='undfined'){void 0;return false;}
if(typeof caller=='undefined'||caller!='popstate'){this.historic.push(node);this.currentHistoricIndex=this.historic.length-1;if(caller!="history_first_load"){state={audio:true,node:node,historic_index:this.currentHistoricIndex,};history.pushState(state,null,node.document_url);}}else{this.currentHistoricIndex=historic_index;}
this.emmit('audio-open-document',{caller:caller});this.launch();},launch(){this.clearTimeOutToHide();this.setSRC(this.historic[this.currentHistoricIndex].audio_url);this.loadNode(this.historic[this.currentHistoricIndex].nid);try{_$corpus_canvas.trigger({'type':'audio-node-opened','nid':this.historic[this.currentHistoricIndex].nid});}catch(e){void 0;}
this.showHidePreviousBtn();this.showHideNextBtn();this.show();},setSRC(url){this.audio.src=url;},onLoadedmetadata(){var rem=parseInt(this.audio.duration,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$duration.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');this.updateLoadingBar();},updateLoadingBar(){this.$loader.css({'width':parseInt((100*this.audio.buffered.end(0)/this.audio.duration),10)+'%'});if(this.audio.buffered.end(0)<this.audio.duration){var that=this;window.requestAnimationFrame(that.updateLoadingBar.bind(that));}else{}},onCanplay(){this.play();},play(){this.clearTimeOutToHide();this.audio.play();},playPrevious(){if(this.currentHistoricIndex>0){this.currentHistoricIndex-=1;this.launch();}},playNext(){if(this.currentHistoricIndex<this.historic.length-1){this.currentHistoricIndex+=1;this.launch();}else{this.emmit('audio-play-next');}},togglePlayPause(e){if(this.audio.paused){this.audio.play();}else{this.audio.pause();}},stop(){this.audio.pause();if(!_$body.is('.path-node-'+this.historic[this.currentHistoricIndex].nid)){this.timeOutToHide();}},onPlaying(){this.$btns.addClass('is-playing');this.emmit('audio-play');},onPause(){this.$btns.removeClass('is-playing');this.emmit('audio-pause');},onTimeupdate(){this.$cursor.css({'left':(this.audio.currentTime/this.audio.duration*this.timeline_w)+"px"});var rem=parseInt(this.audio.currentTime,10),mins=Math.floor(rem/60,10),secs=rem-mins*60;this.$currentTime.html('<span>'+(mins<10?'0':'')+mins+':'+(secs<10?'0':'')+secs+'</span>');},onEnded(){void 0;this.emmit('audio-ended');this.stop();},loadNode(nid){this.$cartel.addClass('loading');var vm='player_cartel';var ajax_path=_ajax_settings.entityjson_path+'/node/'+nid+'/'+vm;var path=window.location.origin+Drupal.url(ajax_path);$.getJSON(path,{}).done(this.onNodeLoaded.bind(this)).fail(this.onNodeLoadFail.bind(this));},onNodeLoaded(data){this.$cartel.html(data.rendered).removeClass('loading');_$body.trigger({'type':'new-audio-cartel-loaded'});initAjaxLinks();},onNodeLoadFail(jqxhr,textStatus,error){void 0;this.$cartel.removeClass('loading').html('');},show(){this.$container.addClass('visible');},showHidePreviousBtn(){if(this.historic.length>1&&this.currentHistoricIndex>0){this.$previous.addClass('is-active');}else{this.$previous.removeClass('is-active');}},showHideNextBtn(){if(this.currentHistoricIndex<this.historic.length-1||this.shuffle_is_active){this.$next.addClass('is-active');}else{this.$next.removeClass('is-active');}},timeOutToHide(){this.clearTimeOutToHide();this.hideTimer=setTimeout(this.hide.bind(this),this.hideTimeMS);},clearTimeOutToHide(){if(this.hideTimer){clearTimeout(this.hideTimer);this.hideTimer=false;}},hide(){this.$container.removeClass('visible');try{_$corpus_canvas.trigger('audio-node-closed');}catch(e){void 0;}},on(event_name,handler){if(typeof this.event_handlers[event_name]=='undefined'){void 0;}
this.event_handlers[event_name].push(handler);return this;},emmit(event_name,args){var handler;var args=args||{};for(var i=this.event_handlers[event_name].length-1;i>=0;i--){handler=this.event_handlers[event_name][i];setTimeout(function(){handler(args);},0);}
return this;},}
function RandomPlayer(playlist){this.active=false;this.playlist=playlist;this.$btn=$('<a>').html('Shuffle').addClass('random-player-btn');this.init();};RandomPlayer.prototype={init(){$('<div>').addClass('block random-player').append(this.$btn).prependTo('.region-footer-right');this.$btn.on('click',this.toggleActive.bind(this));_audioPlayer.on('audio-ended',this.onAudioPlayerEnded.bind(this)).on('audio-play-next',this.onAudioPlayNext.bind(this)).on('stop-shuffle',this.stop.bind(this));},shuffle(){var tempPLaylist=[];for(var i=this.playlist.length-1;i>=0;i--){tempPLaylist.push(this.playlist[i]);}
this.shuffledPlaylist=[];while(tempPLaylist.length>0){var r=Math.floor(Math.random()*tempPLaylist.length);this.shuffledPlaylist.push(tempPLaylist.splice(r,1)[0]);}},toggleActive(e){if(this.active){this.stop();}else{this.start();}},start(){this.active=_audioPlayer.shuffle_is_active=true;this.$btn.addClass('is-active');this.shuffle();this.next();},stop(){this.active=_audioPlayer.shuffle_is_active=false;this.$btn.removeClass('is-active');},next(){if(this.active&&this.shuffledPlaylist.length>0)
_audioPlayer.openDocument(this.shuffledPlaylist.splice(0,1)[0]);},onAudioPlayNext(){this.next();},onAudioPlayerEnded(){this.next();}};function CompoPlayer(){this.active=false;this.playing=false;this.paused=false;this.playlist=[];this.current_index=0;this.$composer=null;this.$compo=null;this.$controls=null;this.init();};CompoPlayer.prototype={init(){_audioPlayer.on('audio-open-document',this.onAudioOpenDocument.bind(this)).on('audio-play',this.onAudioPlayerPlay.bind(this)).on('audio-pause',this.onAudioPlayerPause.bind(this)).on('audio-ended',this.onAudioPlayerEnded.bind(this));},newCompo(){this.initControls();},initControls(){this.$composer=$('.composition_ui .composer');this.$compo=$('.composition_ui .composer .composition');this.$controls=$('.composition_ui .composer .compo-player-controls');if(!this.$controls.is('.ready')&&this.$compo){this.$previous=$('<div>').addClass('previous').on('click',this.prev.bind(this)).appendTo(this.$controls);this.$playpause=$('<div>').addClass('play-pause').on('click',this.togglePlayPause.bind(this)).appendTo(this.$controls);this.$next=$('<div>').addClass('next').on('click',this.next.bind(this)).appendTo(this.$controls);this.$controls.addClass('ready');this.refresh();this.active=true;}},refresh(){this.stop();this.playlist=[];var that=this;$('.field--name-documents .field__item',this.$compo).each(function(i,el){var $link=$('a.audio-link',this);that.playlist.push({item:$(this),audio_url:$link.attr("audio_url"),nid:$link.attr("nid"),});});this.showHideControls();},togglePlayPause(){if(this.playing&&!this.paused){this.pause();}else{if(this.playing&&this.paused){this.play();}else{this.start();}}},start(){this.playing=true;this.play();},play(){if(this.paused){this.paused=false;_audioPlayer.play();}else{_audioPlayer.openDocument(this.playlist[this.current_index],this);}
this.setActiveItem().showHideControls();},pause(){this.paused=true;this.showHideControls();_audioPlayer.stop();},next(){if(this.playing){this.current_index+=1;if(this.current_index<this.playlist.length){this.play();}else{this.stop();}}},prev(){if(this.playing){this.current_index-=1;if(this.current_index>=0){this.play();}else{this.stop();}}},stop(){_audioPlayer.stop();this.reset();},reset(){this.playing=false;this.paused=false;this.resetIndex();},resetIndex(){this.current_index=0;this.showHideControls().resetActiveItems();},setActiveItem(){this.resetActiveItems();if(this.playing&&this.current_index>=0){this.playlist[this.current_index].item.addClass('is-active');}
this.setActiveItem().showHideControls();},pause(){this.paused=true;this.showHideControls();_audioPlayer.stop();},next(){if(this.playing){this.current_index+=1;if(this.current_index<this.playlist.length){this.play();}else{this.stop();}}},prev(){if(this.playing){this.current_index-=1;if(this.current_index>=0){this.play();}else{this.stop();}}},stop(){if(this.playing){_audioPlayer.stop();}
this.reset();},reset(){this.playing=false;this.paused=false;this.resetIndex();},resetIndex(){this.current_index=0;this.showHideControls().resetActiveItems();},setActiveItem(){this.resetActiveItems();if(this.playing&&this.current_index>=0){this.playlist[this.current_index].item.addClass('is-active');}
this.showHideControls();return this;},resetActiveItems(){for(var n=0;n<this.playlist.length;n++){this.playlist[n].item.removeClass('is-active');}
return this;},showHideControls(){if(this.$controls){if(this.playing&&!this.paused){this.$controls.addClass('is-playing');}else{this.$controls.removeClass('is-playing');}}
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(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);}}
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,drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);}}
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 initEnregistrementTranscript(){void 0;var $node=_$row.find('article.node--type-enregistrement.node--view-mode-transcript');var $nav=$('<nav>').prependTo($node);$node.find('.field--name-field-transcript-vo').addClass('visible').find('.field__label').clone().appendTo($nav).addClass('is-active').attr('field_target','.field--name-field-transcript-vo');$node.find('.field--name-field-transcript-trad').find('.field__label').clone().appendTo($nav).attr('field_target','.field--name-field-transcript-trad');$nav.find('.field__label').on('click',function(){var $this=$(this).addClass('is-active');$this.siblings('.is-active').removeClass('is-active');$this.parents('article.node').find('.field.visible').removeClass('visible');$this.parents('article.node').find($this.attr('field_target')).addClass('visible');});};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);
$(document).ready(function($){if(drupalSettings.path.isFront){var edlptheme=new EdlpTheme();}});})(jQuery,Drupal,drupalSettings);
File diff suppressed because one or more lines are too long
@@ -3,9 +3,16 @@ console.log('EDLP THEME HISTORY.js');
if(edlp.redirect){
console.log('history redirect', edlp);
console.log('window.location', window.location);
window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
window.localStorage.setItem('edlp_origin_url', window.location.pathname);
window.localStorage.setItem('edlp_origin_hash', window.location.hash);
// window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
edlp.sys_path = edlp.sys_path.replace(/^\//, '');
// 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{
@@ -3,7 +3,7 @@
EdlpTheme = function(){
var _ajax_settings = drupalSettings.edlp_ajax;
var _$body = $('body');
var _is_front = _$body.is('.path-frontpage');
// var _is_front = drupalSettings.path.isFront;
var _corpus_ready = false;
var _$corpus_canvas;
var _$row = $('main[role="main"]>.layout-content>.row');
@@ -19,6 +19,9 @@
function init(){
console.log("EdlpTheme init()");
_audioPlayer = new AudioPlayer();
_compoPlayer = new CompoPlayer();
initAjaxLinks();
initHistory();
@@ -28,9 +31,6 @@
initEvents();
_audioPlayer = new AudioPlayer();
_compoPlayer = new CompoPlayer();
};
// ___ _
@@ -118,6 +118,8 @@
var term_match = state.ajax_path.match(/^\/?(taxonomy\/term\/(\d+))$/i);
console.log('term_match', term_match);
if(node_match){
// TODO: detect audio links which will open audioplayer and wont load any ajax content unless view_mode "article" or "transcript"
state.ajax_path = _ajax_settings.entityjson_path+'/'+node_match[1];
state.node_nid = node_match[2];
// check for viewmode attribute
@@ -167,7 +169,17 @@
// reset all style may been added by other pages (like masonry for productions)
// and replace all content with newly loaded
// TODO: build a system to replace or append contents (like studio + search)
_$row.removeAttr('style').html(data.rendered);
if(data.entity_type == "node" && data.bundle == "evenement"){
if(_$row.find('.col.event').length){
_$row.find('.col.event').replaceWith(data.rendered);
}else if(_$row.find('.col.aside').length){
_$row.find('.col.aside').replaceWith(data.rendered);
}else{
_$row.append(data.rendered);
}
}else{
_$row.removeAttr('style').html(data.rendered);
}
// add body class for currently loaded content
var body_classes = [
@@ -340,6 +352,7 @@
$(block.id).replaceWith(block.rendered);
}
};
// _ _ _ _
// | || (_)__| |_ ___ _ _ _ _
// | __ | (_-< _/ _ \ '_| || |
@@ -352,18 +365,22 @@
function initFirstLoad(){
console.log('theme : initFirstLoad()');
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_sys_path = window.localStorage.getItem('edlp_origin_path');
var edlp_origin = JSON.parse(window.localStorage.getItem('edlp_origin'));
if(edlp_origin.sys_path){
// var origin_url = window.localStorage.getItem('edlp_origin_url');
// origin_hash is used as viewmode for taxonomy term entrees load (index or notice)
var origin_hash = window.localStorage.getItem('edlp_origin_hash');
var view_mode = origin_hash.replace('#', '');
// var origin_hash = window.localStorage.getItem('edlp_origin_hash');
var view_mode = edlp_origin.hash.replace('#', '');
// // TODO: refactorize with new infos from edlp_origin
if(view_mode){
// TODO first load with index or notice do not activate the right link (activate all)
var $link = $('[href="'+origin_url+'"][viewmode="'+view_mode+'"]');
var $link = $('[href="'+edlp_origin.url+'"][viewmode="'+view_mode+'"]');
var selector = $link.attr('selector') || null;
if(selector){
// in case of entree link (actualy, selector is used only for entries links)
// TODO: use a promise
if(_corpus_ready){
_$corpus_canvas.trigger({
type:'open-entree',
@@ -372,33 +389,49 @@
}else{
// else : EdlpCorpus will check when ready if entry item (notice or index) is already .is-active
// .is-active class is added by onAjaxLoaded() (when content is loaded)
// but what if corpus ready before onAjaxLoaded
// but what if corpus ready before onAjaxLoaded >> use a promise !!
$('li.entree[tid="'+$link.attr('tid')+'"] a.term-link').addClass('is-active');
}
}
}
// create history state
var state = getSysPathState(origin_sys_path, view_mode);
var state = getSysPathState(edlp_origin.sys_path, view_mode);
// check if audio link
if(edlp_origin.audio_url){
var node = {
nid:edlp_origin.entity_id,
audio_url:edlp_origin.audio_url
};
_audioPlayer.openDocument(node, 'history_first_load');
if(view_mode == ""){
// if audio only record in state
state.audio = true;
state.node = node;
}else{
// ajax load content for audio only if article or transcript
ajaxLoadContent(state);
}
}
// only if not entree path
if(state.ajax_path){
// only if not audio (without article or transcript) path
else if(state.ajax_path){
// load content through ajax
// ajaxLoadContent(null, state.sys_path, state.ajax_path, selector);
ajaxLoadContent(state);
}
// TODO what about entree alone (without notice or index)
if(state.entree_tid){
openEntree(state.entree_tid);
}
// record history state
history.replaceState(state, null, origin_url+origin_hash);
history.replaceState(state, null, edlp_origin.url+edlp_origin.hash);
// reset the storage
window.localStorage.removeItem("edlp_origin_path");
window.localStorage.removeItem("edlp_origin_url");
window.localStorage.removeItem("edlp_origin");
// window.localStorage.removeItem("edlp_origin_url");
}else{
history.replaceState({home:true}, null, window.location.pathname);
@@ -409,7 +442,11 @@
console.log('onPopState',e.state);
if(e.state.home){
backToFrontPage(true);
}else{
}
else if (e.state.audio) {
_audioPlayer.openDocument(e.state.node, 'popstate', e.state.historic_index);
}
else{
if(e.state.entree_tid){
openEntree(e.state.entree_tid);
}
@@ -631,7 +668,7 @@
this.$playpause.on('click', this.togglePlayPause.bind(this));
this.$next.on('click', this.playNext.bind(this));
},
openDocument(node, caller){
openDocument(node, caller, historic_index){
// console.log('AudioPlayer openDocument', node);
if(typeof node == 'undefined'
|| typeof node.nid == 'undefined'
@@ -639,11 +676,27 @@
console.warn('AudioPlayer openDocument() node is malformed', node);
return false;
}
this.historic.push(node);
this.currentHistoricIndex = this.historic.length-1;
// this.shuffle_mode = shuffle_mode || false;
// TODO: add an hash tag to be able to share and play audio from any where
// if we don't come from history popstate
if(typeof caller == 'undefined' || caller != 'popstate'){
this.historic.push(node);
this.currentHistoricIndex = this.historic.length-1;
// this.shuffle_mode = shuffle_mode || false;
// add the document opening to history to be able to share and play audio from any where
if(caller != "history_first_load"){
state = {
audio:true,
node:node,
historic_index : this.currentHistoricIndex,
};
history.pushState(state, null, node.document_url);
}
}else{
// if the call commes from popstate, we update the current position of index
this.currentHistoricIndex = historic_index;
}
this.emmit('audio-open-document', {caller:caller});
@@ -721,9 +774,12 @@
},
stop(){
// console.log('AudioPlayer stop()');
// debugger;
this.audio.pause();
// TODO: don't close player if article or transcript is open
this.timeOutToHide();
// don't close player if article or transcript is open
if(!_$body.is('.path-node-'+this.historic[this.currentHistoricIndex].nid)){
this.timeOutToHide();
}
},
// audio events
onPlaying(){
@@ -746,6 +802,7 @@
this.$currentTime.html('<span>'+(mins<10 ? '0':'')+mins+':'+(secs<10 ? '0':'')+secs+'</span>');
},
onEnded(){
console.log('AudioPlayer onEnded()');
this.emmit('audio-ended');
this.stop();
},
@@ -1040,7 +1097,9 @@
}
},
stop(){
_audioPlayer.stop();
if(this.playing){
_audioPlayer.stop();
}
this.reset();
},
reset(){
@@ -1151,7 +1210,7 @@
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
if(!pop_state){
history.pushState({home:true}, null, window.location.origin);
history.pushState({home:true}, null, drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);
}
}
@@ -1269,7 +1328,9 @@
} // end EdlpTheme()
$(document).ready(function($) {
var edlptheme = new EdlpTheme();
if(drupalSettings.path.isFront){
var edlptheme = new EdlpTheme();
}
});
})(jQuery, Drupal, drupalSettings);
@@ -248,11 +248,6 @@ main[role="main"]{
}
}
}
.field.text-formatted{
a.audio-link{
border-bottom: 1px dotted red;
}
}
}
h3.sur-title{
@include content_titles;
@@ -262,10 +257,19 @@ main[role="main"]{
@include content_titles;
}
article.node.node--type-enregistrement{
margin:0.5em 0;
>h2{
@include document_titles_teaser;
}
}
article.node.node--type-enregistrement.node--view-mode-transcript,
article.node.node--type-enregistrement.node--view-mode-article{
>h2{
@include content_subtitles;
margin:0.9em 0 0 0;
}
}
article.node.node--type-enregistrement.node--view-mode-transcript{
html.js &{
h3.sur-title{display:none;}
}
@@ -302,9 +306,123 @@ main[role="main"]{
}
}
}
article.node p{
@include content_courant;
article.node--type-page.node--view-mode-default{
>h2.node-title{
@include content_big_titles;
margin:0.3em 0;
}
.field--name-field-visuel{
margin-bottom: 1em;
}
}
.agenda{
.past-events{
border-top: 1px solid red;
margin-top: 1em;
}
text-align: center;
h3{
@include content_titles;
}
article.node > h2.node-title{
@include content_subtitles;
margin-bottom: 0;
}
.field--name-field-date{
time{
@include content_courant;
}
}
}
div.taxonomy-term{
>h2{display:none;}
>.content{
margin-top: 1em;
}
.field__label{
@include content_titles;
}
.field--name-field-notice{
.field__label{
margin-bottom: 1em;
}
}
article.node--type-enregistrement{
h2.node-title{
@include content_subtitles;
margin:0.9em 0 0 0;
}
}
}
article.node p, div.taxonomy-term p{
@include content_courant;
margin:0 0 1em 0;
}
.field.text-formatted{
a{
display: inline-block;
position: relative;
&:after{
content:'';
position: absolute;
// z-index: -1;
width:100%;
left:0; bottom:0.2em;
border-bottom: 1px dotted #1A1A1A;
}
&.audio-link{
&:after{
border-color: red;
}
}
}
}
.productions-subtree{
a{
@include nav_link;
&:before{
content: "";
display:inline-block;
$sq:7px;
width: $sq; height:$sq;
border: 1px solid black;
margin-right: 0.5em;
}
&:hover:before,
&.is-active:before{
background-color: black;
}
&.ajax-loading:before{
@include spining-loader-square;
}
}
}
.productions-parent{
margin-top: 1em;
margin-bottom: 0.5em;
a{
@include nav_link;
&:before{
content:'\2039';
// font-weight: bold;
font-size: 1.7em;
line-height: 0.95;
margin-right:0.1em;
margin-left: -0.4em;
display: inline-block;
vertical-align:bottom;
}
}
}
img{
max-width: 100%;
height: auto;
@@ -386,6 +504,7 @@ main[role="main"]{
opacity: 1;
pointer-events:all;
}
white-space: nowrap;
&>*{
display: inline-block;
vertical-align: middle;
@@ -393,6 +512,7 @@ main[role="main"]{
padding:0;
max-height: 100%;
// outline: 1px solid green;
white-space: normal;
}
.btns{
@include audio_controls;
@@ -474,7 +594,7 @@ main[role="main"]{
top: 0; left:0;
background-color: white;
height:100%; min-width: 100%;
opacity: 1;
opacity: 0;
transition: opacity 0.2s ease-in-out;
white-space: nowrap;
&>*{
@@ -1063,15 +1183,18 @@ main[role="main"]{
&.ajax-loading{
opacity:0.2;
}
article{
article.node{
&:first-of-type{
margin-top: 1em!important;
}
.entrees{
@include entree-micro-square;
}
h2.node-title{
margin:0 0 0.3em 0;
font-size: 0.8em;
font-weight: 500;
text-transform: none;
// font-size: 0.8em;
// font-weight: 500;
// text-transform: none;
}
// .description{
// p{
@@ -1104,29 +1227,28 @@ body.path-agenda main .col{
height:100%;
}
}
#agenda{
position: relative;
white-space: nowrap;
height: 100%;
div.column{
white-space: normal;
display: inline-block;
vertical-align: top;
height:100%;
}
div.next-event{
width:65%;
}
div.future-past-events{
width:33%;
}
.agenda{
// position: relative;
// white-space: nowrap;
// height: 100%;
// >*{
// white-space: normal;
// }
// div.column{
// display: inline-block;
// vertical-align: top;
// height:100%;
// }
// div.next-event{
// width:65%;
// }
// div.future-past-events{
// width:33%;
// }
ul,li{
margin:0; padding:0;
list-style: none;
}
article.node--type-evenement{
h2{ @include content_titles; }
}
}
@@ -1169,8 +1291,7 @@ body.path-frontpage, body.path-productions{
padding:0.5em 1em;
h2.node-title{
margin:0;
font-size: 0.8em;
text-transform: lowercase;
@include content_titles;
}
// p{margin: 0;}
}
@@ -1180,21 +1301,21 @@ body.path-frontpage, body.path-productions{
position: absolute;
bottom: 0; left:0;
h2.node-title{
font-size: 1.2em;
font-weight: 500;
@include content_big_titles;
}
}
}
&.node--view-mode-image-1-columns{
h2.node-title{
font-size: 1em;
font-weight: 500;
}
}
// &.node--view-mode-image-1-columns{
// h2.node-title{
// // font-size: 1em;
// // font-weight: 500;
// }
// }
&.node--view-mode-text-1-column{
padding:0 1em;
}
}
}
}
}
@@ -1,17 +1,36 @@
@mixin content_big_titles {
font-size: 1.3em;
font-weight: 500;
text-transform: uppercase;
}
@mixin content_titles {
font-size: 0.9em;
font-weight: normal;
text-transform: uppercase;
}
@mixin document_titles_teaser {
font-size: 0.82em;
font-weight: 500;
text-transform: none;
}
@mixin content_subtitles {
font-size: 0.82em;
font-weight: 600;
line-height: 1.6;
text-transform: none;
}
@mixin content_courant {
font-size: 0.82em;
font-weight: normal;
line-height: 1.6;
line-height: 1.4;
}
@mixin nav_link {
font-size: 0.82em;
font-weight: normal;
text-transform: uppercase;
}
@@ -8,8 +8,8 @@ $med-bp:1080px;
// $large-bp:1900px;
@mixin row() {
font-size: 0;
white-space: nowrap;
// font-size: 0;
// white-space: nowrap;
position: relative;
>*{
font-size: 16px;
@@ -18,10 +18,11 @@ $med-bp:1080px;
%col-reset {
width: 100%;
display: inline-block;
font-size: 16px;
// display: inline-block;
// white-space:normal;
// font-size: 16px;
float:left;
box-sizing: border-box;
white-space:normal;
}
@mixin col($col, $offset: 0, $sum: $default_sum, $gap: $default_gap, $align: top) {
@@ -33,7 +34,7 @@ $med-bp:1080px;
// @media only screen and (min-width: 768px) {
width: percentage($col/$sum);
vertical-align: $align;
// vertical-align: $align;
// }
}
@@ -1,15 +1,15 @@
<div class="col small-col-12 med-col-12 large-col-8 ">
<div class="col small-col-12 med-col-4 large-col-3 ">
<div class="wrapper">
<div id="agenda">
<div class="column next-event">
{{ next_event }}
</div>
<div class="column future-past-events os-scroll">
<div class="agenda">
{{ coming_events }}
{{ past_events }}
</div>
</div>
</div>
</div>
<div class="col small-col-12 med-col-8 large-col-5 event float-right">
<div class="wrapper">
<div class="agenda">
{{ next_event }}
</div>
</div>
</div>
@@ -1,7 +1,16 @@
<div class="col small-col-12 med-col-6 large-col-6">
<div class="col small-col-12 med-col-6 large-col-5">
<div class="wrapper">
{#<div class="os-scroll">#}
{{ content }}
{#</div>#}
</div>
</div>
{% if aside %}
<div class="col small-col-12 med-col-4 large-col-3 aside float-right">
<div class="wrapper">
{#<div class="os-scroll">#}
{{ aside }}
{#</div>#}
</div>
</div>
{% endif %}
@@ -0,0 +1,7 @@
<div class="col small-col-12 med-col-6 large-col-4 event float-right">
<div class="wrapper">
<div class="agenda">
{{ content }}
</div>
</div>
</div>
@@ -0,0 +1,39 @@
uuid: f5c1b1ab-e59e-4d7c-9b30-adc390450b46
langcode: fr
status: true
dependencies:
config:
- core.entity_view_mode.node.aside
- field.field.node.evenement.body
- field.field.node.evenement.field_date
- field.field.node.evenement.field_page_liee
- field.field.node.evenement.field_workflow_generic
- node.type.evenement
module:
- datetime_range
- user
id: node.evenement.aside
targetEntityType: node
bundle: evenement
mode: aside
content:
field_date:
weight: 1
label: hidden
settings:
timezone_override: ''
format_type: long
separator: '-'
third_party_settings: { }
type: daterange_default
region: content
links:
weight: 0
region: content
settings: { }
third_party_settings: { }
hidden:
body: true
field_page_liee: true
field_workflow_generic: true
langcode: true
@@ -4,6 +4,7 @@ status: true
dependencies:
config:
- core.entity_view_mode.taxonomy_term.notice
- field.field.taxonomy_term.entrees.field_color
- field.field.taxonomy_term.entrees.field_notice
- field.field.taxonomy_term.entrees.field_workflow
- taxonomy.vocabulary.entrees
@@ -23,5 +24,7 @@ content:
region: content
hidden:
description: true
field_color: true
field_workflow: true
index: true
langcode: true
@@ -0,0 +1,10 @@
uuid: f634def2-a5a8-4b28-a71e-be46cf1edbd4
langcode: fr
status: true
dependencies:
module:
- node
id: node.aside
label: Aside
targetEntityType: node
cache: true
@@ -4,6 +4,7 @@ status: true
dependencies:
module:
- editor
- edlp_admin
- edlp_corpus
- url_to_video_filter
name: wysiwyg
@@ -84,3 +85,9 @@ filters:
youtube_webp_preview: '0'
vimeo: '1'
autoload: '0'
css:
id: css
provider: edlp_admin
status: true
weight: 0
settings: { }
@@ -0,0 +1,22 @@
uuid: 4974717e-ade6-4010-951e-fa1d78d84a00
langcode: fr
status: true
dependencies:
module:
- node
id: documents
label: Documents
type: 'canonical_entities:node'
pattern: 'documents/[node:title]'
selection_criteria:
88beab32-c4e4-446a-99f7-aaa33b66a902:
id: node_type
bundles:
enregistrement: enregistrement
negate: false
context_mapping:
node: node
uuid: 88beab32-c4e4-446a-99f7-aaa33b66a902
selection_logic: and
weight: -5
relationships: { }
@@ -15,5 +15,6 @@ permissions:
- 'access synonyms entity autocomplete'
- 'create corpus_documents workflow_transition'
- 'create generique workflow_transition'
- 'use text format wysiwyg'
- 'view published fil entities'
- 'view search api pages'