Browse Source

articles filter now center the nodes (instead of fading others)

Bachir Soussi Chiadmi 7 years ago
parent
commit
03ab172f42

File diff suppressed because it is too large
+ 3 - 3
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js


+ 24 - 4
sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js

@@ -932,9 +932,23 @@
     function activateArticlesFilter(){
       //console.log('activateArticlesFilter');
       _articles_filter_on = true;
+      // OPTION 1 : just fade no article nodes
+      // for (var i = 0; i < _no_articles_nodes.length; i++) {
+      //   _no_articles_nodes[i].fade();
+      // }
+
+      // OPTION 2 : center the articles nodes and aside others
+      closeAllEntries();
+      _nodes_centered = [];
+      for (var i = 0; i < _articles_nodes.length; i++) {
+        _articles_nodes[i].setCentered();
+        // record centered nodes for inter node repulsions
+        _nodes_centered.push(_articles_nodes[i]);
+      }
       for (var i = 0; i < _no_articles_nodes.length; i++) {
-        _no_articles_nodes[i].fade();
+        _no_articles_nodes[i].setAside();
       }
+
       updateRandomPlaylist(_articles_nodes);
       if(typeof _paq !== 'undefined'){
         // trackEvent(category, action, [name], [value])
@@ -944,9 +958,15 @@
     function deactivateArticlesFilter(){
       //console.log('deactivateArticlesFilter');
       _articles_filter_on = false;
-      for (var i = 0; i < _no_articles_nodes.length; i++) {
-        _no_articles_nodes[i].unFade();
-      }
+
+      // OPTION 1 : just fade no article nodes
+      // for (var i = 0; i < _no_articles_nodes.length; i++) {
+      //   _no_articles_nodes[i].unFade();
+      // }
+
+      // OPTION 2 : centered / aside
+      scrambleCollection();
+
       updateRandomPlaylist(_playlist);
       if(typeof _paq !== 'undefined'){
         // trackEvent(category, action, [name], [value])

+ 1 - 1
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js

@@ -61,5 +61,5 @@ return this;},deactivate(){this.stop();this.active=false;},onAudioOpenDocument(a
 $this.height(Math.min($this.attr('init-height'),_$row.height()));});};function checkGridBlockVisible(){var $r_h=_$row.height();var $this,pos;$('.grid .col',_$row).each(function(i,e){$this=$(this);pos=$this.position();if(pos.top+$this.height()<=$r_h){$this.removeClass('offfield');}else{$this.addClass('offfield');}});}
 function initSearch(){$('#edit-entries--wrapper legend','#edlp-search-form').on('click',function(){$(this).parent().toggleClass('opened');});};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 backToFrontPage(pop_state){void 0;closeAllModals();$('body').removeClass().addClass('path-frontpage');$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');_$corpus_canvas.trigger({'type':'close-all-entree'});_$corpus_canvas.trigger({'type':'scramble-collection'});if(typeof pop_state=="undefined"||!pop_state){void 0;history.pushState({home:true},null,drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);}}
 function initHome(){addCloseModalBtnToCols();return;void 0;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 closeAllModals(){_$row.html('');_$ajaxLinks.removeClass('is-active');_$body.trigger({'type':'all-modal-closed'});};function checkRowEmpty(){if(!$('.col',_$row).length){if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){if(!_$body.is('.entity-type-node.bundle-page')){backToFrontPage();}else{_$corpus_canvas.trigger({'type':'scramble-collection'});$('a[data-drupal-link-system-path="productions"]','#block-mainnavigation').removeClass('is-active').trigger('click');}}else{$('.entree-content a.is-active').removeClass('is-active');}}};init();}
+function closeAllModals(){_$row.html('');_$ajaxLinks.removeClass('is-active');_$body.trigger({'type':'all-modal-closed'});};function checkRowEmpty(){if(!$('.col',_$row).length){if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){if(!_$body.is('.entity-type-node.bundle-page')){if(!$('a.articles-link').is('.is-active')){backToFrontPage();}}else{_$corpus_canvas.trigger({'type':'scramble-collection'});$('a[data-drupal-link-system-path="productions"]','#block-mainnavigation').removeClass('is-active').trigger('click');}}else{$('.entree-content a.is-active').removeClass('is-active');}}};init();}
 $(document).ready(function($){if(drupalSettings.path.isFront){var edlptheme=new EdlpTheme();}else{$('body').attr('booted','booted');}});})(jQuery,Drupal,drupalSettings);

+ 5 - 1
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -680,6 +680,7 @@
       e.preventDefault();
       var $link = $(this);
 
+      // let the site-name link going through as it will shuffle the map if already active
       if($link.is('.is-active') && !$link.is('.site-name'))
         return false;
 
@@ -1858,7 +1859,10 @@
         if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){
           if(!_$body.is('.entity-type-node.bundle-page')){
             // we weren't on production or entree, so go back to front page
-            backToFrontPage();
+            if(!$('a.articles-link').is('.is-active')){
+              // don't go back to front page if articles filter is on
+              backToFrontPage();
+            }
           }else{
             // if we were on production page just scramble collection in case of map was filtered
             _$corpus_canvas.trigger({'type':'scramble-collection'});

Some files were not shown because too many files changed in this diff