| author | hamidouk |
| Wed, 25 Jan 2012 17:29:42 +0100 | |
| branch | popcorn-port |
| changeset 714 | 9056928c46de |
| parent 659 | 501efe401eea |
| child 732 | 823fa16807d4 |
| permissions | -rw-r--r-- |
| 109 | 1 |
IriSP.PlayerWidget = function(Popcorn, config, Serializer) { |
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
3 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
4 |
this._searchBlockOpen = false; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
5 |
this._searchLastValue = ""; |
| 109 | 6 |
}; |
| 115 | 7 |
|
8 |
IriSP.PlayerWidget.prototype = new IriSP.Widget(); |
|
9 |
||
| 98 | 10 |
IriSP.PlayerWidget.prototype.draw = function() { |
| 153 | 11 |
var self = this; |
| 131 | 12 |
var width = this.width; |
13 |
var height = this.height; |
|
14 |
var heightS = this.height-20; |
|
|
261
7e7a44d82a81
positionned correctly the search box - its position is now calculated in function
hamidouk
parents:
255
diff
changeset
|
15 |
|
| 564 | 16 |
var playerTempl = IriSP.templToHTML(IriSP.player_template, {"share_template" : IriSP.share_template}); |
17 |
this.selector.append(playerTempl); |
|
|
468
651528a4f795
fixed a couple layout bugs that didn't appear in integration testing.
hamidouk
parents:
458
diff
changeset
|
18 |
|
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
19 |
this.selector.children(".Ldt-controler").show(); |
| 153 | 20 |
|
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
21 |
// handle clicks by the user on the video. |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
22 |
this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater)); |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
23 |
this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater)); |
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
24 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
25 |
this._Popcorn.listen("volumechange", IriSP.wrap(this, this.muteButtonUpdater)); |
| 440 | 26 |
|
|
559
04e73ddebfa7
the total media duration now displays itself correctly at startup.
hamidouk
parents:
540
diff
changeset
|
27 |
this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater)); |
|
04e73ddebfa7
the total media duration now displays itself correctly at startup.
hamidouk
parents:
540
diff
changeset
|
28 |
// update the time display for the first time. |
|
04e73ddebfa7
the total media duration now displays itself correctly at startup.
hamidouk
parents:
540
diff
changeset
|
29 |
this._Popcorn.listen("loadedmetadata", IriSP.wrap(this, this.timeDisplayUpdater)); |
|
04e73ddebfa7
the total media duration now displays itself correctly at startup.
hamidouk
parents:
540
diff
changeset
|
30 |
|
| 398 | 31 |
this._Popcorn.listen("IriSP.search.matchFound", IriSP.wrap(this, this.searchMatch)); |
32 |
this._Popcorn.listen("IriSP.search.noMatchFound", IriSP.wrap(this, this.searchNoMatch)); |
|
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
33 |
|
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
34 |
|
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
35 |
this.selector.find(".Ldt-CtrlPlay").click(function() { self.playHandler.call(self); }); |
|
540
b1f3aee23199
send a signal when receiving a click on the Annotate button.
hamidouk
parents:
468
diff
changeset
|
36 |
this.selector.find(".Ldt-CtrlAnnotate").click(function() |
|
b1f3aee23199
send a signal when receiving a click on the Annotate button.
hamidouk
parents:
468
diff
changeset
|
37 |
{ self._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); }); |
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
38 |
this.selector.find(".Ldt-CtrlSearch").click(function() { self.searchButtonHandler.call(self); }); |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
39 |
|
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
40 |
this.selector.find('.Ldt-CtrlSound').click(function() { self.muteHandler.call(self); } ); |
|
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
41 |
|
|
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
42 |
this.selector.find(".Ldt-CtrlPlay").attr( "style", "background-color:#CD21C24;" ); |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
43 |
|
| 564 | 44 |
/* |
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
45 |
var searchButtonPos = this.selector.find(".Ldt-CtrlSearch").position(); |
|
261
7e7a44d82a81
positionned correctly the search box - its position is now calculated in function
hamidouk
parents:
255
diff
changeset
|
46 |
var searchBox = Mustache.to_html(IriSP.search_template, {margin_left : searchButtonPos.left + "px"}); |
| 564 | 47 |
this.selector.find(".Ldt-CtrlSearch").after(searchBox); |
48 |
*/ |
|
|
261
7e7a44d82a81
positionned correctly the search box - its position is now calculated in function
hamidouk
parents:
255
diff
changeset
|
49 |
|
|
331
ef3447aa6920
player widget now sends a special message when the mouse is hovering it.
hamidouk
parents:
311
diff
changeset
|
50 |
// trigger an IriSP.PlayerWidget.MouseOver to the widgets that are interested (i.e : sliderWidget) |
|
ef3447aa6920
player widget now sends a special message when the mouse is hovering it.
hamidouk
parents:
311
diff
changeset
|
51 |
this.selector.hover(function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOver"); }, |
|
ef3447aa6920
player widget now sends a special message when the mouse is hovering it.
hamidouk
parents:
311
diff
changeset
|
52 |
function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOut"); }); |
| 458 | 53 |
|
54 |
this.muteButtonUpdater(); /* some player - jwplayer notable - save the state of the mute button between sessions */ |
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
55 |
}; |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
56 |
|
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
57 |
/* Update the elasped time div */ |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
58 |
IriSP.PlayerWidget.prototype.timeDisplayUpdater = function() { |
| 98 | 59 |
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
60 |
if (this._previousSecond === undefined) |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
61 |
this._previousSecond = this._Popcorn.roundTime(); |
| 98 | 62 |
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
63 |
else { |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
64 |
/* we're still in the same second, so it's not necessary to update time */ |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
65 |
if (this._Popcorn.roundTime() == this._previousSecond) |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
66 |
return; |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
67 |
|
| 98 | 68 |
} |
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
69 |
|
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
70 |
// we get it at each call because it may change. |
| 296 | 71 |
var duration = +this._serializer.currentMedia().meta["dc:duration"] / 1000; |
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
72 |
var totalTime = IriSP.secondsToTime(duration); |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
73 |
var elapsedTime = IriSP.secondsToTime(this._Popcorn.currentTime()); |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
74 |
|
| 338 | 75 |
this.selector.find(".Ldt-ElapsedTime").html(elapsedTime.toString()); |
76 |
this.selector.find(".Ldt-TotalTime").html(totalTime.toString()); |
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
77 |
this._previousSecond = this._Popcorn.roundTime(); |
| 98 | 78 |
}; |
79 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
80 |
/* update the icon of the button - separate function from playHandler |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
81 |
because in some cases (for instance, when the user directly clicks on |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
82 |
the jwplayer window) we have to change the icon without playing/pausing |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
83 |
*/ |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
84 |
IriSP.PlayerWidget.prototype.playButtonUpdater = function() { |
| 98 | 85 |
var status = this._Popcorn.media.paused; |
86 |
|
|
87 |
if ( status == true ){ |
|
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
88 |
this.selector.find(".Ldt-CtrlPlay").attr("title", "Play"); |
| 416 | 89 |
|
90 |
// we use templToHTML because it has some predefined |
|
91 |
// vars like where to get the images |
|
| 440 | 92 |
var templ = IriSP.templToHTML("url({{img_dir}}/play_sprite.png)"); |
| 416 | 93 |
this.selector.find(".Ldt-CtrlPlay").css("background-image", templ); |
94 |
||
| 98 | 95 |
} else { |
|
311
43a1b7d95317
WIP - integrating the various changes samuel requested.
hamidouk
parents:
296
diff
changeset
|
96 |
this.selector.find(".Ldt-CtrlPlay").attr("title", "Pause"); |
| 416 | 97 |
|
98 |
// we use templToHTML because it has some predefined |
|
99 |
// vars like where to get the images |
|
| 440 | 100 |
var templ = IriSP.templToHTML("url({{img_dir}}/pause_sprite.png)"); |
| 416 | 101 |
this.selector.find(".Ldt-CtrlPlay").css("background-image", templ); |
| 98 | 102 |
} |
| 440 | 103 |
|
104 |
return; |
|
| 98 | 105 |
}; |
106 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
107 |
|
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
108 |
IriSP.PlayerWidget.prototype.playHandler = function() { |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
109 |
var status = this._Popcorn.media.paused; |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
110 |
|
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
111 |
if ( status == true ){ |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
112 |
this._Popcorn.play(); |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
113 |
} else { |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
114 |
this._Popcorn.pause(); |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
115 |
} |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
116 |
}; |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
117 |
|
| 98 | 118 |
IriSP.PlayerWidget.prototype.muteHandler = function() { |
119 |
if (!this._Popcorn.muted()) { |
|
120 |
this._Popcorn.mute(true); |
|
121 |
} else { |
|
122 |
this._Popcorn.mute(false); |
|
123 |
} |
|
124 |
}; |
|
125 |
||
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
126 |
IriSP.PlayerWidget.prototype.muteButtonUpdater = function() { |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
127 |
var status = this._Popcorn.media.muted; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
128 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
129 |
if ( status == true ){ |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
130 |
this.selector.find(".Ldt-CtrlSound").attr("title", "Unmute"); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
131 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
132 |
// we use templToHTML because it has some predefined |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
133 |
// vars like where to get the images |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
134 |
var templ = IriSP.templToHTML("url({{img_dir}}/sound_sprite.png)"); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
135 |
this.selector.find(".Ldt-CtrlSound").css("background-image", templ); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
136 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
137 |
} else { |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
138 |
this.selector.find(".Ldt-CtrlSound").attr("title", "Mute"); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
139 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
140 |
// we use templToHTML because it has some predefined |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
141 |
// vars like where to get the images |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
142 |
var templ = IriSP.templToHTML("url({{img_dir}}/mute_sprite.png)"); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
143 |
this.selector.find(".Ldt-CtrlSound").css("background-image", templ); |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
144 |
} |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
145 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
146 |
return; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
147 |
}; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
148 |
|
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
149 |
|
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
150 |
IriSP.PlayerWidget.prototype.searchButtonHandler = function() { |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
151 |
var self = this; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
152 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
153 |
/* show the search field if it is not shown */ |
|
261
7e7a44d82a81
positionned correctly the search box - its position is now calculated in function
hamidouk
parents:
255
diff
changeset
|
154 |
if ( this._searchBlockOpen == false ) { |
| 564 | 155 |
this.selector.find(".LdtSearch").show("blind", { direction: "horizontal"}, 100); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
156 |
|
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
157 |
this.selector.find(".LdtSearchInput").css('background-color','#fff'); |
|
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
158 |
this.selector.find(".LdtSearchInput").attr('value', this._searchLastValue); |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
159 |
this._Popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural. |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
160 |
|
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
161 |
this._searchBlockOpen = true; |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
162 |
this.selector.find(".LdtSearchInput").bind('keyup', null, function() { self.searchHandler.call(self); } ); |
| 654 | 163 |
this.selector.find(".LdtSearchInput").focus(); |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
164 |
|
| 398 | 165 |
// we need this variable because some widget can find a match in |
166 |
// their data while at the same time other's don't. As we want the |
|
167 |
// search field to become green when there's a match, we need a |
|
168 |
// variable to remember that we had one. |
|
169 |
this._positiveMatch = false; |
|
170 |
||
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
171 |
// tell the world the field is open |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
172 |
this._Popcorn.trigger("IriSP.search.open"); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
173 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
174 |
} else { |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
175 |
this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value'); |
|
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
176 |
this.selector.find(".LdtSearchInput").attr('value',''); |
| 564 | 177 |
this.selector.find(".LdtSearch").hide("blind", { direction: "horizontal"}, 75); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
178 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
179 |
// unbind the watcher event. |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
180 |
this.selector.find(".LdtSearchInput").unbind('keypress set'); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
181 |
this._searchBlockOpen = false; |
| 398 | 182 |
|
183 |
this._positiveMatch = false; |
|
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
184 |
|
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
185 |
this._Popcorn.trigger("IriSP.search.closed"); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
186 |
} |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
187 |
}; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
188 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
189 |
/* this handler is called whenever the content of the search |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
190 |
field changes */ |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
191 |
IriSP.PlayerWidget.prototype.searchHandler = function() { |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
192 |
this._searchLastValue = this.selector.find(".LdtSearchInput").attr('value'); |
| 398 | 193 |
this._positiveMatch = false; |
|
154
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
194 |
|
|
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
195 |
// do nothing if the search field is empty, instead of highlighting everything. |
|
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
196 |
if (this._searchLastValue == "") { |
|
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
197 |
this._Popcorn.trigger("IriSP.search.cleared"); |
| 355 | 198 |
this.selector.find(".LdtSearchInput").css('background-color',''); |
|
154
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
199 |
} else { |
|
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
200 |
this._Popcorn.trigger("IriSP.search", this._searchLastValue); |
|
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
201 |
} |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
202 |
}; |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
203 |
|
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
204 |
/* |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
205 |
handler for the IriSP.search.found message, which is sent by some views when they |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
206 |
highlight a match. |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
207 |
*/ |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
208 |
IriSP.PlayerWidget.prototype.searchMatch = function() { |
| 398 | 209 |
this._positiveMatch = true; |
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
210 |
this.selector.find(".LdtSearchInput").css('background-color','#e1ffe1'); |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
211 |
} |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
212 |
|
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
213 |
/* the same, except that no value could be found */ |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
214 |
IriSP.PlayerWidget.prototype.searchNoMatch = function() { |
| 398 | 215 |
if (this._positiveMatch !== true) |
216 |
this.selector.find(".LdtSearchInput").css('background-color', "#d62e3a"); |
|
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
217 |
} |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
218 |