fixed cloing entree history nav
This commit is contained in:
@@ -616,9 +616,7 @@
|
|||||||
// | __|_ _| |_ _ _ ___ ___ ___
|
// | __|_ _| |_ _ _ ___ ___ ___
|
||||||
// | _|| ' \ _| '_/ -_) -_|_-<
|
// | _|| ' \ _| '_/ -_) -_|_-<
|
||||||
// |___|_||_\__|_| \___\___/__/
|
// |___|_||_\__|_| \___\___/__/
|
||||||
// TODO : this functionn is not clear as it should be called toggleEntry
|
function toggleEntree(tid, bubbling){
|
||||||
function openEntree(tid, bubbling){
|
|
||||||
//var $link = $('a.term-link[tid="'+tid+'"]');
|
|
||||||
var $link = _$entrees_block_termlinks.filter('[tid="'+tid+'"]');
|
var $link = _$entrees_block_termlinks.filter('[tid="'+tid+'"]');
|
||||||
var $li = $link.parents('li');
|
var $li = $link.parents('li');
|
||||||
var sys_path = $link.attr('data-drupal-link-system-path');
|
var sys_path = $link.attr('data-drupal-link-system-path');
|
||||||
@@ -630,6 +628,7 @@
|
|||||||
if(bubbling){
|
if(bubbling){
|
||||||
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
||||||
}
|
}
|
||||||
|
// bubbling is true only when event is a real click on entree link
|
||||||
}else if(bubbling){
|
}else if(bubbling){
|
||||||
$li.removeClass('opened');
|
$li.removeClass('opened');
|
||||||
scrambleCollection();
|
scrambleCollection();
|
||||||
@@ -696,20 +695,14 @@
|
|||||||
// |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
|
// |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
|
||||||
// |___/
|
// |___/
|
||||||
function scrambleCollection(){
|
function scrambleCollection(){
|
||||||
console.log('scrambleCollection');
|
// console.log('scrambleCollection');
|
||||||
for (var i = 0; i < _nodes.length; i++) {
|
for (var i = 0; i < _nodes.length; i++) {
|
||||||
_nodes[i].scramble();
|
_nodes[i].scramble();
|
||||||
}
|
}
|
||||||
// setTimeout(stopScrambling, 2000);
|
// setTimeout(stopScrambling, 2000);
|
||||||
// stopScrambling();
|
// stopScrambling();
|
||||||
};
|
};
|
||||||
// function stopScrambling(){
|
|
||||||
// for (var i = 0; i < _nodes.length; i++) {
|
|
||||||
// setTimeout(function(n){
|
|
||||||
// n.stopScrambling();
|
|
||||||
// }.bind(this, _nodes[i]), 1000 + Math.random()*4000);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
function closeAllEntries(){
|
function closeAllEntries(){
|
||||||
_$entrees_block_termlinks.each(function(index, el) {
|
_$entrees_block_termlinks.each(function(index, el) {
|
||||||
if($(this).parents('li').is('.opened')){
|
if($(this).parents('li').is('.opened')){
|
||||||
@@ -821,7 +814,7 @@
|
|||||||
closeNode();
|
closeNode();
|
||||||
})
|
})
|
||||||
.on('open-entree', function(e){
|
.on('open-entree', function(e){
|
||||||
openEntree(e.tid);
|
toggleEntree(e.tid);
|
||||||
})
|
})
|
||||||
.on('close-all-entree', function(e){
|
.on('close-all-entree', function(e){
|
||||||
closeAllEntries();
|
closeAllEntries();
|
||||||
@@ -830,7 +823,7 @@
|
|||||||
_$entrees_block_termlinks.on('click', function(event) {
|
_$entrees_block_termlinks.on('click', function(event) {
|
||||||
// console.log('_$entrees_block_termlinks click', this);
|
// console.log('_$entrees_block_termlinks click', this);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
openEntree($(this).attr('tid'), true);
|
toggleEntree($(this).attr('tid'), true);
|
||||||
// var $link = $(this);
|
// var $link = $(this);
|
||||||
// var tid = $link.attr('tid');
|
// var tid = $link.attr('tid');
|
||||||
// var $li = $link.parents('li');
|
// var $li = $link.parents('li');
|
||||||
@@ -839,7 +832,7 @@
|
|||||||
// if(!$li.is('.opened')){
|
// if(!$li.is('.opened')){
|
||||||
// _$entrees_block_termlinks.parents('li').removeClass('opened');
|
// _$entrees_block_termlinks.parents('li').removeClass('opened');
|
||||||
// $li.addClass('opened');
|
// $li.addClass('opened');
|
||||||
// openEntree(tid);
|
// toggleEntree(tid);
|
||||||
// _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
// _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
||||||
// }else{
|
// }else{
|
||||||
// $li.removeClass('opened');
|
// $li.removeClass('opened');
|
||||||
|
|||||||
@@ -616,9 +616,7 @@
|
|||||||
// | __|_ _| |_ _ _ ___ ___ ___
|
// | __|_ _| |_ _ _ ___ ___ ___
|
||||||
// | _|| ' \ _| '_/ -_) -_|_-<
|
// | _|| ' \ _| '_/ -_) -_|_-<
|
||||||
// |___|_||_\__|_| \___\___/__/
|
// |___|_||_\__|_| \___\___/__/
|
||||||
// TODO : this functionn is not clear as it should be called toggleEntry
|
function toggleEntree(tid, bubbling){
|
||||||
function openEntree(tid, bubbling){
|
|
||||||
//var $link = $('a.term-link[tid="'+tid+'"]');
|
|
||||||
var $link = _$entrees_block_termlinks.filter('[tid="'+tid+'"]');
|
var $link = _$entrees_block_termlinks.filter('[tid="'+tid+'"]');
|
||||||
var $li = $link.parents('li');
|
var $li = $link.parents('li');
|
||||||
var sys_path = $link.attr('data-drupal-link-system-path');
|
var sys_path = $link.attr('data-drupal-link-system-path');
|
||||||
@@ -630,6 +628,7 @@
|
|||||||
if(bubbling){
|
if(bubbling){
|
||||||
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
||||||
}
|
}
|
||||||
|
// bubbling is true only when event is a real click on entree link
|
||||||
}else if(bubbling){
|
}else if(bubbling){
|
||||||
$li.removeClass('opened');
|
$li.removeClass('opened');
|
||||||
scrambleCollection();
|
scrambleCollection();
|
||||||
@@ -696,20 +695,14 @@
|
|||||||
// |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
|
// |___/\__|_| \__,_|_|_|_|_.__/_|_|_||_\__, |
|
||||||
// |___/
|
// |___/
|
||||||
function scrambleCollection(){
|
function scrambleCollection(){
|
||||||
console.log('scrambleCollection');
|
// console.log('scrambleCollection');
|
||||||
for (var i = 0; i < _nodes.length; i++) {
|
for (var i = 0; i < _nodes.length; i++) {
|
||||||
_nodes[i].scramble();
|
_nodes[i].scramble();
|
||||||
}
|
}
|
||||||
// setTimeout(stopScrambling, 2000);
|
// setTimeout(stopScrambling, 2000);
|
||||||
// stopScrambling();
|
// stopScrambling();
|
||||||
};
|
};
|
||||||
// function stopScrambling(){
|
|
||||||
// for (var i = 0; i < _nodes.length; i++) {
|
|
||||||
// setTimeout(function(n){
|
|
||||||
// n.stopScrambling();
|
|
||||||
// }.bind(this, _nodes[i]), 1000 + Math.random()*4000);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
function closeAllEntries(){
|
function closeAllEntries(){
|
||||||
_$entrees_block_termlinks.each(function(index, el) {
|
_$entrees_block_termlinks.each(function(index, el) {
|
||||||
if($(this).parents('li').is('.opened')){
|
if($(this).parents('li').is('.opened')){
|
||||||
@@ -821,7 +814,7 @@
|
|||||||
closeNode();
|
closeNode();
|
||||||
})
|
})
|
||||||
.on('open-entree', function(e){
|
.on('open-entree', function(e){
|
||||||
openEntree(e.tid);
|
toggleEntree(e.tid);
|
||||||
})
|
})
|
||||||
.on('close-all-entree', function(e){
|
.on('close-all-entree', function(e){
|
||||||
closeAllEntries();
|
closeAllEntries();
|
||||||
@@ -830,7 +823,7 @@
|
|||||||
_$entrees_block_termlinks.on('click', function(event) {
|
_$entrees_block_termlinks.on('click', function(event) {
|
||||||
// console.log('_$entrees_block_termlinks click', this);
|
// console.log('_$entrees_block_termlinks click', this);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
openEntree($(this).attr('tid'), true);
|
toggleEntree($(this).attr('tid'), true);
|
||||||
// var $link = $(this);
|
// var $link = $(this);
|
||||||
// var tid = $link.attr('tid');
|
// var tid = $link.attr('tid');
|
||||||
// var $li = $link.parents('li');
|
// var $li = $link.parents('li');
|
||||||
@@ -839,7 +832,7 @@
|
|||||||
// if(!$li.is('.opened')){
|
// if(!$li.is('.opened')){
|
||||||
// _$entrees_block_termlinks.parents('li').removeClass('opened');
|
// _$entrees_block_termlinks.parents('li').removeClass('opened');
|
||||||
// $li.addClass('opened');
|
// $li.addClass('opened');
|
||||||
// openEntree(tid);
|
// toggleEntree(tid);
|
||||||
// _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
// _$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
||||||
// }else{
|
// }else{
|
||||||
// $li.removeClass('opened');
|
// $li.removeClass('opened');
|
||||||
|
|||||||
@@ -348,7 +348,7 @@
|
|||||||
function onHistoryPopState(e){
|
function onHistoryPopState(e){
|
||||||
console.log('onPopState',e.state);
|
console.log('onPopState',e.state);
|
||||||
if(e.state.home){
|
if(e.state.home){
|
||||||
backToFrontPage();
|
backToFrontPage(true);
|
||||||
}else{
|
}else{
|
||||||
if(e.state.entree_tid){
|
if(e.state.entree_tid){
|
||||||
openEntree(e.state.entree_tid);
|
openEntree(e.state.entree_tid);
|
||||||
@@ -369,7 +369,8 @@
|
|||||||
function initAjaxLinks(){
|
function initAjaxLinks(){
|
||||||
// console.log('initAjaxLinks');
|
// console.log('initAjaxLinks');
|
||||||
|
|
||||||
$('a', '#block-mainnavigation')
|
$('a.site-name', '#block-edlptheme-branding')
|
||||||
|
.add('a', '#block-mainnavigation')
|
||||||
.add('a', '#block-footer.menu--footer')
|
.add('a', '#block-footer.menu--footer')
|
||||||
.add('a', '#block-productions')
|
.add('a', '#block-productions')
|
||||||
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
|
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
|
||||||
@@ -1070,13 +1071,16 @@
|
|||||||
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
||||||
// |_||_| \___/_||_\__|_| \__,_\__, \___|
|
// |_||_| \___/_||_\__|_| \__,_\__, \___|
|
||||||
// |___/
|
// |___/
|
||||||
function backToFrontPage(){
|
function backToFrontPage(pop_state){
|
||||||
closeAllModals();
|
closeAllModals();
|
||||||
// assume we are going back to front page
|
// assume we are going back to front page
|
||||||
$('body').removeClass().addClass('path-frontpage');
|
$('body').removeClass().addClass('path-frontpage');
|
||||||
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
|
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
|
||||||
// close entrees
|
// close entrees
|
||||||
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
||||||
|
if(!pop_state){
|
||||||
|
history.pushState({home:true}, null, window.location.origin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initHome(){
|
function initHome(){
|
||||||
|
|||||||
@@ -348,7 +348,7 @@
|
|||||||
function onHistoryPopState(e){
|
function onHistoryPopState(e){
|
||||||
console.log('onPopState',e.state);
|
console.log('onPopState',e.state);
|
||||||
if(e.state.home){
|
if(e.state.home){
|
||||||
backToFrontPage();
|
backToFrontPage(true);
|
||||||
}else{
|
}else{
|
||||||
if(e.state.entree_tid){
|
if(e.state.entree_tid){
|
||||||
openEntree(e.state.entree_tid);
|
openEntree(e.state.entree_tid);
|
||||||
@@ -369,7 +369,8 @@
|
|||||||
function initAjaxLinks(){
|
function initAjaxLinks(){
|
||||||
// console.log('initAjaxLinks');
|
// console.log('initAjaxLinks');
|
||||||
|
|
||||||
$('a', '#block-mainnavigation')
|
$('a.site-name', '#block-edlptheme-branding')
|
||||||
|
.add('a', '#block-mainnavigation')
|
||||||
.add('a', '#block-footer.menu--footer')
|
.add('a', '#block-footer.menu--footer')
|
||||||
.add('a', '#block-productions')
|
.add('a', '#block-productions')
|
||||||
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
|
.add('a', 'article.node:not(.node--type-enregistrement) h2.node-title')
|
||||||
@@ -1070,13 +1071,16 @@
|
|||||||
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
// | _| '_/ _ \ ' \ _| _/ _` / _` / -_)
|
||||||
// |_||_| \___/_||_\__|_| \__,_\__, \___|
|
// |_||_| \___/_||_\__|_| \__,_\__, \___|
|
||||||
// |___/
|
// |___/
|
||||||
function backToFrontPage(){
|
function backToFrontPage(pop_state){
|
||||||
closeAllModals();
|
closeAllModals();
|
||||||
// assume we are going back to front page
|
// assume we are going back to front page
|
||||||
$('body').removeClass().addClass('path-frontpage');
|
$('body').removeClass().addClass('path-frontpage');
|
||||||
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
|
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
|
||||||
// close entrees
|
// close entrees
|
||||||
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
_$corpus_canvas.trigger({'type':'close-all-entree'});
|
||||||
|
if(!pop_state){
|
||||||
|
history.pushState({home:true}, null, window.location.origin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initHome(){
|
function initHome(){
|
||||||
|
|||||||
+2
-2
@@ -17,12 +17,12 @@
|
|||||||
{% if site_logo or site_name %}
|
{% if site_logo or site_name %}
|
||||||
<h1>
|
<h1>
|
||||||
{% if site_logo %}
|
{% if site_logo %}
|
||||||
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo">
|
<a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo" data-drupal-link-system-path="<front>">
|
||||||
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
|
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if site_name %}
|
{% if site_name %}
|
||||||
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
|
<a class="site-name" href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" data-drupal-link-system-path="<front>">{{ site_name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user