| author | veltr |
| Thu, 28 Feb 2013 11:42:58 +0100 | |
| changeset 994 | d18d6b9e1078 |
| parent 983 | 97fef7a4b189 |
| child 1013 | 392ddcd212d7 |
| permissions | -rw-r--r-- |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
1 |
/* Displays Play and Pause buttons, Search Button and Form, Volume Control */ |
|
838
03b03865eb9b
Transferred i18n data to widgets, corrected slider bug, added search in annotationslist
veltr
parents:
837
diff
changeset
|
2 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
3 |
IriSP.Widgets.Controller = function(player, config) { |
| 949 | 4 |
IriSP.Widgets.Widget.call(this, player, config); |
5 |
this.lastSearchValue = ""; |
|
| 109 | 6 |
}; |
| 115 | 7 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
8 |
IriSP.Widgets.Controller.prototype = new IriSP.Widgets.Widget(); |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
9 |
|
| 882 | 10 |
IriSP.Widgets.Controller.prototype.defaults = { |
11 |
disable_annotate_btn: false, |
|
| 949 | 12 |
disable_search_btn: false, |
13 |
disable_ctrl_f: false |
|
| 882 | 14 |
} |
| 115 | 15 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
16 |
IriSP.Widgets.Controller.prototype.template = |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
17 |
'<div class="Ldt-Ctrl">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
18 |
+ '<div class="Ldt-Ctrl-Left">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
19 |
+ '<div class="Ldt-Ctrl-button Ldt-Ctrl-Play Ldt-Ctrl-Play-PlayState Ldt-TraceMe" title="{{l10n.play_pause}}"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
20 |
+ '<div class="Ldt-Ctrl-spacer"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
21 |
+ '{{^disable_annotate_btn}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
22 |
+ '<div class="Ldt-Ctrl-button Ldt-Ctrl-Annotate Ldt-TraceMe" title="{{l10n.annotate}}"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
23 |
+ '<div class="Ldt-Ctrl-spacer"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
24 |
+ '{{/disable_annotate_btn}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
25 |
+ '{{^disable_search_btn}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
26 |
+ '<div class="Ldt-Ctrl-button Ldt-Ctrl-SearchBtn Ldt-TraceMe" title="{{l10n.search}}"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
27 |
+ '<div class="Ldt-Ctrl-spacer"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
28 |
+ '{{/disable_search_btn}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
29 |
+ '<div class="Ldt-Ctrl-Search">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
30 |
+ '<input class="Ldt-Ctrl-SearchInput Ldt-TraceMe"></input>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
31 |
+ '</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
32 |
+ '</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
33 |
+ '<div class="Ldt-Ctrl-Right">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
34 |
+ '<div class="Ldt-Ctrl-spacer"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
35 |
+ '<div class="Ldt-Ctrl-Time">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
36 |
+ '<div class="Ldt-Ctrl-Time-Elapsed" title="{{l10n.elapsed_time}}">00:00</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
37 |
+ '<div class="Ldt-Ctrl-Time-Separator">/</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
38 |
+ '<div class="Ldt-Ctrl-Time-Total" title="{{l10n.total_time}}">00:00</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
39 |
+ '</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
40 |
+ '<div class="Ldt-Ctrl-spacer"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
41 |
+ '<div class="Ldt-Ctrl-button Ldt-Ctrl-Sound Ldt-Ctrl-Sound-Full Ldt-TraceMe" title="{{l10n.mute_unmute}}"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
42 |
+ '</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
43 |
+ '<div class="Ldt-Ctrl-Volume-Control" title="{{l10n.volume_control}}">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
44 |
+ '<div class="Ldt-Ctrl-Volume-Bar"></div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
45 |
+ '</div>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
46 |
+ '</div>'; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
47 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
48 |
IriSP.Widgets.Controller.prototype.messages = { |
| 882 | 49 |
en: { |
50 |
play_pause: "Play/Pause", |
|
51 |
mute_unmute: "Mute/Unmute", |
|
52 |
play: "Play", |
|
53 |
pause: "Pause", |
|
54 |
mute: "Mute", |
|
55 |
unmute: "Unmute", |
|
56 |
annotate: "Annotate", |
|
57 |
search: "Search", |
|
58 |
elapsed_time: "Elapsed time", |
|
| 982 | 59 |
total_time: "Total duration", |
| 882 | 60 |
volume: "Volume", |
61 |
volume_control: "Volume control" |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
62 |
}, |
| 882 | 63 |
fr: { |
64 |
play_pause: "Lecture/Pause", |
|
65 |
mute_unmute: "Couper/Activer le son", |
|
66 |
play: "Lecture", |
|
67 |
pause: "Pause", |
|
68 |
mute: "Couper le son", |
|
69 |
unmute: "Activer le son", |
|
70 |
annotate: "Annoter", |
|
71 |
search: "Rechercher", |
|
| 982 | 72 |
elapsed_time: "Temps écoulé", |
| 882 | 73 |
total_time: "Durée totale", |
74 |
volume: "Niveau sonore", |
|
75 |
volume_control: "Réglage du niveau sonore" |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
76 |
} |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
77 |
}; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
78 |
|
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
79 |
IriSP.Widgets.Controller.prototype.draw = function() { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
80 |
var _this = this; |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
81 |
this.renderTemplate(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
82 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
83 |
// Define blocks |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
84 |
this.$playButton = this.$.find(".Ldt-Ctrl-Play"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
85 |
this.$searchBlock = this.$.find(".Ldt-Ctrl-Search"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
86 |
this.$searchInput = this.$.find(".Ldt-Ctrl-SearchInput"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
87 |
this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar"); |
| 153 | 88 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
89 |
// handle events |
| 957 | 90 |
this.onMediaEvent("play","playButtonUpdater"); |
91 |
this.onMediaEvent("pause","playButtonUpdater"); |
|
92 |
this.onMediaEvent("volumechange","volumeUpdater"); |
|
93 |
this.onMediaEvent("timeupdate","timeDisplayUpdater"); |
|
94 |
this.onMediaEvent("loadedmetadata","volumeUpdater"); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
95 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
96 |
// handle clicks |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
97 |
this.$playButton.click(this.functionWrapper("playHandler")); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
98 |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
99 |
this.$.find(".Ldt-Ctrl-Annotate").click(function() { |
| 957 | 100 |
_this.player.trigger("CreateAnnotation.toggle"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
101 |
}); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
102 |
this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler")); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
103 |
|
| 949 | 104 |
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
|
105 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
106 |
var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control"); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
107 |
this.$.find('.Ldt-Ctrl-Sound') |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
108 |
.click(this.functionWrapper("muteHandler")) |
| 839 | 109 |
.mouseover(function() { |
110 |
_volctrl.show(); |
|
111 |
}) |
|
112 |
.mouseout(function() { |
|
113 |
_volctrl.hide(); |
|
114 |
}); |
|
115 |
_volctrl.mouseover(function() { |
|
116 |
_volctrl.show(); |
|
117 |
}).mouseout(function() { |
|
118 |
_volctrl.hide(); |
|
119 |
}); |
|
| 949 | 120 |
|
121 |
// Handle CTRL-F |
|
122 |
if (!this.disable_ctrl_f) { |
|
123 |
var _fKey = "F".charCodeAt(0), |
|
124 |
_lastCtrlFTime = 0; |
|
125 |
IriSP.jQuery(document).keydown(function(_event) { |
|
126 |
if (_event.keyCode === _fKey && (_event.ctrlKey || _event.metaKey)) { |
|
127 |
var _time = IriSP.jQuery.now(); |
|
128 |
if (_time - _lastCtrlFTime > 2000) { |
|
129 |
_this.searchButtonHandler(); |
|
130 |
} |
|
131 |
_lastCtrlFTime = _time; |
|
132 |
return false; |
|
133 |
} |
|
134 |
}); |
|
135 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
136 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
137 |
// Allow Volume Cursor Dragging |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
138 |
this.$volumeBar.slider({ |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
139 |
slide: function(event, ui) { |
| 880 | 140 |
_this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%'); |
| 957 | 141 |
_this.media.setVolume(ui.value / 100); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
142 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
143 |
stop: this.functionWrapper("volumeUpdater") |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
144 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
145 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
146 |
// trigger an IriSP.Player.MouseOver to the widgets that are interested (i.e : sliderWidget) |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
147 |
this.$.hover( |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
148 |
function() { |
| 957 | 149 |
_this.player.trigger("Player.MouseOver"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
150 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
151 |
function() { |
| 957 | 152 |
_this.player.trigger("Player.MouseOut"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
153 |
}); |
| 957 | 154 |
|
| 960 | 155 |
this.timeDisplayUpdater(new IriSP.Model.Time(0)); |
| 983 | 156 |
|
157 |
var annotations = this.source.getAnnotations(); |
|
158 |
annotations.on("search", function(_text) { |
|
159 |
_this.$searchInput.val(_text); |
|
160 |
_this.showSearchBlock(); |
|
161 |
}); |
|
162 |
annotations.on("found", function(_text) { |
|
163 |
_this.$searchInput.css('background-color','#e1ffe1'); |
|
164 |
}); |
|
165 |
annotations.on("not-found", function(_text) { |
|
166 |
_this.$searchInput.css('background-color', "#d62e3a"); |
|
167 |
}); |
|
168 |
annotations.on("search-cleared", function() { |
|
169 |
_this.hideSearchBlock(); |
|
170 |
}); |
|
| 919 | 171 |
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
172 |
}; |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
173 |
|
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
174 |
/* Update the elasped time div */ |
| 957 | 175 |
IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) { |
| 98 | 176 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
177 |
// we get it at each call because it may change. |
| 957 | 178 |
var _totalTime = this.media.duration; |
179 |
this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_time.toString()); |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
180 |
this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString()); |
| 98 | 181 |
}; |
182 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
183 |
/* 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
|
184 |
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
|
185 |
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
|
186 |
*/ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
187 |
IriSP.Widgets.Controller.prototype.playButtonUpdater = function() { |
| 957 | 188 |
if (this.media.getPaused()) { |
|
802
c74de6ba5d11
fixed player buttons. They now use css class instead of directly refering to the
hamidouk
parents:
732
diff
changeset
|
189 |
/* the background sprite is changed by adding/removing the correct classes */ |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
190 |
this.$playButton |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
191 |
.attr("title", this.l10n.play) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
192 |
.removeClass("Ldt-Ctrl-Play-PauseState") |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
193 |
.addClass("Ldt-Ctrl-Play-PlayState"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
194 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
195 |
this.$playButton |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
196 |
.attr("title", this.l10n.pause) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
197 |
.removeClass("Ldt-Ctrl-Play-PlayState") |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
198 |
.addClass("Ldt-Ctrl-Play-PauseState"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
199 |
} |
| 98 | 200 |
}; |
201 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
202 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
203 |
IriSP.Widgets.Controller.prototype.playHandler = function() { |
| 957 | 204 |
if (this.media.getPaused()) { |
205 |
this.media.play(); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
206 |
} else { |
| 957 | 207 |
this.media.pause(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
208 |
} |
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
209 |
}; |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
210 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
211 |
IriSP.Widgets.Controller.prototype.muteHandler = function() { |
| 970 | 212 |
this.media.setMuted(!this.media.getMuted()); |
| 98 | 213 |
}; |
214 |
||
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
215 |
IriSP.Widgets.Controller.prototype.volumeUpdater = function() { |
| 957 | 216 |
var _muted = this.media.getMuted(), |
217 |
_vol = this.media.getVolume(); |
|
| 839 | 218 |
if (_vol === false) { |
219 |
_vol = .5; |
|
220 |
} |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
221 |
var _soundCtl = this.$.find(".Ldt-Ctrl-Sound"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
222 |
_soundCtl.removeClass("Ldt-Ctrl-Sound-Mute Ldt-Ctrl-Sound-Half Ldt-Ctrl-Sound-Full"); |
| 839 | 223 |
if (_muted) { |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
224 |
_soundCtl.attr("title", this.l10n.unmute) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
225 |
.addClass("Ldt-Ctrl-Sound-Mute"); |
| 839 | 226 |
} else { |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
227 |
_soundCtl.attr("title", this.l10n.mute) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
228 |
.addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" ) |
| 839 | 229 |
} |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
230 |
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
|
231 |
}; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
232 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
233 |
IriSP.Widgets.Controller.prototype.showSearchBlock = function() { |
| 948 | 234 |
this.$searchBlock.animate({ width:"160px" }, 200); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
235 |
this.$searchInput.css('background-color','#fff'); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
236 |
this.$searchInput.focus(); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
237 |
}; |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
238 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
239 |
IriSP.Widgets.Controller.prototype.hideSearchBlock = function() { |
| 948 | 240 |
this.$searchBlock.animate( { width: 0 }, 200); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
241 |
}; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
242 |
|
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
243 |
/** react to clicks on the search button */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
244 |
IriSP.Widgets.Controller.prototype.searchButtonHandler = function() { |
| 948 | 245 |
if ( !this.$searchBlock.width() ) { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
246 |
this.showSearchBlock(); |
| 949 | 247 |
var _val = this.$searchInput.val(); |
248 |
if (_val) { |
|
| 983 | 249 |
this.source.getAnnotations().search(_val); |
| 949 | 250 |
} |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
251 |
} else { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
252 |
this.hideSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
253 |
} |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
254 |
}; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
255 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
256 |
/** 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
|
257 |
field changes */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
258 |
IriSP.Widgets.Controller.prototype.searchHandler = function() { |
| 948 | 259 |
if ( !this.$searchBlock.width() ) { |
260 |
this.$searchBlock.css({ width:"160px" }); |
|
261 |
this.$searchInput.css('background-color','#fff'); |
|
262 |
} |
|
| 949 | 263 |
var _val = this.$searchInput.val(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
264 |
this._positiveMatch = false; |
| 949 | 265 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
266 |
// do nothing if the search field is empty, instead of highlighting everything. |
| 949 | 267 |
if (_val !== this.lastSearchValue) { |
268 |
if (_val) { |
|
| 983 | 269 |
this.source.getAnnotations().search(_val); |
| 949 | 270 |
} else { |
| 983 | 271 |
this.source.getAnnotations().trigger("clear-search"); |
| 949 | 272 |
this.$searchInput.css('background-color',''); |
273 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
274 |
} |
| 949 | 275 |
this.lastSearchValue = _val; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
276 |
}; |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
277 |