production sound are now playable

This commit is contained in:
2018-04-24 22:33:49 +02:00
parent 6f7463ad93
commit 761659ddf0
6 changed files with 62 additions and 5 deletions
@@ -576,6 +576,7 @@
.add('a', '.productions-subtree') .add('a', '.productions-subtree')
.add('a', '.productions-parent') .add('a', '.productions-parent')
// .add('a.index-link, a.notice-link', '#block-edlpentreesblock') // .add('a.index-link, a.notice-link', '#block-edlpentreesblock')
.add('a', '.field--name-field-son')
.addClass('ajax-link'); .addClass('ajax-link');
_$ajaxLinks = $('.ajax-link:not(.ajax-enabled)') _$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
@@ -583,7 +584,7 @@
var $this = $(this); var $this = $(this);
// avoid already ajaxified links // avoid already ajaxified links
if($this.is('.ajax-enable')) return; if($this.is('.ajax-enable')) return;
if($this.attr('data-drupal-link-system-path')){ if($this.attr('data-drupal-link-system-path') || $this.is('[type^="audio"]')){
$this.on('click', onClickAjaxLink).addClass('ajax-enable'); $this.on('click', onClickAjaxLink).addClass('ajax-enable');
} }
}); });
@@ -608,6 +609,14 @@
return false; return false;
} }
// other sounds playing
if($link.is('[type^="audio"]')){
_audioPlayer
.emmit('stop-shuffle')
.openSound($link.attr('href'), $link.html());
return false;
}
// NOT USED ( YET ? ) // NOT USED ( YET ? )
// if($link.is('.language-link')){ // if($link.is('.language-link')){
// TODO: change global site current language // TODO: change global site current language
@@ -884,6 +893,16 @@
this.showHideNextBtn(); this.showHideNextBtn();
this.show(); this.show();
}, },
openSound(url, title){
this.hide();
this.clearTimeOutToHide();
this.$cartel.html("");
this.setSRC(url);
this.show();
if(typeof _paq !== 'undefined'){
_paq.push(['trackEvent', 'Audio', 'play', url]);
}
},
// audio functions // audio functions
setSRC(url){ setSRC(url){
console.log('AudioPlayer setSRC : url', url); console.log('AudioPlayer setSRC : url', url);
@@ -576,6 +576,7 @@
.add('a', '.productions-subtree') .add('a', '.productions-subtree')
.add('a', '.productions-parent') .add('a', '.productions-parent')
// .add('a.index-link, a.notice-link', '#block-edlpentreesblock') // .add('a.index-link, a.notice-link', '#block-edlpentreesblock')
.add('a', '.field--name-field-son')
.addClass('ajax-link'); .addClass('ajax-link');
_$ajaxLinks = $('.ajax-link:not(.ajax-enabled)') _$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
@@ -583,7 +584,7 @@
var $this = $(this); var $this = $(this);
// avoid already ajaxified links // avoid already ajaxified links
if($this.is('.ajax-enable')) return; if($this.is('.ajax-enable')) return;
if($this.attr('data-drupal-link-system-path')){ if($this.attr('data-drupal-link-system-path') || $this.is('[type^="audio"]')){
$this.on('click', onClickAjaxLink).addClass('ajax-enable'); $this.on('click', onClickAjaxLink).addClass('ajax-enable');
} }
}); });
@@ -608,6 +609,14 @@
return false; return false;
} }
// other sounds playing
if($link.is('[type^="audio"]')){
_audioPlayer
.emmit('stop-shuffle')
.openSound($link.attr('href'), $link.html());
return false;
}
// NOT USED ( YET ? ) // NOT USED ( YET ? )
// if($link.is('.language-link')){ // if($link.is('.language-link')){
// TODO: change global site current language // TODO: change global site current language
@@ -884,6 +893,16 @@
this.showHideNextBtn(); this.showHideNextBtn();
this.show(); this.show();
}, },
openSound(url, title){
this.hide();
this.clearTimeOutToHide();
this.$cartel.html("");
this.setSRC(url);
this.show();
if(typeof _paq !== 'undefined'){
_paq.push(['trackEvent', 'Audio', 'play', url]);
}
},
// audio functions // audio functions
setSRC(url){ setSRC(url){
console.log('AudioPlayer setSRC : url', url); console.log('AudioPlayer setSRC : url', url);
@@ -248,3 +248,7 @@ function edlptheme_preprocess_links__language_block(&$vars){
$vars['links'][$lang_code]['link']['#title'] = $lang_code; $vars['links'][$lang_code]['link']['#title'] = $lang_code;
} }
} }
function edlptheme_preprocess_file_link(&$vars){
}
@@ -0,0 +1,15 @@
{#
/**
* @file
* Default theme implementation for a link to a file.
*
* Available variables:
* - attributes: The HTML attributes for the containing element.
* - link: A link to the file.
*
* @see template_preprocess_file_link()
*
* @ingroup themeable
*/
#}
<span{{ attributes }}>{{ link }}</span>
@@ -26,12 +26,12 @@ content:
body: body:
label: hidden label: hidden
type: text_default type: text_default
weight: 3 weight: 2
settings: { } settings: { }
third_party_settings: { } third_party_settings: { }
region: content region: content
field_son: field_son:
weight: 2 weight: 3
label: hidden label: hidden
settings: settings:
use_description_as_link_text: true use_description_as_link_text: true
@@ -21,7 +21,7 @@ settings:
file_directory: page-sons file_directory: page-sons
file_extensions: 'mp3 ogg' file_extensions: 'mp3 ogg'
max_filesize: '' max_filesize: ''
description_field: false description_field: true
handler: 'default:file' handler: 'default:file'
handler_settings: { } handler_settings: { }
field_type: file field_type: file