fixed search field coloring. popcorn-port
authorhamidouk
Tue, 29 Nov 2011 16:35:33 +0100
branchpopcorn-port
changeset 355 d8df77c40676
parent 354 002c314cabbf
child 356 1a84cdc88d9f
fixed search field coloring.
src/js/widgets/playerWidget.js
src/js/widgets/segmentsWidget.js
--- a/src/js/widgets/playerWidget.js	Tue Nov 29 16:35:20 2011 +0100
+++ b/src/js/widgets/playerWidget.js	Tue Nov 29 16:35:33 2011 +0100
@@ -24,6 +24,8 @@
   this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
   this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater));
+  this._Popcorn.listen("IriSP.SegmentsWidget.matchFound", IriSP.wrap(this, this.searchMatch));
+  this._Popcorn.listen("IriSP.SegmentsWidget.noMatchFound", IriSP.wrap(this, this.searchNoMatch));
   
   
   this.selector.find(".Ldt-CtrlPlay").click(function() { self.playHandler.call(self); });
@@ -147,6 +149,7 @@
   // do nothing if the search field is empty, instead of highlighting everything.
   if (this._searchLastValue == "") {
     this._Popcorn.trigger("IriSP.search.cleared");
+    this.selector.find(".LdtSearchInput").css('background-color','');
   } else {
     this._Popcorn.trigger("IriSP.search", this._searchLastValue);
   }
@@ -162,6 +165,6 @@
 
 /* the same, except that no value could be found */
 IriSP.PlayerWidget.prototype.searchNoMatch = function() {
-  this.selector.find(".LdtSearchInput").css('background-color','#e1ffe1');
+  this.selector.find(".LdtSearchInput").css('background-color', "#d62e3a");
 }
 
--- a/src/js/widgets/segmentsWidget.js	Tue Nov 29 16:35:20 2011 +0100
+++ b/src/js/widgets/segmentsWidget.js	Tue Nov 29 16:35:33 2011 +0100
@@ -139,13 +139,19 @@
 
   var matches = this._serializer.searchOccurences(searchString);
 
+  if (IriSP.countProperties(matches) > 0) {
+    this._Popcorn.trigger("IriSP.SegmentsWidget.matchFound");
+  } else {
+    this._Popcorn.trigger("IriSP.SegmentsWidget.noMatchFound");
+  }
+
+  console.log(matches.length, matches);
+
   for (var id in matches) {
     var factor = (0.3 + matches[id] * 0.2) % 1;
     this.selector.find("#"+id).dequeue();
     this.selector.find("#"+id).css('border','1px red');
     this.selector.find("#"+id).animate({opacity:factor}, 200);
-
-    IriSP.jQuery("#LdtSearchInput").css('background-color','#e1ffe1');
   }
 
   // clean up the blocks that were in the previous search