|
@@ -1,6 +1,7 @@
|
|
(function($, Drupal, drupalSettings) {
|
|
(function($, Drupal, drupalSettings) {
|
|
|
|
|
|
EdlpTheme = function(){
|
|
EdlpTheme = function(){
|
|
|
|
+ var _ajax_settings = drupalSettings.edlp_ajax;
|
|
var _$body = $('body');
|
|
var _$body = $('body');
|
|
var _is_front = _$body.is('.path-frontpage');
|
|
var _is_front = _$body.is('.path-frontpage');
|
|
var _$corpus_canvas;
|
|
var _$corpus_canvas;
|
|
@@ -15,9 +16,10 @@
|
|
// | || ' \| | _|
|
|
// | || ' \| | _|
|
|
// |___|_||_|_|\__|
|
|
// |___|_||_|_|\__|
|
|
function init(){
|
|
function init(){
|
|
- console.log("EdlpTheme init()");
|
|
|
|
|
|
+ //console.log("EdlpTheme init()");
|
|
|
|
|
|
- // TODO: redirect all no-front pages to front with write hash
|
|
|
|
|
|
+ // redirect all no-front pages to front with right url ajax load
|
|
|
|
+ initHistory();
|
|
|
|
|
|
_$body.on('corpus-map-ready', onCorpusMapReady);
|
|
_$body.on('corpus-map-ready', onCorpusMapReady);
|
|
|
|
|
|
@@ -26,16 +28,11 @@
|
|
|
|
|
|
initAjaxLinks();
|
|
initAjaxLinks();
|
|
|
|
|
|
- if (_$body.is('.path-productions')){
|
|
|
|
- initProductions();
|
|
|
|
- }
|
|
|
|
|
|
+ if (_$body.is('.path-productions')) initProductions();
|
|
|
|
|
|
- if(_$body.is('.path-frontpage')){
|
|
|
|
- initHome();
|
|
|
|
- }
|
|
|
|
|
|
+ if(_$body.is('.path-frontpage')) initHome();
|
|
|
|
|
|
// initScrollbars();
|
|
// initScrollbars();
|
|
- initHistory();
|
|
|
|
initEvents();
|
|
initEvents();
|
|
};
|
|
};
|
|
|
|
|
|
@@ -81,110 +78,50 @@
|
|
// });
|
|
// });
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+
|
|
// _ _
|
|
// _ _
|
|
// /_\ (_)__ ___ __
|
|
// /_\ (_)__ ___ __
|
|
// / _ \ | / _` \ \ /
|
|
// / _ \ | / _` \ \ /
|
|
// /_/ \_\/ \__,_/_\_\
|
|
// /_/ \_\/ \__,_/_\_\
|
|
// |__/
|
|
// |__/
|
|
- // TODO: add url hash nav
|
|
|
|
- // TODO: implement history.js
|
|
|
|
- function initAjaxLinks(){
|
|
|
|
- console.log('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')
|
|
|
|
- // .add('a.index-link, a.notice-link', '#block-edlpentreesblock')
|
|
|
|
- .addClass('ajax-link');
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- _$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
|
|
|
|
- .each(function(i,e){
|
|
|
|
- var $this = $(this);
|
|
|
|
- // avoid already ajaxified links
|
|
|
|
- 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;
|
|
|
|
-
|
|
|
|
- // Audio links
|
|
|
|
- // launch audio player and stop here
|
|
|
|
- if($link.is('.audio-link')){
|
|
|
|
- _audioPlayer
|
|
|
|
- .emmit('stop-shuffle')
|
|
|
|
- .openDocument({
|
|
|
|
- nid:$link.attr('nid'),
|
|
|
|
- audio_url:$link.attr('audio_url')
|
|
|
|
- });
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // other links
|
|
|
|
- var url = $(this).attr('href');
|
|
|
|
- var sys_path = $(this).attr('data-drupal-link-system-path');
|
|
|
|
-
|
|
|
|
- // front page
|
|
|
|
- // just remove contents and stop here
|
|
|
|
- if(sys_path == '<front>'){
|
|
|
|
- backToFrontPage();
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var ajax_path = parseLinkAjaxPath($link);
|
|
|
|
-
|
|
|
|
- $link.addClass('ajax-loading');
|
|
|
|
-
|
|
|
|
- ajaxLinkLoadContent(url, sys_path, ajax_path);
|
|
|
|
- return false;
|
|
|
|
- };
|
|
|
|
- function parseLinkAjaxPath($link){
|
|
|
|
- var ajax_path = $link.attr('data-drupal-link-system-path');
|
|
|
|
|
|
+ function parseAjaxSysPath(sys_path, view_mode){
|
|
|
|
+ // console.log('Theme : parseAjaxSysPath', sys_path);
|
|
|
|
+ var ajax_path = sys_path;
|
|
|
|
|
|
// convert node link to edlp_ajax_node module links
|
|
// convert node link to edlp_ajax_node module links
|
|
var node_match = ajax_path.match(/^\/?(node\/\d+)$/g);
|
|
var node_match = ajax_path.match(/^\/?(node\/\d+)$/g);
|
|
var term_match = ajax_path.match(/^\/?(taxonomy\/term\/\d+)$/g);
|
|
var term_match = ajax_path.match(/^\/?(taxonomy\/term\/\d+)$/g);
|
|
if(node_match){
|
|
if(node_match){
|
|
- ajax_path = 'edlp/ajax/json/'+node_match[0];
|
|
|
|
|
|
+ ajax_path = _ajax_settings.entityjson_path+'/'+node_match[0];
|
|
// check for viewmode attribute
|
|
// check for viewmode attribute
|
|
- if($link.attr('viewmode')){
|
|
|
|
- ajax_path += '/'+$link.attr('viewmode');
|
|
|
|
|
|
+ if(view_mode){
|
|
|
|
+ ajax_path += '/'+view_mode;
|
|
}
|
|
}
|
|
}else if(term_match){
|
|
}else if(term_match){
|
|
- ajax_path = 'edlp/ajax/json/'+term_match[0];
|
|
|
|
|
|
+ ajax_path = _ajax_settings.entityjson_path+'/'+term_match[0];
|
|
ajax_path = ajax_path.replace(/taxonomy\/term/, 'taxonomy_term');
|
|
ajax_path = ajax_path.replace(/taxonomy\/term/, 'taxonomy_term');
|
|
// check for viewmode attribute
|
|
// check for viewmode attribute
|
|
- if($link.attr('viewmode')){
|
|
|
|
- ajax_path += '/'+$link.attr('viewmode');
|
|
|
|
|
|
+ if(view_mode){
|
|
|
|
+ ajax_path += '/'+view_mode;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
// convert other link to ajax
|
|
// convert other link to ajax
|
|
|
|
+ // TODO: we assume that other links (no node, no term) are all from own modules (e.g. productions) !! may not be true !!
|
|
ajax_path += '/ajax'
|
|
ajax_path += '/ajax'
|
|
}
|
|
}
|
|
-
|
|
|
|
return ajax_path;
|
|
return ajax_path;
|
|
};
|
|
};
|
|
- function ajaxLinkLoadContent(url, sys_path, ajax_path){
|
|
|
|
-
|
|
|
|
|
|
+ function ajaxLoadContent(url, sys_path, ajax_path, selector){
|
|
|
|
+ //console.log('ajaxLoadContent : ajax_path', ajax_path);
|
|
_$body.addClass('ajax-loading');
|
|
_$body.addClass('ajax-loading');
|
|
|
|
|
|
var path = window.location.origin + Drupal.url(ajax_path);
|
|
var path = window.location.origin + Drupal.url(ajax_path);
|
|
$.getJSON(path, {})
|
|
$.getJSON(path, {})
|
|
.done(function(data){
|
|
.done(function(data){
|
|
- onAjaxLinkLoaded(data, sys_path);
|
|
|
|
|
|
+ onAjaxLoaded(data, sys_path, selector);
|
|
})
|
|
})
|
|
.fail(function(jqxhr, textStatus, error){
|
|
.fail(function(jqxhr, textStatus, error){
|
|
- onAjaxLinkLoadError(jqxhr, textStatus, error, sys_path);
|
|
|
|
|
|
+ onAjaxLoadError(jqxhr, textStatus, error, sys_path);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -195,18 +132,19 @@
|
|
// url is null means that we are loading content on popState event
|
|
// url is null means that we are loading content on popState event
|
|
// so we don't record the state again
|
|
// so we don't record the state again
|
|
if(url){
|
|
if(url){
|
|
|
|
+ // console.log('url:'+url+' ; state',state);
|
|
|
|
+ // we can not pushestate with absolute url
|
|
history.pushState(state, null, url);
|
|
history.pushState(state, null, url);
|
|
}
|
|
}
|
|
|
|
|
|
};
|
|
};
|
|
- function onAjaxLinkLoadError(jqxhr, textStatus, error, sys_path){
|
|
|
|
|
|
+ function onAjaxLoadError(jqxhr, textStatus, error, sys_path){
|
|
console.warn('ajaxlink load failed for '+sys_path+' : '+error, jqxhr.responseText);
|
|
console.warn('ajaxlink load failed for '+sys_path+' : '+error, jqxhr.responseText);
|
|
$('.ajax-loading').removeClass('ajax-loading');
|
|
$('.ajax-loading').removeClass('ajax-loading');
|
|
_$body.removeClass('ajax-loading');
|
|
_$body.removeClass('ajax-loading');
|
|
};
|
|
};
|
|
- function onAjaxLinkLoaded(data, sys_path){
|
|
|
|
- // console.log('ajax link loaded : data', data);
|
|
|
|
- _$body.removeClass('ajax-loading');
|
|
|
|
|
|
+ function onAjaxLoaded(data, sys_path, selector){
|
|
|
|
+ console.log('ajax link loaded : data', data);
|
|
|
|
|
|
// reset all style may been added by other pages (like masonry for productions)
|
|
// reset all style may been added by other pages (like masonry for productions)
|
|
// and replace all content with newly loaded
|
|
// and replace all content with newly loaded
|
|
@@ -214,7 +152,7 @@
|
|
_$row.removeAttr('style').html(data.rendered);
|
|
_$row.removeAttr('style').html(data.rendered);
|
|
|
|
|
|
// add close btn
|
|
// add close btn
|
|
- if(sys_path != 'procuction'){
|
|
|
|
|
|
+ if(sys_path != 'productions'){
|
|
addCloseBtnToCols();
|
|
addCloseBtnToCols();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -235,13 +173,28 @@
|
|
// handle clicked link classes
|
|
// handle clicked link classes
|
|
_$ajaxLinks.removeClass('is-active');
|
|
_$ajaxLinks.removeClass('is-active');
|
|
$('.ajax-loading').removeClass('ajax-loading');
|
|
$('.ajax-loading').removeClass('ajax-loading');
|
|
- $('a[data-drupal-link-system-path="'+sys_path+'"]').addClass('is-active');
|
|
|
|
|
|
|
|
- // TODO: keep production menu active for content type Page (production)
|
|
|
|
|
|
+ // TODO: break entrees links wich all have same sys_path
|
|
|
|
+ if(typeof selector != 'undefined'){
|
|
|
|
+ $('a[selector="'+selector+'"]').addClass('is-active');
|
|
|
|
+ }else{
|
|
|
|
+ $('a[data-drupal-link-system-path="'+sys_path+'"]').addClass('is-active');
|
|
|
|
+ }
|
|
|
|
|
|
- // TODO: if node is in production menu tree, set first level of tree active, e.g. pieces sonores
|
|
|
|
|
|
+ // if bundle page (productions) activate production links
|
|
|
|
+ if (typeof data.bundle != 'undefined' && data.bundle == "page") {
|
|
|
|
+ $('a[data-drupal-link-system-path="productions"]').addClass('is-active');
|
|
|
|
+ }
|
|
|
|
+ // if node is in production menu tree, set first level of tree active, e.g. pieces sonores
|
|
|
|
+ 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');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
// if block attached (eg : from edlp_productions module)
|
|
// if block attached (eg : from edlp_productions module)
|
|
|
|
+ // not used anymore as production block is always present (but not visible)
|
|
if(typeof data.block != 'undefined'){
|
|
if(typeof data.block != 'undefined'){
|
|
// if block not already added
|
|
// if block not already added
|
|
if(!$('#'+data.block.id, '.region-'+data.block.region).length){
|
|
if(!$('#'+data.block.id, '.region-'+data.block.region).length){
|
|
@@ -261,6 +214,9 @@
|
|
// and call druapl behaviours
|
|
// and call druapl behaviours
|
|
Drupal.attachBehaviors(_$row[0]);
|
|
Drupal.attachBehaviors(_$row[0]);
|
|
|
|
|
|
|
|
+ _$body.attr('booted', 'booted');
|
|
|
|
+ _$body.removeClass('ajax-loading');
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
function addCloseBtnToCols(){
|
|
function addCloseBtnToCols(){
|
|
@@ -289,44 +245,119 @@
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
- // _ _ _ _ _ ___
|
|
|
|
- // | || (_)__| |_ ___ _ _ _ _ _ | / __|
|
|
|
|
- // | __ | (_-< _/ _ \ '_| || | || \__ \
|
|
|
|
- // |_||_|_/__/\__\___/_| \_, |\__/|___/
|
|
|
|
|
|
+ // _ _ _ _
|
|
|
|
+ // | || (_)__| |_ ___ _ _ _ _
|
|
|
|
+ // | __ | (_-< _/ _ \ '_| || |
|
|
|
|
+ // |_||_|_/__/\__\___/_| \_, |
|
|
// |__/
|
|
// |__/
|
|
function initHistory(){
|
|
function initHistory(){
|
|
initFirstLoad();
|
|
initFirstLoad();
|
|
window.addEventListener('popstate', onHistoryPopState);
|
|
window.addEventListener('popstate', onHistoryPopState);
|
|
};
|
|
};
|
|
function initFirstLoad(){
|
|
function initFirstLoad(){
|
|
- console.log(window.location);
|
|
|
|
- // console.log(document);
|
|
|
|
|
|
+ // console.log('theme : initFirstLoad()', window.location);
|
|
|
|
+ // console.log(document.cookie);
|
|
var url = window.location.pathname;
|
|
var url = window.location.pathname;
|
|
- if( url != "" && url != "/"){
|
|
|
|
- // TODO: THIS IS NOT WORKING ! with link which dont exist in dom, e.g. productions
|
|
|
|
- // TODO: how to retrieve sys_path without dom ?
|
|
|
|
- var $link = $('a[href="'+url+'"][data-drupal-link-system-path]').eq(0);
|
|
|
|
- console.log($link);
|
|
|
|
- var sys_path = $link.attr('data-drupal-link-system-path');
|
|
|
|
-
|
|
|
|
- var state = {
|
|
|
|
- ajax_path: parseLinkAjaxPath($link),
|
|
|
|
- sys_path: sys_path,
|
|
|
|
- };
|
|
|
|
- history.replaceState(state, null, url);
|
|
|
|
- ajaxLinkLoadContent(null, state.sys_path, state.ajax_path)
|
|
|
|
|
|
+ if(url != '' && url != '/'){
|
|
|
|
+ var origin_path = getCookie('edlp_origin_path');
|
|
|
|
+ // console.log('origin_path', origin_path);
|
|
|
|
+ if(origin_path){
|
|
|
|
+ var state = {
|
|
|
|
+ ajax_path: parseAjaxSysPath(origin_path),
|
|
|
|
+ sys_path: origin_path,
|
|
|
|
+ };
|
|
|
|
+ ajaxLoadContent(null, state.sys_path, state.ajax_path);
|
|
|
|
+ history.replaceState(state, null, url);
|
|
|
|
+ // reset the cookie
|
|
|
|
+ deleteCookie('edlp_origin_path');
|
|
|
|
+ deleteCookie('edlp_sys_path');
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
history.replaceState({home:true}, null, url);
|
|
history.replaceState({home:true}, null, url);
|
|
|
|
+ _$body.attr('booted', 'booted');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function onHistoryPopState(e){
|
|
function onHistoryPopState(e){
|
|
- console.log('onPopState',e);
|
|
|
|
|
|
+ //console.log('onPopState',e);
|
|
if(e.state.home){
|
|
if(e.state.home){
|
|
backToFrontPage();
|
|
backToFrontPage();
|
|
}else{
|
|
}else{
|
|
- ajaxLinkLoadContent(null, e.state.sys_path, e.state.ajax_path)
|
|
|
|
|
|
+ ajaxLoadContent(null, e.state.sys_path, e.state.ajax_path)
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // _ _ _ _ _
|
|
|
|
+ // /_\ (_)__ ___ _| | (_)_ _ | |__ ___
|
|
|
|
+ // / _ \ | / _` \ \ / |__| | ' \| / /(_-<
|
|
|
|
+ // /_/ \_\/ \__,_/_\_\____|_|_||_|_\_\/__/
|
|
|
|
+ // |__/
|
|
|
|
+ function initAjaxLinks(){
|
|
|
|
+ // console.log('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')
|
|
|
|
+ // .add('a.index-link, a.notice-link', '#block-edlpentreesblock')
|
|
|
|
+ // .addClass('use-ajax')
|
|
|
|
+ .addClass('ajax-link');
|
|
|
|
+
|
|
|
|
+ Drupal.ajax.bindAjaxLinks('#block-footer.menu--footer');
|
|
|
|
+ _$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
|
|
|
|
+ .each(function(i,e){
|
|
|
|
+ var $this = $(this);
|
|
|
|
+ // avoid already ajaxified links
|
|
|
|
+ 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;
|
|
|
|
+
|
|
|
|
+ // Audio links
|
|
|
|
+ // launch audio player and stop here
|
|
|
|
+ if($link.is('.audio-link')){
|
|
|
|
+ _audioPlayer
|
|
|
|
+ .emmit('stop-shuffle')
|
|
|
|
+ .openDocument({
|
|
|
|
+ nid:$link.attr('nid'),
|
|
|
|
+ audio_url:$link.attr('audio_url')
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // other links
|
|
|
|
+ var url = $(this).attr('href');
|
|
|
|
+ var sys_path = $(this).attr('data-drupal-link-system-path');
|
|
|
|
+
|
|
|
|
+ // front page
|
|
|
|
+ // just remove contents and stop here
|
|
|
|
+ if(sys_path == '<front>'){
|
|
|
|
+ backToFrontPage();
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var view_mode = $link.attr('viewmode');
|
|
|
|
+ var ajax_path = parseAjaxSysPath(sys_path, view_mode);
|
|
|
|
+
|
|
|
|
+ $link.addClass('ajax-loading');
|
|
|
|
+
|
|
|
|
+ if($link.is('[selector]')){
|
|
|
|
+ var selector = $link.attr('selector');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ ajaxLoadContent(url, sys_path, ajax_path, selector);
|
|
|
|
+ return false;
|
|
};
|
|
};
|
|
|
|
|
|
// ___
|
|
// ___
|
|
@@ -335,15 +366,15 @@
|
|
// \___\___/_| | .__/\_,_/__/
|
|
// \___\___/_| | .__/\_,_/__/
|
|
// |_|
|
|
// |_|
|
|
function onCorpusMapReady(e){
|
|
function onCorpusMapReady(e){
|
|
- console.log('theme : onCorpusReady', e);
|
|
|
|
|
|
+ //console.log('theme : onCorpusReady', e);
|
|
_$corpus_canvas = $('canvas#corpus-map');
|
|
_$corpus_canvas = $('canvas#corpus-map');
|
|
_$corpus_canvas
|
|
_$corpus_canvas
|
|
.on('corpus-cliked-on-map', function(e) {
|
|
.on('corpus-cliked-on-map', function(e) {
|
|
- console.log('theme : corpus-cliked-on-map');
|
|
|
|
|
|
+ //console.log('theme : corpus-cliked-on-map');
|
|
backToFrontPage();
|
|
backToFrontPage();
|
|
})
|
|
})
|
|
.on('corpus-cliked-on-node', function(e) {
|
|
.on('corpus-cliked-on-node', function(e) {
|
|
- console.log('theme : corpus-cliked-on-node', e);
|
|
|
|
|
|
+ //console.log('theme : corpus-cliked-on-node', e);
|
|
_audioPlayer
|
|
_audioPlayer
|
|
.emmit('stop-shuffle')
|
|
.emmit('stop-shuffle')
|
|
.openDocument(e.target_node);
|
|
.openDocument(e.target_node);
|
|
@@ -491,7 +522,7 @@
|
|
var that = this;
|
|
var that = this;
|
|
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
|
window.requestAnimationFrame(that.updateLoadingBar.bind(that));
|
|
}else{
|
|
}else{
|
|
- console.log('Audio fully loaded');
|
|
|
|
|
|
+ //console.log('Audio fully loaded');
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onCanplay(){
|
|
onCanplay(){
|
|
@@ -554,7 +585,10 @@
|
|
// cartel functions
|
|
// cartel functions
|
|
loadNode(nid){
|
|
loadNode(nid){
|
|
this.$cartel.addClass('loading');
|
|
this.$cartel.addClass('loading');
|
|
- $.getJSON('/edlp/ajax/json/node/'+nid+'/player_cartel', {})
|
|
|
|
|
|
+ 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))
|
|
.done(this.onNodeLoaded.bind(this))
|
|
.fail(this.onNodeLoadFail.bind(this));
|
|
.fail(this.onNodeLoadFail.bind(this));
|
|
},
|
|
},
|
|
@@ -671,7 +705,7 @@
|
|
var r = Math.floor(Math.random() * tempPLaylist.length);
|
|
var r = Math.floor(Math.random() * tempPLaylist.length);
|
|
this.shuffledPlaylist.push(tempPLaylist.splice(r,1)[0]);
|
|
this.shuffledPlaylist.push(tempPLaylist.splice(r,1)[0]);
|
|
}
|
|
}
|
|
- console.log('RandomPlayer, this.shuffledPlaylist', this.shuffledPlaylist);
|
|
|
|
|
|
+ //console.log('RandomPlayer, this.shuffledPlaylist', this.shuffledPlaylist);
|
|
},
|
|
},
|
|
toggleActive(e){
|
|
toggleActive(e){
|
|
if (this.active) {
|
|
if (this.active) {
|
|
@@ -697,11 +731,11 @@
|
|
_audioPlayer.openDocument(this.shuffledPlaylist.splice(0,1)[0]);
|
|
_audioPlayer.openDocument(this.shuffledPlaylist.splice(0,1)[0]);
|
|
},
|
|
},
|
|
onAudioPlayNext(){
|
|
onAudioPlayNext(){
|
|
- console.log('RandomPlayer : onAudioPlayNext()');
|
|
|
|
|
|
+ //console.log('RandomPlayer : onAudioPlayNext()');
|
|
this.next();
|
|
this.next();
|
|
},
|
|
},
|
|
onAudioPlayerEnded(){
|
|
onAudioPlayerEnded(){
|
|
- console.log('RandomPlayer : onAudioPlayerEnded()');
|
|
|
|
|
|
+ //console.log('RandomPlayer : onAudioPlayerEnded()');
|
|
this.next();
|
|
this.next();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -724,7 +758,7 @@
|
|
};
|
|
};
|
|
CompoPlayer.prototype = {
|
|
CompoPlayer.prototype = {
|
|
init(){
|
|
init(){
|
|
- console.log('CompoPlayer init()');
|
|
|
|
|
|
+ // console.log('CompoPlayer init()');
|
|
// attach an event on AudioPlayer
|
|
// attach an event on AudioPlayer
|
|
_audioPlayer
|
|
_audioPlayer
|
|
.on('audio-open-document', this.onAudioOpenDocument.bind(this))
|
|
.on('audio-open-document', this.onAudioOpenDocument.bind(this))
|
|
@@ -736,12 +770,12 @@
|
|
// this.newCompo();
|
|
// this.newCompo();
|
|
},
|
|
},
|
|
newCompo(){
|
|
newCompo(){
|
|
- console.log('CompoPlayer newCompo()');
|
|
|
|
|
|
+ //console.log('CompoPlayer newCompo()');
|
|
// this.$compo = $('.composition_ui .composer .composition');
|
|
// this.$compo = $('.composition_ui .composer .composition');
|
|
this.initControls();
|
|
this.initControls();
|
|
},
|
|
},
|
|
initControls(){
|
|
initControls(){
|
|
- console.log('CompoPlayer initControls()');
|
|
|
|
|
|
+ //console.log('CompoPlayer initControls()');
|
|
this.$composer = $('.composition_ui .composer');
|
|
this.$composer = $('.composition_ui .composer');
|
|
this.$compo = $('.composition_ui .composer .composition');
|
|
this.$compo = $('.composition_ui .composer .composition');
|
|
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
|
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
|
@@ -794,7 +828,7 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
start(){
|
|
start(){
|
|
- console.log('start');
|
|
|
|
|
|
+ //console.log('start');
|
|
// console.log('CompoPlayer start()');
|
|
// console.log('CompoPlayer start()');
|
|
this.playing = true;
|
|
this.playing = true;
|
|
this.play();
|
|
this.play();
|
|
@@ -810,7 +844,7 @@
|
|
this.setActiveItem().showHideControls();
|
|
this.setActiveItem().showHideControls();
|
|
},
|
|
},
|
|
pause(){
|
|
pause(){
|
|
- console.log('pause');
|
|
|
|
|
|
+ //console.log('pause');
|
|
this.paused = true;
|
|
this.paused = true;
|
|
this.showHideControls();
|
|
this.showHideControls();
|
|
_audioPlayer.stop();
|
|
_audioPlayer.stop();
|
|
@@ -936,7 +970,6 @@
|
|
// }
|
|
// }
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
// ___ _ ___
|
|
// ___ _ ___
|
|
// | __| _ ___ _ _| |_| _ \__ _ __ _ ___
|
|
// | __| _ ___ _ _| |_| _ \__ _ __ _ ___
|
|
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
|
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
|
@@ -952,7 +985,7 @@
|
|
|
|
|
|
function initHome(){
|
|
function initHome(){
|
|
addCloseBtnToCols();
|
|
addCloseBtnToCols();
|
|
- console.log('theme : initHome');
|
|
|
|
|
|
+ // console.log('theme : initHome');
|
|
// console.log('theme : initProductions');
|
|
// console.log('theme : initProductions');
|
|
var $grid = $('.grid',_$row).masonry({
|
|
var $grid = $('.grid',_$row).masonry({
|
|
itemSelector:'.col',
|
|
itemSelector:'.col',
|
|
@@ -971,7 +1004,6 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
// ___ _ _ _
|
|
// ___ _ _ _
|
|
// | _ \_ _ ___ __| |_ _ __| |_(_)___ _ _ ___
|
|
// | _ \_ _ ___ __| |_ _ __| |_(_)___ _ _ ___
|
|
// | _/ '_/ _ \/ _` | || / _| _| / _ \ ' \(_-<
|
|
// | _/ '_/ _ \/ _` | || / _| _| / _ \ ' \(_-<
|
|
@@ -1000,13 +1032,32 @@
|
|
// | |\/| / _ \/ _` / _` | (_-<
|
|
// | |\/| / _ \/ _` / _` | (_-<
|
|
// |_| |_\___/\__,_\__,_|_/__/
|
|
// |_| |_\___/\__,_\__,_|_/__/
|
|
function closeAllModals(){
|
|
function closeAllModals(){
|
|
- console.log('theme : closeAllModals');
|
|
|
|
|
|
+ //console.log('theme : closeAllModals');
|
|
// TODO: animate the remove
|
|
// TODO: animate the remove
|
|
_$row.html('');
|
|
_$row.html('');
|
|
_$ajaxLinks.removeClass('is-active');
|
|
_$ajaxLinks.removeClass('is-active');
|
|
_$body.trigger({'type':'all-modal-closed'});
|
|
_$body.trigger({'type':'all-modal-closed'});
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // _ _ _
|
|
|
|
+ // | || |___| |_ __ ___ _ _ ___
|
|
|
|
+ // | __ / -_) | '_ \/ -_) '_(_-<
|
|
|
|
+ // |_||_\___|_| .__/\___|_| /__/
|
|
|
|
+ // |_|
|
|
|
|
+
|
|
|
|
+ // https://plainjs.com/javascript/utilities/set-cookie-get-cookie-and-delete-cookie-5/
|
|
|
|
+ function getCookie(name) {
|
|
|
|
+ var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
|
|
|
+ return v ? v[2] : null;
|
|
|
|
+ }
|
|
|
|
+ function setCookie(name, value, days) {
|
|
|
|
+ var d = new Date;
|
|
|
|
+ d.setTime(d.getTime() + 24*60*60*1000*days);
|
|
|
|
+ document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function deleteCookie(name) { setCookie(name, '', -1); }
|
|
|
|
+
|
|
init();
|
|
init();
|
|
} // end EdlpTheme()
|
|
} // end EdlpTheme()
|
|
|
|
|