| author | veltr |
| Mon, 17 Sep 2012 00:17:06 +0900 | |
| branch | players-as-widgets |
| changeset 957 | 4da0a5740b6c |
| parent 949 | fb5ac4ca3c69 |
| child 960 | 9a278b9e3b05 |
| 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", |
|
59 |
total_time: "Total time", |
|
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", |
|
72 |
elapsed_time: "Durée écoulée", |
|
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"); |
|
95 |
this.onMdpEvent("search.matchFound","searchMatch"); |
|
96 |
this.onMdpEvent("search.noMatchFound","searchNoMatch"); |
|
97 |
this.onMdpEvent("search.triggeredSearch","triggeredSearch"); |
|
98 |
this.onMdpEvent("search.cleared","hideSearchBlock"); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
99 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
100 |
// handle clicks |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
101 |
this.$playButton.click(this.functionWrapper("playHandler")); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
102 |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
103 |
this.$.find(".Ldt-Ctrl-Annotate").click(function() { |
| 957 | 104 |
_this.player.trigger("CreateAnnotation.toggle"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
105 |
}); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
106 |
this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler")); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
107 |
|
| 949 | 108 |
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
|
109 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
110 |
var _volctrl = this.$.find(".Ldt-Ctrl-Volume-Control"); |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
111 |
this.$.find('.Ldt-Ctrl-Sound') |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
112 |
.click(this.functionWrapper("muteHandler")) |
| 839 | 113 |
.mouseover(function() { |
114 |
_volctrl.show(); |
|
115 |
}) |
|
116 |
.mouseout(function() { |
|
117 |
_volctrl.hide(); |
|
118 |
}); |
|
119 |
_volctrl.mouseover(function() { |
|
120 |
_volctrl.show(); |
|
121 |
}).mouseout(function() { |
|
122 |
_volctrl.hide(); |
|
123 |
}); |
|
| 949 | 124 |
|
125 |
// Handle CTRL-F |
|
126 |
if (!this.disable_ctrl_f) { |
|
127 |
var _fKey = "F".charCodeAt(0), |
|
128 |
_lastCtrlFTime = 0; |
|
129 |
IriSP.jQuery(document).keydown(function(_event) { |
|
130 |
if (_event.keyCode === _fKey && (_event.ctrlKey || _event.metaKey)) { |
|
131 |
var _time = IriSP.jQuery.now(); |
|
132 |
if (_time - _lastCtrlFTime > 2000) { |
|
133 |
_this.searchButtonHandler(); |
|
134 |
} |
|
135 |
_lastCtrlFTime = _time; |
|
136 |
return false; |
|
137 |
} |
|
138 |
}); |
|
139 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
140 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
141 |
// Allow Volume Cursor Dragging |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
142 |
this.$volumeBar.slider({ |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
143 |
slide: function(event, ui) { |
| 880 | 144 |
_this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%'); |
| 957 | 145 |
_this.media.setVolume(ui.value / 100); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
146 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
147 |
stop: this.functionWrapper("volumeUpdater") |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
148 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
149 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
150 |
// 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
|
151 |
this.$.hover( |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
152 |
function() { |
| 957 | 153 |
_this.player.trigger("Player.MouseOver"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
154 |
}, |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
155 |
function() { |
| 957 | 156 |
_this.player.trigger("Player.MouseOut"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
157 |
}); |
| 957 | 158 |
|
159 |
this.timeDisplayUpdater(0); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
160 |
/* some players - including jwplayer - save the state of the mute button between sessions */ |
| 957 | 161 |
//TODO: MOVE TO THE PLAYER/ |
| 919 | 162 |
window.setTimeout(this.functionWrapper("volumeUpdater"), 1000); |
163 |
|
|
|
255
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
164 |
}; |
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
165 |
|
|
af3adcf7cb20
added an elapsed time display to the player widget.
hamidouk
parents:
251
diff
changeset
|
166 |
/* Update the elasped time div */ |
| 957 | 167 |
IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) { |
| 98 | 168 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
169 |
// we get it at each call because it may change. |
| 957 | 170 |
var _totalTime = this.media.duration; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
171 |
|
| 957 | 172 |
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
|
173 |
this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString()); |
| 98 | 174 |
}; |
175 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
176 |
/* 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
|
177 |
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
|
178 |
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
|
179 |
*/ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
180 |
IriSP.Widgets.Controller.prototype.playButtonUpdater = function() { |
| 957 | 181 |
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
|
182 |
/* the background sprite is changed by adding/removing the correct classes */ |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
183 |
this.$playButton |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
184 |
.attr("title", this.l10n.play) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
185 |
.removeClass("Ldt-Ctrl-Play-PauseState") |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
186 |
.addClass("Ldt-Ctrl-Play-PlayState"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
187 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
188 |
this.$playButton |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
189 |
.attr("title", this.l10n.pause) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
190 |
.removeClass("Ldt-Ctrl-Play-PlayState") |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
191 |
.addClass("Ldt-Ctrl-Play-PauseState"); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
192 |
} |
| 98 | 193 |
}; |
194 |
||
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
195 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
196 |
IriSP.Widgets.Controller.prototype.playHandler = function() { |
| 957 | 197 |
if (this.media.getPaused()) { |
198 |
this.media.play(); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
199 |
} else { |
| 957 | 200 |
this.media.pause(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
201 |
} |
|
202
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
202 |
}; |
|
2e0205ee7ca9
patch to respond to update the player widget when the user clicks directly on
hamidouk
parents:
163
diff
changeset
|
203 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
204 |
IriSP.Widgets.Controller.prototype.muteHandler = function() { |
| 957 | 205 |
if (this.media.getMuted()) { |
206 |
this.media.unmute(); |
|
207 |
} else { |
|
208 |
this.media.mute(); |
|
209 |
} |
|
| 98 | 210 |
}; |
211 |
||
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
212 |
IriSP.Widgets.Controller.prototype.volumeUpdater = function() { |
| 957 | 213 |
var _muted = this.media.getMuted(), |
214 |
_vol = this.media.getVolume(); |
|
| 839 | 215 |
if (_vol === false) { |
216 |
_vol = .5; |
|
217 |
} |
|
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
218 |
var _soundCtl = this.$.find(".Ldt-Ctrl-Sound"); |
|
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
219 |
_soundCtl.removeClass("Ldt-Ctrl-Sound-Mute Ldt-Ctrl-Sound-Half Ldt-Ctrl-Sound-Full"); |
| 839 | 220 |
if (_muted) { |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
221 |
_soundCtl.attr("title", this.l10n.unmute) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
222 |
.addClass("Ldt-Ctrl-Sound-Mute"); |
| 839 | 223 |
} else { |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
224 |
_soundCtl.attr("title", this.l10n.mute) |
|
874
38b65761a7d5
TooltipWidget, SliderWidget, corrections in AnnotationList, CSS are now split
veltr
parents:
870
diff
changeset
|
225 |
.addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" ) |
| 839 | 226 |
} |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
227 |
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
|
228 |
}; |
|
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
229 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
230 |
IriSP.Widgets.Controller.prototype.showSearchBlock = function() { |
| 948 | 231 |
this.$searchBlock.animate({ width:"160px" }, 200); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
232 |
this.$searchInput.css('background-color','#fff'); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
233 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
234 |
this.$searchInput.focus(); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
235 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
236 |
// we need this variable because some widgets can find a match in |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
237 |
// 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
|
238 |
// 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
|
239 |
// variable to remember that we had one. |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
240 |
this._positiveMatch = false; |
|
449
6e6b4a54776a
added a function to update the icon when the player is muted.
hamidouk
parents:
446
diff
changeset
|
241 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
242 |
// tell the world the field is open |
| 957 | 243 |
this.player.trigger("search.open"); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
244 |
}; |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
245 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
246 |
IriSP.Widgets.Controller.prototype.hideSearchBlock = function() { |
| 948 | 247 |
this.$searchBlock.animate( { width: 0 }, 200); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
248 |
this._positiveMatch = false; |
| 957 | 249 |
this.player.trigger("search.closed"); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
250 |
}; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
251 |
|
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
252 |
/** react to clicks on the search button */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
253 |
IriSP.Widgets.Controller.prototype.searchButtonHandler = function() { |
| 948 | 254 |
if ( !this.$searchBlock.width() ) { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
255 |
this.showSearchBlock(); |
| 949 | 256 |
var _val = this.$searchInput.val(); |
257 |
if (_val) { |
|
| 957 | 258 |
this.player.trigger("search", _val); // trigger the search to make it more natural. |
| 949 | 259 |
} |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
260 |
} else { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
261 |
this.hideSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
262 |
} |
|
145
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
263 |
}; |
|
b477c9430d36
tests and implementation of the search button for the player.
hamidouk
parents:
131
diff
changeset
|
264 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
265 |
/** 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
|
266 |
field changes */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
267 |
IriSP.Widgets.Controller.prototype.searchHandler = function() { |
| 948 | 268 |
if ( !this.$searchBlock.width() ) { |
269 |
this.$searchBlock.css({ width:"160px" }); |
|
270 |
this.$searchInput.css('background-color','#fff'); |
|
271 |
} |
|
| 949 | 272 |
var _val = this.$searchInput.val(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
273 |
this._positiveMatch = false; |
| 949 | 274 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
275 |
// do nothing if the search field is empty, instead of highlighting everything. |
| 949 | 276 |
if (_val !== this.lastSearchValue) { |
277 |
if (_val) { |
|
| 957 | 278 |
this.player.trigger("search", _val); |
| 949 | 279 |
} else { |
| 957 | 280 |
this.player.trigger("search.cleared"); |
| 949 | 281 |
this.$searchInput.css('background-color',''); |
282 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
283 |
} |
| 949 | 284 |
this.lastSearchValue = _val; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
285 |
}; |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
286 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
287 |
/** |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
288 |
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
|
289 |
highlight a match. |
|
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
290 |
*/ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
291 |
IriSP.Widgets.Controller.prototype.searchMatch = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
292 |
this._positiveMatch = true; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
293 |
this.$searchInput.css('background-color','#e1ffe1'); |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
294 |
}; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
295 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
296 |
/** the same, except that no value could be found */ |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
297 |
IriSP.Widgets.Controller.prototype.searchNoMatch = function() { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
298 |
if (this._positiveMatch !== true) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
299 |
this.$searchInput.css('background-color', "#d62e3a"); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
300 |
} |
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
301 |
}; |
|
151
dc2ff4c87490
some tweaking to make the search function more user-friendly.
hamidouk
parents:
145
diff
changeset
|
302 |
|
|
732
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
303 |
/** react to an IriSP.Player.triggeredSearch - that is, when |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
304 |
a widget ask the.Player to do a search on his behalf */ |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
305 |
IriSP.Widgets.Controller.prototype.triggeredSearch = function(searchString) { |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
306 |
this.showSearchBlock(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
842
diff
changeset
|
307 |
this.$searchInput.attr('value', searchString); |
| 957 | 308 |
this.player.trigger("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
|
309 |
}; |
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
310 |
|
|
823fa16807d4
refactored the code to allow external widget to do searches.
hamidouk
parents:
659
diff
changeset
|
311 |