Przeglądaj źródła

entries stay hightlighted if doc is currently playing

Bachir Soussi Chiadmi 7 lat temu
rodzic
commit
2969c2544d

+ 18 - 10
sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js

@@ -183,7 +183,6 @@
       // _scrambler_CR.position = {x:_canvas.width+200, y:_canvas.height/2};
     };
 
-
     //  _  _         _
     // | \| |___  __| |___ ___
     // | .` / _ \/ _` / -_|_-<
@@ -404,6 +403,7 @@
 
         Node.prototype.open = function(){
           this.opened = true;
+          _node_opened_id = this.id;
         };
         Node.prototype.close = function(){
           this.opened = false;
@@ -667,12 +667,20 @@
     };
     function highlightEntries(){
       _$entrees_block_termlinks.removeClass('highlighted');
+      var id = -1;
+      if(_node_hover_id != -1){
+        id = _node_hover_id;
+      }else if(_node_opened_id != -1){
+        id = _node_opened_id;
+      }
       var entree;
-      for (var i = 0; i < _nodes[_node_hover_id].entrees.length; i++) {
-        entree = _nodes[_node_hover_id].entrees[i];
-        _$entrees_block_termlinks.filter(function(){
-          return $(this).attr('tid') == entree;
-        }).addClass('highlighted');
+      if(id != -1){
+        for (var i = 0; i < _nodes[id].entrees.length; i++) {
+          entree = _nodes[id].entrees[i];
+          _$entrees_block_termlinks.filter(function(){
+            return $(this).attr('tid') == entree;
+          }).addClass('highlighted');
+        }
       }
     };
 
@@ -959,12 +967,12 @@
 
       if(_node_hover_id != -1){
         _canvas.style.cursor = 'pointer';
-        highlightEntries();
-        // _node_pop_up.visible = true;
       }else{
         _canvas.style.cursor = 'auto';
-        _$entrees_block_termlinks.removeClass('highlighted');
-        // _node_pop_up.visible = false;
+      }
+      // check for highlighted entries
+      if(_node_hover_id != -1 || _node_opened_id != -1){
+        highlightEntries();
       }
     };
 

+ 18 - 10
sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js

@@ -183,7 +183,6 @@
       // _scrambler_CR.position = {x:_canvas.width+200, y:_canvas.height/2};
     };
 
-
     //  _  _         _
     // | \| |___  __| |___ ___
     // | .` / _ \/ _` / -_|_-<
@@ -404,6 +403,7 @@
 
         Node.prototype.open = function(){
           this.opened = true;
+          _node_opened_id = this.id;
         };
         Node.prototype.close = function(){
           this.opened = false;
@@ -667,12 +667,20 @@
     };
     function highlightEntries(){
       _$entrees_block_termlinks.removeClass('highlighted');
+      var id = -1;
+      if(_node_hover_id != -1){
+        id = _node_hover_id;
+      }else if(_node_opened_id != -1){
+        id = _node_opened_id;
+      }
       var entree;
-      for (var i = 0; i < _nodes[_node_hover_id].entrees.length; i++) {
-        entree = _nodes[_node_hover_id].entrees[i];
-        _$entrees_block_termlinks.filter(function(){
-          return $(this).attr('tid') == entree;
-        }).addClass('highlighted');
+      if(id != -1){
+        for (var i = 0; i < _nodes[id].entrees.length; i++) {
+          entree = _nodes[id].entrees[i];
+          _$entrees_block_termlinks.filter(function(){
+            return $(this).attr('tid') == entree;
+          }).addClass('highlighted');
+        }
       }
     };
 
@@ -959,12 +967,12 @@
 
       if(_node_hover_id != -1){
         _canvas.style.cursor = 'pointer';
-        highlightEntries();
-        // _node_pop_up.visible = true;
       }else{
         _canvas.style.cursor = 'auto';
-        _$entrees_block_termlinks.removeClass('highlighted');
-        // _node_pop_up.visible = false;
+      }
+      // check for highlighted entries
+      if(_node_hover_id != -1 || _node_opened_id != -1){
+        highlightEntries();
       }
     };