| author | veltr |
| Wed, 18 Apr 2012 18:58:44 +0200 | |
| branch | new-model |
| changeset 870 | 2c025db10a10 |
| parent 842 | 4ae2247a59f4 |
| child 874 | 38b65761a7d5 |
| permissions | -rw-r--r-- |
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
1 |
/* Internationalization for this widget */ |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
2 |
|
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
3 |
IriSP.i18n.addMessages( |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
4 |
{ |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
5 |
"en": { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
6 |
"play_pause": "Play/Pause", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
7 |
"mute_unmute": "Mute/Unmute", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
8 |
"play": "Play", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
9 |
"pause": "Pause", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
10 |
"mute": "Mute", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
11 |
"unmute": "Unmute", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
12 |
"annotate": "Annotate", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
13 |
"search": "Search", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
14 |
"elapsed_time": "Elapsed time", |
| 839 | 15 |
"total_time": "Total time", |
16 |
"volume": "Volume", |
|
17 |
"volume_control": "Volume control" |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
18 |
}, |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
19 |
"fr": { |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
20 |
"play_pause": "Lecture/Pause", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
21 |
"mute_unmute": "Couper/Activer le son", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
22 |
"play": "Lecture", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
23 |
"pause": "Pause", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
24 |
"mute": "Couper le son", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
25 |
"unmute": "Activer le son", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
26 |
"annotate": "Annoter", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
27 |
"search": "Rechercher", |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
28 |
"elapsed_time": "Durée écoulée", |
| 839 | 29 |
"total_time": "Durée totale", |
30 |
"volume": "Niveau sonore", |
|
31 |
"volume_control": "Réglage du niveau sonore" |
|
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
32 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
33 |
} |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
34 |
); |
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
35 |
|
|
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
36 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
37 |
IriSP.PlayerWidget = function(player, config) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
38 |
IriSP.Widget.call(this, player, config); |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
39 |
|
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
40 |
this._searchLastValue = ""; |
| 109 | 41 |
}; |
| 115 | 42 |
|
43 |
IriSP.PlayerWidget.prototype = new IriSP.Widget(); |
|
44 |
||
| 98 | 45 |
IriSP.PlayerWidget.prototype.draw = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
46 |
var _this = this, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
47 |
_html = IriSP.templToHTML(IriSP.player_template, this); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
48 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
49 |
this.$.append(_html); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
50 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
51 |
// Define blocks |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
52 |
this.$playButton = this.$.find(".Ldt-CtrlPlay"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
53 |
this.$searchBlock = this.$.find(".LdtSearch"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
54 |
this.$searchInput = this.$.find(".LdtSearchInput"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
55 |
this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar"); |
| 153 | 56 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
57 |
// handle events |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
58 |
this.bindPopcorn("play","playButtonUpdater"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
59 |
this.bindPopcorn("pause","playButtonUpdater"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
60 |
this.bindPopcorn("volumechange","volumeUpdater"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
61 |
this.bindPopcorn("timeupdate","timeDisplayUpdater"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
62 |
this.bindPopcorn("loadedmetadata","timeDisplayUpdater"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
63 |
this.bindPopcorn("IriSP.search.matchFound","searchMatch"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
64 |
this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
65 |
this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
66 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
67 |
// handle clicks |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
68 |
this.$playButton.click(this.functionWrapper("playHandler")); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
69 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
70 |
this.$.find(".Ldt-CtrlAnnotate").click(function() { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
71 |
_this.player.popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
72 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
73 |
this.$.find(".Ldt-CtrlSearch").click(this.functionWrapper("searchButtonHandler")); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
74 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
75 |
this.$searchInput.keyup(this.functionWrapper("searchHandler") ); |
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
76 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
77 |
var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
78 |
this.$.find('.Ldt-CtrlSound') |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
79 |
.click(this.functionWrapper("muteHandler")) |
| 839 | 80 |
.mouseover(function() { |
81 |
_volctrl.show(); |
|
82 |
}) |
|
83 |
.mouseout(function() { |
|
84 |
_volctrl.hide(); |
|
85 |
}); |
|
86 |
_volctrl.mouseover(function() { |
|
87 |
_volctrl.show(); |
|
88 |
}).mouseout(function() { |
|
89 |
_volctrl.hide(); |
|
90 |
}); |
|
|
250
41683e7cb17a
updated the playerWidget to use classes instead of id's in its elements.
hamidouk
parents:
226
diff
changeset
|
91 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
92 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
93 |
// Allow Volume Cursor Dragging |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
94 |
this.$volumeBar.slider({ |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
95 |
slide: function(event, ui) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
96 |
_this.$volumeBar.attr("title",IriSP.i18n.getMessage('volume')+': ' + ui.value + '%'); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
97 |
_this.player.popcorn.volume(ui.value / 100); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
98 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
99 |
stop: this.functionWrapper("volumeUpdater") |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
100 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
101 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
102 |
// trigger an IriSP.PlayerWidget.MouseOver to the widgets that are interested (i.e : sliderWidget) |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
103 |
this.$.hover( |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
104 |
function() { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
105 |
_this.player.popcorn.trigger("IriSP.PlayerWidget.MouseOver"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
106 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
107 |
function() { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
108 |
_this.player.popcorn.trigger("IriSP.PlayerWidget.MouseOut"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
109 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
110 |
setTimeout(this.functionWrapper("volumeUpdater"), 1000); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
111 |
/* some players - including jwplayer - 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
|
112 |
}; |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
113 |
|
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
114 |
/* Update the elasped time div */ |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
115 |
IriSP.PlayerWidget.prototype.timeDisplayUpdater = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
116 |
var _curTime = this.player.popcorn.roundTime(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
117 |
if (typeof this._previousSecond !== "undefined" && _curTime === this._previousSecond) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
118 |
return; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
119 |
} |
| 98 | 120 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
121 |
// we get it at each call because it may change. |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
122 |
var _totalTime = this.source.getDuration(), |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
123 |
_elapsedTime = new IriSP.Model.Time(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
124 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
125 |
_elapsedTime.setSeconds(_curTime); |
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
126 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
127 |
this.$.find(".Ldt-ElapsedTime").html(_elapsedTime.toString()); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
128 |
this.$.find(".Ldt-TotalTime").html(_totalTime.toString()); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
129 |
this._previousSecond = _curTime; |
| 98 | 130 |
}; |
131 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
132 |
/* 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
|
133 |
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
|
134 |
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
|
135 |
*/ |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
136 |
IriSP.PlayerWidget.prototype.playButtonUpdater = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
137 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
138 |
var status = this.player.popcorn.media.paused; |
| 98 | 139 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
140 |
if (status) { |
|
802
c74de6ba5d11
fixed player buttons. They now use css class instead of directly refering to the
hamidouk
parents:
732
diff
changeset
|
141 |
/* the background sprite is changed by adding/removing the correct classes */ |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
142 |
this.$playButton |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
143 |
.attr("title", IriSP.i18n.getMessage('play')) |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
144 |
.removeClass("Ldt-CtrlPlay-PauseState") |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
145 |
.addClass("Ldt-CtrlPlay-PlayState"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
146 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
147 |
this.$playButton |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
148 |
.attr("title", IriSP.i18n.getMessage('pause')) |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
149 |
.removeClass("Ldt-CtrlPlay-PlayState") |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
150 |
.addClass("Ldt-CtrlPlay-PauseState"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
151 |
} |
| 98 | 152 |
}; |
153 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
154 |
|
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
155 |
IriSP.PlayerWidget.prototype.playHandler = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
156 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
157 |
var status = this.player.popcorn.media.paused; |
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
158 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
159 |
if (status) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
160 |
this.player.popcorn.play(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
161 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
162 |
this.player.popcorn.pause(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
163 |
} |
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
164 |
}; |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
165 |
|
| 98 | 166 |
IriSP.PlayerWidget.prototype.muteHandler = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
167 |
this.player.popcorn.mute(!this.player.popcorn.muted()); |
| 98 | 168 |
}; |
169 |
||
| 839 | 170 |
IriSP.PlayerWidget.prototype.volumeUpdater = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
171 |
var _muted = this.player.popcorn.muted(), |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
172 |
_vol = this.player.popcorn.volume(); |
| 839 | 173 |
if (_vol === false) { |
174 |
_vol = .5; |
|
175 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
176 |
var _soundCtl = this.$.find(".Ldt-CtrlSound"); |
| 839 | 177 |
_soundCtl.removeClass("Ldt-CtrlSound-Mute Ldt-CtrlSound-Half Ldt-CtrlSound-Full"); |
178 |
if (_muted) { |
|
179 |
_soundCtl.attr("title", IriSP.i18n.getMessage('unmute')) |
|
180 |
.addClass("Ldt-CtrlSound-Mute"); |
|
181 |
} else { |
|
182 |
_soundCtl.attr("title", IriSP.i18n.getMessage('mute')) |
|
183 |
.addClass(_vol < .5 ? "Ldt-CtrlSound-Half" : "Ldt-CtrlSound-Full" ) |
|
184 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
185 |
this.$volumeBar.slider("value", _muted ? 0 : 100 * _vol); |
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
186 |
}; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
187 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
188 |
IriSP.PlayerWidget.prototype.showSearchBlock = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
189 |
this.$searchBlock.show("blind", { direction: "horizontal"}, 100); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
190 |
this.$searchInput.css('background-color','#fff'); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
191 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
192 |
this.$searchInput.focus(); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
193 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
194 |
// we need this variable because some widgets can find a match in |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
195 |
// their data while at the same time others don't. As we want the |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
196 |
// search field to become green when there's a match, we need a |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
197 |
// variable to remember that we had one. |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
198 |
this._positiveMatch = false; |
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
199 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
200 |
// tell the world the field is open |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
201 |
this.player.popcorn.trigger("IriSP.search.open"); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
202 |
}; |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
203 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
204 |
IriSP.PlayerWidget.prototype.hideSearchBlock = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
205 |
this._searchLastValue = this.$searchInput.val(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
206 |
this.$searchInput.val(''); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
207 |
this.$searchBlock.hide("blind", { direction: "horizontal"}, 75); |
| 398 | 208 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
209 |
this._positiveMatch = false; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
210 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
211 |
this.player.popcorn.trigger("IriSP.search.closed"); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
212 |
}; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
213 |
|
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
214 |
/** react to clicks on the search button */ |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
215 |
IriSP.PlayerWidget.prototype.searchButtonHandler = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
216 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
217 |
if ( this.$searchBlock.is(":hidden") ) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
218 |
this.showSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
219 |
this.$searchInput.val(this._searchLastValue); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
220 |
this.player.popcorn.trigger("IriSP.search", this._searchLastValue); // trigger the search to make it more natural. |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
221 |
} else { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
222 |
this.hideSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
223 |
} |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
224 |
}; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
225 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
226 |
/** this handler is called whenever the content of the search |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
227 |
field changes */ |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
228 |
IriSP.PlayerWidget.prototype.searchHandler = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
229 |
this._searchLastValue = this.$searchInput.val(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
230 |
this._positiveMatch = false; |
|
154
6e115a094858
another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents:
153
diff
changeset
|
231 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
232 |
// do nothing if the search field is empty, instead of highlighting everything. |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
233 |
if (this._searchLastValue == "") { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
234 |
this.player.popcorn.trigger("IriSP.search.cleared"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
235 |
this.$searchInput.css('background-color',''); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
236 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
237 |
this.player.popcorn.trigger("IriSP.search", this._searchLastValue); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
238 |
} |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
239 |
}; |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
240 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
241 |
/** |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
242 |
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
|
243 |
highlight a match. |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
244 |
*/ |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
245 |
IriSP.PlayerWidget.prototype.searchMatch = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
246 |
this._positiveMatch = true; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
247 |
this.$searchInput.css('background-color','#e1ffe1'); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
248 |
}; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
249 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
250 |
/** the same, except that no value could be found */ |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
251 |
IriSP.PlayerWidget.prototype.searchNoMatch = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
252 |
if (this._positiveMatch !== true) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
253 |
this.$searchInput.css('background-color', "#d62e3a"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
254 |
} |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
255 |
}; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
256 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
257 |
/** react to an IriSP.Player.triggeredSearch - that is, when |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
258 |
a widget ask the PlayerWidget to do a search on his behalf */ |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
259 |
IriSP.PlayerWidget.prototype.triggeredSearch = function(searchString) { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
260 |
this.showSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
261 |
this.$searchInput.attr('value', searchString); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
262 |
this.player.popcorn.trigger("IriSP.search", searchString); // trigger the search to make it more natural. |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
263 |
}; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
264 |
|
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
265 |