1 IriSP.PlayerWidget = function(Popcorn, config, Serializer) { |
1 IriSP.PlayerWidget = function(Popcorn, config, Serializer) { |
2 IriSP.Widget.call(this, Popcorn, config, Serializer); |
2 IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
3 |
|
4 this._searchBlockOpen = false; |
|
5 this._searchLastValue = ""; |
3 }; |
6 }; |
4 |
7 |
5 IriSP.PlayerWidget.prototype = new IriSP.Widget(); |
8 IriSP.PlayerWidget.prototype = new IriSP.Widget(); |
6 |
9 |
7 IriSP.PlayerWidget.prototype.draw = function() { |
10 IriSP.PlayerWidget.prototype.draw = function() { |
8 var _this = this; |
11 var _this = this; |
9 var width = this.width; |
12 var width = this.width; |
10 var height = this.height; |
13 var height = this.height; |
11 var heightS = this.height-20; |
14 var heightS = this.height-20; |
12 |
15 |
|
16 var searchBox = Mustache.to_html(IriSP.search_template); |
|
17 this.selector.append(searchBox); |
|
18 |
13 if (this._config.mode=="radio") { |
19 if (this._config.mode=="radio") { |
14 |
20 |
15 //IriSP.jQuery( "#"+this._config.container ).before(IriSP.search_template); |
21 //IriSP.jQuery( "#"+this._config.container ).before(IriSP.search_template); |
16 var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template}); |
22 var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template}); |
17 this.selector.append(radioPlayer); |
23 this.selector.append(radioPlayer); |
86 icons: { |
92 icons: { |
87 primary: 'ui-icon-search'//, |
93 primary: 'ui-icon-search'//, |
88 //secondary: 'ui-icon-volume-off' |
94 //secondary: 'ui-icon-volume-off' |
89 }, |
95 }, |
90 text: false |
96 text: false |
91 }).next().button({ |
97 }).click(function() { _this.searchButtonHandler.call(_this); }) |
|
98 .next().button({ |
92 icons: { |
99 icons: { |
93 primary: 'ui-icon-volume-on' |
100 primary: 'ui-icon-volume-on' |
94 }, |
101 }, |
95 text: false |
102 text: false |
96 }).click(function() { _this.muteHandler.call(_this); } ); |
103 }).click(function() { _this.muteHandler.call(_this); } ); |
128 this._Popcorn.mute(false); |
135 this._Popcorn.mute(false); |
129 this.selector.children( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" ); |
136 this.selector.children( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" ); |
130 } |
137 } |
131 }; |
138 }; |
132 |
139 |
|
140 /* updates the slider as time passes */ |
133 IriSP.PlayerWidget.prototype.sliderUpdater = function() { |
141 IriSP.PlayerWidget.prototype.sliderUpdater = function() { |
134 var currentPosition = this._Popcorn.currentTime(); |
142 var currentPosition = this._Popcorn.currentTime(); |
135 this.selector.find( "#slider-range-min" ).slider( "value", currentPosition); |
143 this.selector.find( "#slider-range-min" ).slider( "value", currentPosition); |
136 }; |
144 }; |
137 |
145 |
|
146 IriSP.PlayerWidget.prototype.searchButtonHandler = function() { |
|
147 var self = this; |
|
148 |
|
149 /* show the search field if it is not shown */ |
|
150 if ( this._searchBlockOpen == false ) { |
|
151 this.selector.find( ".ui-icon-search" ).css( "background-position", "-144px -112px" ); |
|
152 //__IriSP.jQuery("#LdtSearch").animate({height:26},250); |
|
153 |
|
154 this.selector.find("#LdtSearch").show(100); |
|
155 |
|
156 this.selector.find("#LdtSearchInput").css('background-color','#fff'); |
|
157 this.selector.find("#LdtSearchInput").focus(); |
|
158 this.selector.find("#LdtSearchInput").attr('value', this._searchLastValue); |
|
159 this._searchBlockOpen = true; |
|
160 this.selector.find("#LdtSearchInput").bind('keypress set', null, function() { self.searchHandler.call(self); } ); |
|
161 |
|
162 } else { |
|
163 this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value'); |
|
164 this.selector.find("#LdtSearchInput").attr('value',''); |
|
165 //IriSP.SearchClean(); |
|
166 this.selector.find(".ui-icon-search").css("background-position","-160px -112px"); |
|
167 //__IriSP.jQuery("#LdtSearch").animate({height:0},250); |
|
168 this.selector.find("#LdtSearch").hide(100); |
|
169 |
|
170 // unbind the watcher event. |
|
171 this.selector.find("#LdtSearchInput").unbind('keypress set'); |
|
172 this._searchBlockOpen = false; |
|
173 } |
|
174 }; |
|
175 |
|
176 /* this handler is called whenever the content of the search |
|
177 field changes */ |
|
178 IriSP.PlayerWidget.prototype.searchHandler = function() { |
|
179 this._searchLastValue = this.selector.find("#LdtSearchInput").attr('value'); |
|
180 this._Popcorn.trigger("IriSP.search", this._searchLastValue); |
|
181 }; |