94 this.bindPopcorn("loadedmetadata","timeDisplayUpdater"); |
94 this.bindPopcorn("loadedmetadata","timeDisplayUpdater"); |
95 this.bindPopcorn("loadedmetadata","volumeUpdater"); |
95 this.bindPopcorn("loadedmetadata","volumeUpdater"); |
96 this.bindPopcorn("IriSP.search.matchFound","searchMatch"); |
96 this.bindPopcorn("IriSP.search.matchFound","searchMatch"); |
97 this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch"); |
97 this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch"); |
98 this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch"); |
98 this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch"); |
|
99 this.bindPopcorn("IriSP.search.cleared","hideSearchBlock"); |
99 |
100 |
100 // handle clicks |
101 // handle clicks |
101 this.$playButton.click(this.functionWrapper("playHandler")); |
102 this.$playButton.click(this.functionWrapper("playHandler")); |
102 |
103 |
103 this.$.find(".Ldt-Ctrl-Annotate").click(function() { |
104 this.$.find(".Ldt-Ctrl-Annotate").click(function() { |
219 } |
220 } |
220 this.$volumeBar.slider("value", _muted ? 0 : 100 * _vol); |
221 this.$volumeBar.slider("value", _muted ? 0 : 100 * _vol); |
221 }; |
222 }; |
222 |
223 |
223 IriSP.Widgets.Controller.prototype.showSearchBlock = function() { |
224 IriSP.Widgets.Controller.prototype.showSearchBlock = function() { |
224 this.$searchBlock.show("blind", { direction: "horizontal"}, 100); |
225 this.$searchBlock.animate({ width:"160px" }, 200); |
225 this.$searchInput.css('background-color','#fff'); |
226 this.$searchInput.css('background-color','#fff'); |
226 |
227 |
227 this.$searchInput.focus(); |
228 this.$searchInput.focus(); |
228 |
229 |
229 // we need this variable because some widgets can find a match in |
230 // we need this variable because some widgets can find a match in |
237 }; |
238 }; |
238 |
239 |
239 IriSP.Widgets.Controller.prototype.hideSearchBlock = function() { |
240 IriSP.Widgets.Controller.prototype.hideSearchBlock = function() { |
240 this._searchLastValue = this.$searchInput.val(); |
241 this._searchLastValue = this.$searchInput.val(); |
241 this.$searchInput.val(''); |
242 this.$searchInput.val(''); |
242 this.$searchBlock.hide("blind", { direction: "horizontal"}, 75); |
243 this.$searchBlock.animate( { width: 0 }, 200); |
243 |
244 |
244 this._positiveMatch = false; |
245 this._positiveMatch = false; |
245 |
246 |
246 this.player.popcorn.trigger("IriSP.search.closed"); |
247 this.player.popcorn.trigger("IriSP.search.closed"); |
247 }; |
248 }; |
248 |
249 |
249 /** react to clicks on the search button */ |
250 /** react to clicks on the search button */ |
250 IriSP.Widgets.Controller.prototype.searchButtonHandler = function() { |
251 IriSP.Widgets.Controller.prototype.searchButtonHandler = function() { |
251 if ( this.$searchBlock.is(":hidden") ) { |
252 if ( !this.$searchBlock.width() ) { |
252 this.showSearchBlock(); |
253 this.showSearchBlock(); |
253 this.$searchInput.val(this._searchLastValue); |
254 this.$searchInput.val(this._searchLastValue); |
254 this.player.popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural. |
255 this.player.popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural. |
255 } else { |
256 } else { |
256 this.hideSearchBlock(); |
257 this.hideSearchBlock(); |
258 }; |
259 }; |
259 |
260 |
260 /** this handler is called whenever the content of the search |
261 /** this handler is called whenever the content of the search |
261 field changes */ |
262 field changes */ |
262 IriSP.Widgets.Controller.prototype.searchHandler = function() { |
263 IriSP.Widgets.Controller.prototype.searchHandler = function() { |
|
264 if ( !this.$searchBlock.width() ) { |
|
265 this.$searchBlock.css({ width:"160px" }); |
|
266 this.$searchInput.css('background-color','#fff'); |
|
267 } |
263 this._searchLastValue = this.$searchInput.val(); |
268 this._searchLastValue = this.$searchInput.val(); |
264 this._positiveMatch = false; |
269 this._positiveMatch = false; |
265 |
270 |
266 // do nothing if the search field is empty, instead of highlighting everything. |
271 // do nothing if the search field is empty, instead of highlighting everything. |
267 if (this._searchLastValue == "") { |
272 if (this._searchLastValue == "") { |