src/js/widgets/playerWidget.js
branchpopcorn-port
changeset 151 dc2ff4c87490
parent 145 b477c9430d36
child 153 43f6de365ed4
equal deleted inserted replaced
150:40cf046b7049 151:dc2ff4c87490
   147     var self = this;
   147     var self = this;
   148 
   148 
   149     /* show the search field if it is not shown */
   149     /* show the search field if it is not shown */
   150   	if ( this._searchBlockOpen == false ) {
   150   	if ( this._searchBlockOpen == false ) {
   151       this.selector.find( ".ui-icon-search" ).css( "background-position", "-144px -112px" );
   151       this.selector.find( ".ui-icon-search" ).css( "background-position", "-144px -112px" );
   152       //__IriSP.jQuery("#LdtSearch").animate({height:26},250);
       
   153       
   152       
   154       this.selector.find("#LdtSearch").show(100);
   153       this.selector.find("#LdtSearch").show(100);
   155       
   154       
   156       this.selector.find("#LdtSearchInput").css('background-color','#fff');
   155       this.selector.find("#LdtSearchInput").css('background-color','#fff');
   157       this.selector.find("#LdtSearchInput").focus();
   156       this.selector.find("#LdtSearchInput").focus();
   158       this.selector.find("#LdtSearchInput").attr('value', this._searchLastValue);
   157       this.selector.find("#LdtSearchInput").attr('value', this._searchLastValue);      
       
   158       this._Popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural.
       
   159       
   159       this._searchBlockOpen = true;           
   160       this._searchBlockOpen = true;           
   160       this.selector.find("#LdtSearchInput").bind('keypress set', null, function() { self.searchHandler.call(self); } );
   161       this.selector.find("#LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } );
       
   162       
       
   163       // tell the world the field is open
       
   164       this._Popcorn.trigger("IriSP.search.open");
   161       
   165       
   162 	} else {
   166 	} else {
   163       this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
   167       this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
   164       this.selector.find("#LdtSearchInput").attr('value','');
   168       this.selector.find("#LdtSearchInput").attr('value','');
   165       //IriSP.SearchClean();
   169       //IriSP.SearchClean();
   168       this.selector.find("#LdtSearch").hide(100);
   172       this.selector.find("#LdtSearch").hide(100);
   169       
   173       
   170       // unbind the watcher event.
   174       // unbind the watcher event.
   171       this.selector.find("#LdtSearchInput").unbind('keypress set');
   175       this.selector.find("#LdtSearchInput").unbind('keypress set');
   172       this._searchBlockOpen = false;
   176       this._searchBlockOpen = false;
       
   177       
       
   178       this._Popcorn.trigger("IriSP.search.closed");
   173   }
   179   }
   174 };
   180 };
   175 
   181 
   176 /* this handler is called whenever the content of the search
   182 /* this handler is called whenever the content of the search
   177    field changes */
   183    field changes */
   178 IriSP.PlayerWidget.prototype.searchHandler = function() {
   184 IriSP.PlayerWidget.prototype.searchHandler = function() {
       
   185 
   179   this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
   186   this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value');
   180   this._Popcorn.trigger("IriSP.search", this._searchLastValue);
   187   this._Popcorn.trigger("IriSP.search", this._searchLastValue);
   181 };
   188 };
       
   189 
       
   190 /*
       
   191   handler for the IriSP.search.found message, which is sent by some views when they
       
   192   highlight a match.
       
   193 */
       
   194 IriSP.PlayerWidget.prototype.searchMatch = function() {
       
   195   this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
       
   196 }
       
   197 
       
   198 /* the same, except that no value could be found */
       
   199 IriSP.PlayerWidget.prototype.searchNoMatch = function() {
       
   200   this.selector.find("#LdtSearchInput").css('background-color','#e1ffe1');
       
   201 }
       
   202