Another Widget Bugfix
authorveltr
Fri, 16 Nov 2012 18:08:48 +0100
changeset 956 295c5613698f
parent 954 d45976cb4ff5
child 957 e3329b0f506c
Another Widget Bugfix
src/ldt/ldt/static/ldt/metadataplayer/Segments.css
src/ldt/ldt/static/ldt/metadataplayer/Segments.js
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.css	Fri Nov 16 17:39:03 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.css	Fri Nov 16 18:08:48 2012 +0100
@@ -6,6 +6,10 @@
     position: absolute; margin-left: -1px; border: 1px solid #ffffff;
 }
 
+.Ldt-Segments-Segment.found {
+    background: #FF00FC !important;
+}
+
 .Ldt-Segments-Position {
     background: #fc00ff;
     position: absolute;
--- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Fri Nov 16 17:39:03 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js	Fri Nov 16 18:08:48 2012 +0100
@@ -29,7 +29,7 @@
     this.onMdpEvent("search.closed", "onSearch");
     this.onMdpEvent("search.cleared", "onSearch");
     this.onMediaEvent("timeupdate", "onTimeupdate");
-    
+    this.searchString = false;
     this.renderTemplate();
     
     var _list = this.getWidgetAnnotations().filter(function(_ann) {
@@ -52,14 +52,6 @@
         return "#" + res;
     }
     
-    function unselect() {
-        _this.tooltip.hide();
-        _this.$segments.each(function() {
-            var _segment = IriSP.jQuery(this);
-            _segment.css("background", _segment.attr("data-medium-color"));
-        });
-    }
-    
     _list.forEach(function(_annotation, _k) {
         var _left = _annotation.begin * _scale,
             _width = ( _annotation.getDuration() ) * _scale,
@@ -113,13 +105,19 @@
                     background: _segment.attr("data-low-color")
                 });
             });
-            _this.tooltip.show( _center, _top, _data.text, _data.color );
             _el.css({
                 background: color,
                 "z-index": ++zindex
             });
+            _this.tooltip.show( _center, _top, _data.text, _data.color );
         });
-        _annotation.on("unselect", unselect);
+        _annotation.on("unselect", function() {
+            _this.tooltip.hide();
+            _this.$segments.each(function() {
+                var _segment = IriSP.jQuery(this);
+                _segment.css("background", _segment.attr("data-medium-color"));
+            });
+        });
     });
     
     this.$.css({
@@ -140,10 +138,10 @@
         this.$segments.each(function() {
             var _el = IriSP.jQuery(this);
             if (_re.test(_el.attr("segment-text"))) {
-                _el.css("background", _el.attr("data-base-color"));
+                _el.addClass("found");
                 _found++;
             } else {
-                _el.css("background", _el.attr("data-low-color"));
+                _el.removeClass("found").css("background", _el.attr("data-low-color"));
             }
         });
         if (_found) {
@@ -152,9 +150,9 @@
             this.player.trigger("search.noMatchFound");
         }
     } else {
-        _this.$segments.each(function() {
+        this.$segments.each(function() {
             var _segment = IriSP.jQuery(this);
-            _segment.css("background", _segment.attr("data-medium-color"));
+            _segment.css("background", _segment.attr("data-medium-color")).removeClass("found");
         });
     }
 }