big refactoring of mobile version xhich has now a hamburger menu and a link to collection
This commit is contained in:
@@ -29,23 +29,28 @@
|
||||
// if(!drupalSettings.path.isFront)
|
||||
// return;
|
||||
|
||||
if(!_is_mobile){
|
||||
initEvents();
|
||||
if(_is_mobile){
|
||||
initMobile();
|
||||
}
|
||||
|
||||
_audioPlayer = new AudioPlayer();
|
||||
_compoPlayer = new CompoPlayer();
|
||||
initEvents();
|
||||
|
||||
_audioPlayer = new AudioPlayer();
|
||||
_compoPlayer = new CompoPlayer();
|
||||
initAjaxLinks();
|
||||
initHistory();
|
||||
|
||||
|
||||
if(!_is_mobile){
|
||||
|
||||
checkLayout();
|
||||
|
||||
initAjaxLinks();
|
||||
|
||||
initHistory();
|
||||
|
||||
initAudioLinksHover();
|
||||
}else{
|
||||
}
|
||||
|
||||
if(_is_mobile){
|
||||
if(drupalSettings.path.isFront){
|
||||
initHomeMobile();
|
||||
|
||||
}
|
||||
_$body.attr('booted', 'booted');
|
||||
}
|
||||
@@ -62,38 +67,48 @@
|
||||
// | \/ |___| |__(_) |___
|
||||
// | |\/| / _ \ '_ \ | / -_)
|
||||
// |_| |_\___/_.__/_|_\___|
|
||||
function initHomeMobile(){
|
||||
$('.field--name-field-notice, .index', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
.addClass('closed');
|
||||
$('[data-drupal-link-system-path="<front>"]','#block-mainnavigation')
|
||||
.removeClass('is-active')
|
||||
.attr('href', '#collection');
|
||||
$('h2#block-mainnavigation-menu, a', '#block-mainnavigation')
|
||||
function initMobile(){
|
||||
// $('[data-drupal-link-system-path="<front>"]','#block-mainnavigation')
|
||||
// .removeClass('is-active')
|
||||
// .attr('href', '#collection');
|
||||
|
||||
// edlp_mobile.mobile_home_path.replace(/^\//, '')
|
||||
|
||||
// TODO: remove collection from mobile home
|
||||
// TODO: replace ajax link to only collection for mobile
|
||||
|
||||
|
||||
$('h2, a', '#block-mainnavigation')
|
||||
.add('h2, a', '#block-mainnavigation-2')
|
||||
.on('click', onclickHomeMobileMenu);
|
||||
// $('a', '#block-mainnavigation')
|
||||
// .on('click', onclickHomeMobileMenu);
|
||||
$('.field--name-field-notice>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
.on('click', onClickHomeMobileNotice);
|
||||
$('.index>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
.on('click', onClickHomeMobileIndex);
|
||||
};
|
||||
function onclickHomeMobileMenu(e){
|
||||
$('#block-mainnavigation').toggleClass('visible');
|
||||
};
|
||||
function onClickHomeMobileNotice(e){
|
||||
// console.log('onClickHomeMobileNotice');
|
||||
// var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
toggleEntreeOpening($(this).parent(), 'notice');
|
||||
};
|
||||
function onClickHomeMobileIndex(e){
|
||||
// console.log('onClickHomeMobileIndex');
|
||||
// var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
toggleEntreeOpening($(this).parent(), 'index');
|
||||
};
|
||||
function toggleEntreeOpening($e, part){
|
||||
$e.toggleClass('closed')
|
||||
.parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');
|
||||
}
|
||||
function onclickHomeMobileMenu(e){
|
||||
// $('#block-mainnavigation').toggleClass('opened');
|
||||
$('#block-mainnavigation-2').toggleClass('opened');
|
||||
};
|
||||
function initHomeMobile(){
|
||||
// taxonomy-term.vocabulary-entrees.home_mobile
|
||||
// $('.field--name-field-notice, .index', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
// .addClass('closed');
|
||||
// $('.field--name-field-notice>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
// .on('click', onClickHomeMobileNotice);
|
||||
// $('.index>.field__label', '.entrees .taxonomy-term.vocabulary-entrees')
|
||||
// .on('click', onClickHomeMobileIndex);
|
||||
};
|
||||
// function onClickHomeMobileNotice(e){
|
||||
// // console.log('onClickHomeMobileNotice');
|
||||
// // var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
// toggleEntreeOpening($(this).parent(), 'notice');
|
||||
// };
|
||||
// function onClickHomeMobileIndex(e){
|
||||
// // console.log('onClickHomeMobileIndex');
|
||||
// // var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
// toggleEntreeOpening($(this).parent(), 'index');
|
||||
// };
|
||||
// function toggleEntreeOpening($e, part){
|
||||
// $e.toggleClass('closed')
|
||||
// .parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');
|
||||
// }
|
||||
|
||||
// ___ _
|
||||
// | __|_ _____ _ _| |_ ___
|
||||
@@ -379,6 +394,11 @@
|
||||
addCloseModalBtnToCols();
|
||||
}
|
||||
|
||||
if(state.sys_path == "collection"){
|
||||
// only for mobile version of collection
|
||||
initCollectionNav();
|
||||
}
|
||||
|
||||
// enregistrement transcription
|
||||
if(data.entity_type == "node" && data.bundle == "enregistrement" && data.view_mode == "transcript"){
|
||||
// window.requestAnimationFrame(initEnregistrementTranscript);
|
||||
@@ -481,6 +501,8 @@
|
||||
};
|
||||
|
||||
function addCloseModalBtnToCols(){
|
||||
if(_is_mobile) return;
|
||||
|
||||
$('.col', _$row).each(function(index, el) {
|
||||
|
||||
if($('span.close-col-btn', this).length)
|
||||
@@ -682,6 +704,7 @@
|
||||
|
||||
$('a.site-name', '#block-edlptheme-branding')
|
||||
.add('a', '#block-mainnavigation')
|
||||
.add('a', '#block-mainnavigation-2')
|
||||
// .add('a', '.block.language-switcher-language-url')
|
||||
.add('a', '#block-footer.menu--footer')
|
||||
.add('a', '#block-productions')
|
||||
@@ -695,8 +718,16 @@
|
||||
|
||||
$('a[data-drupal-link-system-path="<front>"]', '#block-mainnavigation').removeClass('is-active');
|
||||
|
||||
_$ajaxLinks = $('.ajax-link:not(.ajax-enabled)')
|
||||
.each(function(i,e){
|
||||
_$ajaxLinks = $('.ajax-link');
|
||||
activateAjaxLinks();
|
||||
};
|
||||
// function initAudioLinks(){
|
||||
// _$ajaxLinks = $('.ajax-link.audio-link');
|
||||
// activateAjaxLinks();
|
||||
// };
|
||||
function activateAjaxLinks(){
|
||||
// $('.ajax-link:not(.ajax-enabled)')
|
||||
_$ajaxLinks.each(function(i,e){
|
||||
var $this = $(this);
|
||||
// avoid already ajaxified links
|
||||
if($this.is('.ajax-enable')) return;
|
||||
@@ -753,12 +784,17 @@
|
||||
// front page
|
||||
// just remove contents and stop here
|
||||
if(sys_path == '<front>'){
|
||||
if($link.is('.is-active') && _corpus_ready){
|
||||
_$corpus_canvas.trigger({'type':'shuffle-collection'});
|
||||
}else{
|
||||
backToFrontPage();
|
||||
if(!_is_mobile){
|
||||
if($link.is('.is-active') && _corpus_ready){
|
||||
_$corpus_canvas.trigger({'type':'shuffle-collection'});
|
||||
}else{
|
||||
backToFrontPage();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
// else{
|
||||
// sys_path = edlp_mobile.mobile_home_path.replace(/^\//, '');
|
||||
// }
|
||||
}
|
||||
|
||||
var view_mode = $link.attr('viewmode');
|
||||
@@ -993,7 +1029,7 @@
|
||||
this.currentHistoricIndex = historic_index;
|
||||
}
|
||||
|
||||
if(_$body.is('.path-frontpage') && caller !== 'lastdocs'){
|
||||
if(_$body.is('.path-frontpage') && caller !== 'lastdocs' && !_is_mobile){
|
||||
closeAllModals();
|
||||
}
|
||||
// TODO: update language switcher for document url
|
||||
@@ -1024,7 +1060,9 @@
|
||||
this.clearTimeOutToHide();
|
||||
this.clearIntervalAutoCartelSwitch();
|
||||
this.setSRC(this.historic[this.currentHistoricIndex].audio_url);
|
||||
this.loadNode(this.historic[this.currentHistoricIndex].nid);
|
||||
if(!_is_mobile){
|
||||
this.loadNode(this.historic[this.currentHistoricIndex].nid);
|
||||
}
|
||||
// emmit new playing doc (e.g.: corpus map nowing that audio played from RandomPlayer)
|
||||
try {
|
||||
_$corpus_canvas.trigger({
|
||||
@@ -1677,8 +1715,10 @@
|
||||
// \___|_| |_\__,_|
|
||||
function initGrid(){
|
||||
console.log('theme : initGrid');
|
||||
checkGridBlockHeight();
|
||||
_$row.find('.col').addClass('offfield');
|
||||
if(!_is_mobile){
|
||||
checkGridBlockHeight();
|
||||
_$row.find('.col').addClass('offfield');
|
||||
}
|
||||
if(false){
|
||||
|
||||
var $grid = $('.grid',_$row).masonry({
|
||||
@@ -1711,12 +1751,16 @@
|
||||
|
||||
}else{
|
||||
// setTimeout(checkGridBlockVisible, 100);
|
||||
checkGridBlockVisible();
|
||||
if(!_is_mobile){
|
||||
checkGridBlockVisible();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function checkGridBlockHeight(){
|
||||
// console.log('checkGridBlockHeight');
|
||||
// if(_is_mobile) return;
|
||||
|
||||
var $r_h = _$row.height();
|
||||
var $this;
|
||||
// console.log($r_h);
|
||||
@@ -1737,6 +1781,8 @@
|
||||
|
||||
function checkGridBlockVisible(){
|
||||
// console.log('checkGridBlockVisible');
|
||||
// if(_is_mobile) return;
|
||||
|
||||
var $r_h = _$row.height();
|
||||
var $this,pos;
|
||||
$('.grid .col', _$row).each(function(i,e){
|
||||
@@ -1803,6 +1849,40 @@
|
||||
// };
|
||||
|
||||
|
||||
|
||||
// ___ _ _ _ _
|
||||
// / __|___| | |___ __| |_(_)___ _ _
|
||||
// | (__/ _ \ | / -_) _| _| / _ \ ' \
|
||||
// \___\___/_|_\___\__|\__|_\___/_||_|
|
||||
// mobile version of collection
|
||||
function initCollectionNav(){
|
||||
console.log('initCollectionNav');
|
||||
// taxonomy-term.vocabulary-entrees.home_mobile
|
||||
$('.field--name-field-notice, .index', '.taxonomy-term.vocabulary-entrees.home_mobile')
|
||||
.addClass('closed');
|
||||
$('.field--name-field-notice>.field__label', '.taxonomy-term.vocabulary-entrees.home_mobile')
|
||||
.on('click', onClickCollectionNotice);
|
||||
$('.index>.field__label', '.taxonomy-term.vocabulary-entrees.home_mobile')
|
||||
.on('click', onClickCollectionIndex);
|
||||
};
|
||||
function onClickCollectionNotice(e){
|
||||
// console.log('onClickCollectionNotice');
|
||||
// var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
toggleEntreeOpening($(this).parent(), 'notice');
|
||||
};
|
||||
function onClickCollectionIndex(e){
|
||||
// console.log('onClickCollectionIndex');
|
||||
// var $part = $(this).parent();//parents('.taxonomy-term');
|
||||
toggleEntreeOpening($(this).parent(), 'index');
|
||||
};
|
||||
function toggleEntreeOpening($e, part){
|
||||
$e.toggleClass('closed')
|
||||
.parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ___ _
|
||||
// / __| ___ __ _ _ _ __| |_
|
||||
// \__ \/ -_) _` | '_/ _| ' \
|
||||
@@ -1852,8 +1932,10 @@
|
||||
$('body').removeClass().addClass('path-frontpage');
|
||||
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
|
||||
// close entrees
|
||||
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
||||
_$corpus_canvas.trigger({'type':'scramble-collection'});
|
||||
if(_corpus_ready){
|
||||
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
||||
_$corpus_canvas.trigger({'type':'scramble-collection'});
|
||||
}
|
||||
|
||||
if(typeof pop_state == "undefined" || !pop_state){
|
||||
console.log('backToFrontPage push state');
|
||||
@@ -1924,7 +2006,9 @@
|
||||
// }
|
||||
}else{
|
||||
// if we were on production page just scramble collection in case of map was filtered
|
||||
_$corpus_canvas.trigger({'type':'scramble-collection'});
|
||||
if(_corpus_ready){
|
||||
_$corpus_canvas.trigger({'type':'scramble-collection'});
|
||||
}
|
||||
// reload production home
|
||||
$('a[data-drupal-link-system-path="productions"]', '#block-mainnavigation')
|
||||
.removeClass('is-active').trigger('click');
|
||||
|
||||
Reference in New Issue
Block a user