Преглед на файлове

entries stay hightlighted if doc is currently playing

Bachir Soussi Chiadmi преди 7 години
родител
ревизия
2969c2544d
променени са 2 файла, в които са добавени 36 реда и са изтрити 20 реда
  1. 18 10
      sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js
  2. 18 10
      sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js

+ 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};
       // _scrambler_CR.position = {x:_canvas.width+200, y:_canvas.height/2};
     };
     };
 
 
-
     //  _  _         _
     //  _  _         _
     // | \| |___  __| |___ ___
     // | \| |___  __| |___ ___
     // | .` / _ \/ _` / -_|_-<
     // | .` / _ \/ _` / -_|_-<
@@ -404,6 +403,7 @@
 
 
         Node.prototype.open = function(){
         Node.prototype.open = function(){
           this.opened = true;
           this.opened = true;
+          _node_opened_id = this.id;
         };
         };
         Node.prototype.close = function(){
         Node.prototype.close = function(){
           this.opened = false;
           this.opened = false;
@@ -667,12 +667,20 @@
     };
     };
     function highlightEntries(){
     function highlightEntries(){
       _$entrees_block_termlinks.removeClass('highlighted');
       _$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;
       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){
       if(_node_hover_id != -1){
         _canvas.style.cursor = 'pointer';
         _canvas.style.cursor = 'pointer';
-        highlightEntries();
-        // _node_pop_up.visible = true;
       }else{
       }else{
         _canvas.style.cursor = 'auto';
         _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};
       // _scrambler_CR.position = {x:_canvas.width+200, y:_canvas.height/2};
     };
     };
 
 
-
     //  _  _         _
     //  _  _         _
     // | \| |___  __| |___ ___
     // | \| |___  __| |___ ___
     // | .` / _ \/ _` / -_|_-<
     // | .` / _ \/ _` / -_|_-<
@@ -404,6 +403,7 @@
 
 
         Node.prototype.open = function(){
         Node.prototype.open = function(){
           this.opened = true;
           this.opened = true;
+          _node_opened_id = this.id;
         };
         };
         Node.prototype.close = function(){
         Node.prototype.close = function(){
           this.opened = false;
           this.opened = false;
@@ -667,12 +667,20 @@
     };
     };
     function highlightEntries(){
     function highlightEntries(){
       _$entrees_block_termlinks.removeClass('highlighted');
       _$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;
       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){
       if(_node_hover_id != -1){
         _canvas.style.cursor = 'pointer';
         _canvas.style.cursor = 'pointer';
-        highlightEntries();
-        // _node_pop_up.visible = true;
       }else{
       }else{
         _canvas.style.cursor = 'auto';
         _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();
       }
       }
     };
     };