romo-av 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,312 +1,290 @@
1
- $.fn.romoModalVideo = function() {
2
- return $.map(this, function(element) {
3
- return new RomoModalVideo(element);
4
- });
5
- }
1
+ var RomoModalVideo = RomoComponent(function(elem) {
2
+ this.elem = elem;
6
3
 
7
- var RomoModalVideo = function(element) {
8
- this.elem = $(element);
4
+ this.doInit();
5
+ this._bindElem();
9
6
 
10
- this.modal = this.elem.romoModal()[0];
11
- this.doBindModal();
7
+ Romo.trigger(this.elem, 'romoModalVideo:ready', [this]);
8
+ });
12
9
 
13
- this.video = undefined;
14
- this.doBindVideo();
15
- this.elem.on('modal:loadBodySuccess', $.proxy(function(e, data, modal) {
16
- this.doBindVideo();
17
- }, this));
10
+ // private
18
11
 
19
- this.doInit();
20
- this.elem.trigger('modalVideo:ready', [this]);
21
- }
12
+ RomoModalVideo.prototype._bindElem = function() {
13
+ this._bindModal();
14
+ this._bindVideo();
22
15
 
23
- RomoModalVideo.prototype.doInit = function() {
24
- // override as needed
16
+ Romo.on(this.elem, 'romoModal:loadBodySuccess', Romo.proxy(function(e, data, romoModal) {
17
+ this._bindVideo();
18
+ }, this));
25
19
  }
26
20
 
27
- RomoModalVideo.prototype.doBindModal = function() {
28
- if (this.elem.data('romo-modal-clear-content') === undefined) {
29
- this.elem.attr('data-romo-modal-clear-content', 'true');
21
+ RomoModalVideo.prototype._bindModal = function() {
22
+ if (Romo.data(this.elem, 'romo-modal-clear-content') === undefined) {
23
+ Romo.setData(this.elem, 'romo-modal-clear-content', 'true');
30
24
  }
31
25
 
32
- // modal/video interactions
26
+ this.romoModal = new RomoModal(this.elem);
33
27
 
34
- this.elem.on('modalVideo:video:loadedmetadata', $.proxy(function(e, videoObj, video, modalVideo) {
35
- this.modal.doPlacePopupElem();
36
- }, this));
28
+ // modal/video interactions
37
29
 
38
- this.elem.on('modalVideo:video:enterFullscreen', $.proxy(function(e, videoObj, video, modalVideo) {
39
- // wait 1 sec then turn off modal body elem events - since we are in fullscreen
40
- // mode, we don't care about them
41
- setTimeout($.proxy(function() {
42
- this.modal.doUnBindWindowBodyClick();
43
- this.modal.doUnBindWindowBodyKeyUp();
44
- this.modal.doUnBindElemKeyUp();
45
- }, this), 1000);
46
- }, this));
47
- this.elem.on('modalVideo:video:exitFullscreen', $.proxy(function(e, videoObj, video, modalVideo) {
48
- // wait 1 sec then turn on modal body elem events - since we are no longer
49
- // in fullscreen mode, we need to care about them again
50
- setTimeout($.proxy(function() {
51
- this.modal.doBindWindowBodyClick();
52
- this.modal.doBindWindowBodyKeyUp();
53
- this.modal.doBindElemKeyUp();
54
- }, this), 1000);
30
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:loadedmetadata', Romo.proxy(function(e, videoObj, romoVideo, romoModalVideo) {
31
+ this.romoModal.doPlacePopupElem();
55
32
  }, this));
56
33
 
57
34
  // event proxies
58
35
 
59
- this.elem.on('modal:ready', $.proxy(function(e, modal) {
60
- this.elem.trigger('modalVideo:modal:ready', [modal, this]);
36
+ Romo.on(this.elem, 'romoModal:ready', Romo.proxy(function(e, romoModal) {
37
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:ready', [romoModal, this]);
61
38
  }, this));
62
- this.elem.on('modal:toggle', $.proxy(function(e, modal) {
63
- this.elem.trigger('modalVideo:modal:toggle', [modal, this]);
39
+ Romo.on(this.elem, 'romoModal:toggle', Romo.proxy(function(e, romoModal) {
40
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:toggle', [romoModal, this]);
64
41
  }, this));
65
- this.elem.on('modal:popupOpen', $.proxy(function(e, modal) {
66
- this.elem.trigger('modalVideo:modal:popupOpen', [modal, this]);
42
+ Romo.on(this.elem, 'romoModal:popupOpen', Romo.proxy(function(e, romoModal) {
43
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:popupOpen', [romoModal, this]);
67
44
  }, this));
68
- this.elem.on('modal:popupClose', $.proxy(function(e, modal) {
69
- this.elem.trigger('modalVideo:modal:popupClose', [modal, this]);
45
+ Romo.on(this.elem, 'romoModal:popupClose', Romo.proxy(function(e, romoModal) {
46
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:popupClose', [romoModal, this]);
70
47
  }, this));
71
- this.elem.on('modal:dragStart', $.proxy(function(e, modal) {
72
- this.elem.trigger('modalVideo:modal:dragStart', [modal, this]);
48
+ Romo.on(this.elem, 'romoModal:dragStart', Romo.proxy(function(e, romoModal) {
49
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:dragStart', [romoModal, this]);
73
50
  }, this));
74
- this.elem.on('modal:dragMove', $.proxy(function(e, placeX, placeY, modal) {
75
- this.elem.trigger('modalVideo:modal:dragMove', [placeX, placeY, modal, this]);
51
+ Romo.on(this.elem, 'romoModal:dragMove', Romo.proxy(function(e, placeX, placeY, romoModal) {
52
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:dragMove', [placeX, placeY, romoModal, this]);
76
53
  }, this));
77
- this.elem.on('modal:dragStop', $.proxy(function(e, modal) {
78
- this.elem.trigger('modalVideo:modal:dragStop', [modal, this]);
54
+ Romo.on(this.elem, 'romoModal:dragStop', Romo.proxy(function(e, romoModal) {
55
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:dragStop', [romoModal, this]);
79
56
  }, this));
80
- this.elem.on('modal:loadBodyStart', $.proxy(function(e, modal) {
81
- this.elem.trigger('modalVideo:modal:loadBodyStart', [modal, this]);
57
+ Romo.on(this.elem, 'romoModal:loadBodyStart', Romo.proxy(function(e, romoModal) {
58
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:loadBodyStart', [romoModal, this]);
82
59
  }, this));
83
- this.elem.on('modal:loadBodySuccess', $.proxy(function(e, data, modal) {
84
- this.elem.trigger('modalVideo:modal:loadBodySuccess', [data, modal, this]);
60
+ Romo.on(this.elem, 'romoModal:loadBodySuccess', Romo.proxy(function(e, data, romoModal) {
61
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:loadBodySuccess', [data, romoModal, this]);
85
62
  }, this));
86
- this.elem.on('modal:loadBodyError', $.proxy(function(e, xhr, modal) {
87
- this.elem.trigger('modalVideo:modal:loadBodyError', [xhr, modal, this]);
63
+ Romo.on(this.elem, 'romoModal:loadBodyError', Romo.proxy(function(e, xhr, romoModal) {
64
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:loadBodyError', [xhr, romoModal, this]);
88
65
  }, this));
89
- this.elem.on('modal:dismiss', $.proxy(function(e, modal) {
90
- this.elem.trigger('modalVideo:modal:dismiss', [modal, this]);
66
+ Romo.on(this.elem, 'romoModal:dismiss', Romo.proxy(function(e, romoModal) {
67
+ Romo.trigger(this.elem, 'romoModalVideo:romoModal:dismiss', [romoModal, this]);
91
68
  }, this));
92
69
  }
93
70
 
94
- RomoModalVideo.prototype.doBindVideo = function() {
95
- var videoElem = this.modal.popupElem.find('[data-romo-video-auto="modalVideo"]');
71
+ RomoModalVideo.prototype._bindVideo = function() {
72
+ this.romoVideo = undefined;
96
73
 
97
- this._bindVideoElemEvents(videoElem);
98
- this._bindModalVideoTriggerEvents();
74
+ var videoElem = Romo.find(this.romoModal.popupElem, '[data-romo-video-auto="modalVideo"]')[0];
75
+ if (videoElem !== undefined) {
76
+ this._bindVideoElemEvents(videoElem);
77
+ this._bindModalVideoTriggerEvents();
99
78
 
100
- this.video = videoElem.romoVideo()[0];
79
+ this.romoVideo = new RomoVideo(videoElem);
80
+ }
101
81
  }
102
82
 
103
- // private
104
-
105
83
  RomoModalVideo.prototype._bindVideoElemEvents = function(videoElem) {
106
84
  // playback events
107
85
 
108
- videoElem.on('video:play', $.proxy(function(e, videoObj, video) {
109
- this.elem.trigger('modalVideo:video:play', [videoObj, video, this]);
86
+ Romo.on(videoElem, 'romoVideo:play', Romo.proxy(function(e, videoObj, romoVideo) {
87
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:play', [videoObj, romoVideo, this]);
110
88
  }, this));
111
- videoElem.on('video:pause', $.proxy(function(e, videoObj, video) {
112
- this.elem.trigger('modalVideo:video:pause', [videoObj, video, this]);
89
+ Romo.on(videoElem, 'romoVideo:pause', Romo.proxy(function(e, videoObj, romoVideo) {
90
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:pause', [videoObj, romoVideo, this]);
113
91
  }, this));
114
92
 
115
93
  // state events
116
94
 
117
- videoElem.on('video:playing', $.proxy(function(e, videoObj, video) {
118
- this.elem.trigger('modalVideo:video:playing', [videoObj, video, this]);
95
+ Romo.on(videoElem, 'romoVideo:playing', Romo.proxy(function(e, videoObj, romoVideo) {
96
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:playing', [videoObj, romoVideo, this]);
119
97
  }, this));
120
- videoElem.on('video:waiting', $.proxy(function(e, videoObj, video) {
121
- this.elem.trigger('modalVideo:video:waiting', [videoObj, video, this]);
98
+ Romo.on(videoElem, 'romoVideo:waiting', Romo.proxy(function(e, videoObj, romoVideo) {
99
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:waiting', [videoObj, romoVideo, this]);
122
100
  }, this));
123
- videoElem.on('video:ended', $.proxy(function(e, videoObj, video) {
124
- this.elem.trigger('modalVideo:video:ended', [videoObj, video, this]);
101
+ Romo.on(videoElem, 'romoVideo:ended', Romo.proxy(function(e, videoObj, romoVideo) {
102
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:ended', [videoObj, romoVideo, this]);
125
103
  }, this));
126
- videoElem.on('video:emptied', $.proxy(function(e, videoObj, video) {
127
- this.elem.trigger('modalVideo:video:emptied', [videoObj, video, this]);
104
+ Romo.on(videoElem, 'romoVideo:emptied', Romo.proxy(function(e, videoObj, romoVideo) {
105
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:emptied', [videoObj, romoVideo, this]);
128
106
  }, this));
129
- videoElem.on('video:error', $.proxy(function(e, videoObj, video) {
130
- this.elem.trigger('modalVideo:video:error', [videoObj, video, this]);
107
+ Romo.on(videoElem, 'romoVideo:error', Romo.proxy(function(e, videoObj, romoVideo) {
108
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:error', [videoObj, romoVideo, this]);
131
109
  }, this));
132
- videoElem.on('video:stalled', $.proxy(function(e, videoObj, video) {
133
- this.elem.trigger('modalVideo:video:stalled', [videoObj, video, this]);
110
+ Romo.on(videoElem, 'romoVideo:stalled', Romo.proxy(function(e, videoObj, romoVideo) {
111
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:stalled', [videoObj, romoVideo, this]);
134
112
  }, this));
135
- videoElem.on('video:suspend', $.proxy(function(e, videoObj, video) {
136
- this.elem.trigger('modalVideo:video:suspend', [videoObj, video, this]);
113
+ Romo.on(videoElem, 'romoVideo:suspend', Romo.proxy(function(e, videoObj, romoVideo) {
114
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:suspend', [videoObj, romoVideo, this]);
137
115
  }, this));
138
116
 
139
117
  // status events
140
118
 
141
- videoElem.on('video:progress', $.proxy(function(e, videoObj, video) {
142
- this.elem.trigger('modalVideo:video:progress', [videoObj, video, this]);
119
+ Romo.on(videoElem, 'romoVideo:progress', Romo.proxy(function(e, videoObj, romoVideo) {
120
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:progress', [videoObj, romoVideo, this]);
143
121
  }, this));
144
- videoElem.on('video:timeupdate', $.proxy(function(e, videoObj, video) {
145
- this.elem.trigger('modalVideo:video:timeupdate', [videoObj, video, this]);
122
+ Romo.on(videoElem, 'romoVideo:timeupdate', Romo.proxy(function(e, videoObj, romoVideo) {
123
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:timeupdate', [videoObj, romoVideo, this]);
146
124
  }, this));
147
125
 
148
126
  // settings events
149
127
 
150
- videoElem.on('video:volumechange', $.proxy(function(e, videoObj, video) {
151
- this.elem.trigger('modalVideo:video:volumechange', [videoObj, video, this]);
128
+ Romo.on(videoElem, 'romoVideo:volumechange', Romo.proxy(function(e, videoObj, romoVideo) {
129
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:volumechange', [videoObj, romoVideo, this]);
152
130
  }, this));
153
- videoElem.on('video:durationchange', $.proxy(function(e, videoObj, video) {
154
- this.elem.trigger('modalVideo:video:durationchange', [videoObj, video, this]);
131
+ Romo.on(videoElem, 'romoVideo:durationchange', Romo.proxy(function(e, videoObj, romoVideo) {
132
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:durationchange', [videoObj, romoVideo, this]);
155
133
  }, this));
156
- videoElem.on('video:ratechange', $.proxy(function(e, videoObj, video) {
157
- this.elem.trigger('modalVideo:video:ratechange', [videoObj, video, this]);
134
+ Romo.on(videoElem, 'romoVideo:ratechange', Romo.proxy(function(e, videoObj, romoVideo) {
135
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:ratechange', [videoObj, romoVideo, this]);
158
136
  }, this));
159
137
 
160
138
  // fullscreen events
161
139
 
162
- videoElem.on('video:enterFullscreen', $.proxy(function(e, videoObj, video) {
163
- this.elem.trigger('modalVideo:video:enterFullscreen', [videoObj, video, this]);
140
+ Romo.on(videoElem, 'romoVideo:enterFullscreen', Romo.proxy(function(e, videoObj, romoVideo) {
141
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:enterFullscreen', [videoObj, romoVideo, this]);
164
142
  }, this));
165
- videoElem.on('video:exitFullscreen', $.proxy(function(e, videoObj, video) {
166
- this.elem.trigger('modalVideo:video:exitFullscreen', [videoObj, video, this]);
143
+ Romo.on(videoElem, 'romoVideo:exitFullscreen', Romo.proxy(function(e, videoObj, romoVideo) {
144
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:exitFullscreen', [videoObj, romoVideo, this]);
167
145
  }, this));
168
- videoElem.on('video:fullscreenChange', $.proxy(function(e, videoObj, video) {
169
- this.elem.trigger('modalVideo:video:fullscreenChange', [videoObj, video, this]);
146
+ Romo.on(videoElem, 'romoVideo:fullscreenChange', Romo.proxy(function(e, videoObj, romoVideo) {
147
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:fullscreenChange', [videoObj, romoVideo, this]);
170
148
  }, this));
171
149
 
172
150
  // load events
173
151
 
174
- videoElem.on('video:loadstart', $.proxy(function(e, videoObj, video) {
175
- this.elem.trigger('modalVideo:video:loadstart', [videoObj, video, this]);
152
+ Romo.on(videoElem, 'romoVideo:loadstart', Romo.proxy(function(e, videoObj, romoVideo) {
153
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:loadstart', [videoObj, romoVideo, this]);
176
154
  }, this));
177
- videoElem.on('video:loadedmetadata', $.proxy(function(e, videoObj, video) {
178
- this.elem.trigger('modalVideo:video:loadedmetadata', [videoObj, video, this]);
155
+ Romo.on(videoElem, 'romoVideo:loadedmetadata', Romo.proxy(function(e, videoObj, romoVideo) {
156
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:loadedmetadata', [videoObj, romoVideo, this]);
179
157
  }, this));
180
- videoElem.on('video:loadeddata', $.proxy(function(e, videoObj, video) {
181
- this.elem.trigger('modalVideo:video:loadeddata', [videoObj, video, this]);
158
+ Romo.on(videoElem, 'romoVideo:loadeddata', Romo.proxy(function(e, videoObj, romoVideo) {
159
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:loadeddata', [videoObj, romoVideo, this]);
182
160
  }, this));
183
- videoElem.on('video:canplay', $.proxy(function(e, videoObj, video) {
184
- this.elem.trigger('modalVideo:video:canplay', [videoObj, video, this]);
161
+ Romo.on(videoElem, 'romoVideo:canplay', Romo.proxy(function(e, videoObj, romoVideo) {
162
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:canplay', [videoObj, romoVideo, this]);
185
163
  }, this));
186
- videoElem.on('video:canplaythrough', $.proxy(function(e, videoObj, video) {
187
- this.elem.trigger('modalVideo:video:canplaythrough', [videoObj, video, this]);
164
+ Romo.on(videoElem, 'romoVideo:canplaythrough', Romo.proxy(function(e, videoObj, romoVideo) {
165
+ Romo.trigger(this.elem, 'romoModalVideo:romoVideo:canplaythrough', [videoObj, romoVideo, this]);
188
166
  }, this));
189
167
  }
190
168
 
191
169
  RomoModalVideo.prototype._bindModalVideoTriggerEvents = function() {
192
170
  // playback triggers
193
171
 
194
- this.elem.on('modalVideo:video:triggerPlay', $.proxy(function(e) {
195
- if (this.video != undefined) {
196
- this.video.elem.trigger('video:triggerPlay', []);
172
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerPlay', Romo.proxy(function(e) {
173
+ if (this.romoVideo != undefined) {
174
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerPlay', []);
197
175
  }
198
176
  }, this));
199
- this.elem.on('modalVideo:video:triggerPause', $.proxy(function(e) {
200
- if (this.video != undefined) {
201
- this.video.elem.trigger('video:triggerPause', []);
177
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerPause', Romo.proxy(function(e) {
178
+ if (this.romoVideo != undefined) {
179
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerPause', []);
202
180
  }
203
181
  }, this));
204
- this.elem.on('modalVideo:video:triggerTogglePlay', $.proxy(function(e) {
205
- if (this.video != undefined) {
206
- this.video.elem.trigger('video:triggerTogglePlay', []);
182
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerTogglePlay', Romo.proxy(function(e) {
183
+ if (this.romoVideo != undefined) {
184
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerTogglePlay', []);
207
185
  }
208
186
  }, this));
209
- this.elem.on('modalVideo:video:triggerSetPlaybackToTime', $.proxy(function(e, secondNum) {
210
- if (this.video != undefined) {
211
- this.video.elem.trigger('video:triggerSetPlaybackToTime', [secondNum]);
187
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerSetPlaybackToTime', Romo.proxy(function(e, secondNum) {
188
+ if (this.romoVideo != undefined) {
189
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerSetPlaybackToTime', [secondNum]);
212
190
  }
213
191
  }, this));
214
- this.elem.on('modalVideo:video:triggerSetPlaybackToFrame', $.proxy(function(e, frameNum) {
215
- if (this.video != undefined) {
216
- this.video.elem.trigger('video:triggerSetPlaybackToFrame', [frameNum]);
192
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerSetPlaybackToFrame', Romo.proxy(function(e, frameNum) {
193
+ if (this.romoVideo != undefined) {
194
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerSetPlaybackToFrame', [frameNum]);
217
195
  }
218
196
  }, this));
219
- this.elem.on('modalVideo:video:triggerSetPlaybackToPercent', $.proxy(function(e, percent) {
220
- if (this.video != undefined) {
221
- this.video.elem.trigger('video:triggerSetPlaybackToPercent', [percent]);
197
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerSetPlaybackToPercent', Romo.proxy(function(e, percent) {
198
+ if (this.romoVideo != undefined) {
199
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerSetPlaybackToPercent', [percent]);
222
200
  }
223
201
  }, this));
224
- this.elem.on('modalVideo:video:triggerModPlaybackByTime', $.proxy(function(e, secondsCount) {
225
- if (this.video != undefined) {
226
- this.video.elem.trigger('video:triggerModPlaybackByTime', [secondsCount]);
202
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModPlaybackByTime', Romo.proxy(function(e, secondsCount) {
203
+ if (this.romoVideo != undefined) {
204
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModPlaybackByTime', [secondsCount]);
227
205
  }
228
206
  }, this));
229
- this.elem.on('modalVideo:video:triggerModPlaybackByFrames', $.proxy(function(e, frameCount) {
230
- if (this.video != undefined) {
231
- this.video.elem.trigger('video:triggerModPlaybackByFrames', [frameCount]);
207
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModPlaybackByFrames', Romo.proxy(function(e, frameCount) {
208
+ if (this.romoVideo != undefined) {
209
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModPlaybackByFrames', [frameCount]);
232
210
  }
233
211
  }, this));
234
- this.elem.on('modalVideo:video:triggerModPlaybackByPercent', $.proxy(function(e, percent) {
235
- if (this.video != undefined) {
236
- this.video.elem.trigger('video:triggerModPlaybackByPercent', [percent]);
212
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModPlaybackByPercent', Romo.proxy(function(e, percent) {
213
+ if (this.romoVideo != undefined) {
214
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModPlaybackByPercent', [percent]);
237
215
  }
238
216
  }, this));
239
217
 
240
218
  // settings triggers
241
219
 
242
- this.elem.on('modalVideo:video:triggerMute', $.proxy(function(e) {
243
- if (this.video != undefined) {
244
- this.video.elem.trigger('video:triggerMute', []);
220
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerMute', Romo.proxy(function(e) {
221
+ if (this.romoVideo != undefined) {
222
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerMute', []);
245
223
  }
246
224
  }, this));
247
- this.elem.on('modalVideo:video:triggerUnmute', $.proxy(function(e) {
248
- if (this.video != undefined) {
249
- this.video.elem.trigger('video:triggerUnmute', []);
225
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerUnmute', Romo.proxy(function(e) {
226
+ if (this.romoVideo != undefined) {
227
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerUnmute', []);
250
228
  }
251
229
  }, this));
252
- this.elem.on('modalVideo:video:triggerToggleMute', $.proxy(function(e) {
253
- if (this.video != undefined) {
254
- this.video.elem.trigger('video:triggerToggleMute', []);
230
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerToggleMute', Romo.proxy(function(e) {
231
+ if (this.romoVideo != undefined) {
232
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerToggleMute', []);
255
233
  }
256
234
  }, this));
257
- this.elem.on('modalVideo:video:triggerSetVolumeToPercent', $.proxy(function(e, percent) {
258
- if (this.video != undefined) {
259
- this.video.elem.trigger('video:triggerSetVolumeToPercent', [percent]);
235
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerSetVolumeToPercent', Romo.proxy(function(e, percent) {
236
+ if (this.romoVideo != undefined) {
237
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerSetVolumeToPercent', [percent]);
260
238
  }
261
239
  }, this));
262
- this.elem.on('modalVideo:video:triggerModVolumeByPercent', $.proxy(function(e, percent) {
263
- if (this.video != undefined) {
264
- this.video.elem.trigger('video:triggerModVolumeByPercent', [percent]);
240
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModVolumeByPercent', Romo.proxy(function(e, percent) {
241
+ if (this.romoVideo != undefined) {
242
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModVolumeByPercent', [percent]);
265
243
  }
266
244
  }, this));
267
- this.elem.on('modalVideo:video:triggerSetPlaybackRate', $.proxy(function(e, rate) {
268
- if (this.video != undefined) {
269
- this.video.elem.trigger('video:triggerSetPlaybackRate', [rate]);
245
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerSetPlaybackRate', Romo.proxy(function(e, rate) {
246
+ if (this.romoVideo != undefined) {
247
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerSetPlaybackRate', [rate]);
270
248
  }
271
249
  }, this));
272
- this.elem.on('modalVideo:video:triggerModPlaybackRate', $.proxy(function(e, rate) {
273
- if (this.video != undefined) {
274
- this.video.elem.trigger('video:triggerModPlaybackRate', [rate]);
250
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModPlaybackRate', Romo.proxy(function(e, rate) {
251
+ if (this.romoVideo != undefined) {
252
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModPlaybackRate', [rate]);
275
253
  }
276
254
  }, this));
277
255
 
278
256
  // fullscreen triggers
279
257
 
280
- this.elem.on('modalVideo:video:triggerEnterFullscreen', $.proxy(function(e) {
281
- if (this.video != undefined) {
282
- this.video.elem.trigger('video:triggerEnterFullscreen', []);
258
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerEnterFullscreen', Romo.proxy(function(e) {
259
+ if (this.romoVideo != undefined) {
260
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerEnterFullscreen', []);
283
261
  }
284
262
  }, this));
285
- this.elem.on('modalVideo:video:triggerExitFullscreen', $.proxy(function(e) {
286
- if (this.video != undefined) {
287
- this.video.elem.trigger('video:triggerExitFullscreen', []);
263
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerExitFullscreen', Romo.proxy(function(e) {
264
+ if (this.romoVideo != undefined) {
265
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerExitFullscreen', []);
288
266
  }
289
267
  }, this));
290
- this.elem.on('modalVideo:video:triggerToggleFullscreen', $.proxy(function(e) {
291
- if (this.video != undefined) {
292
- this.video.elem.trigger('video:triggerToggleFullscreen', []);
268
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerToggleFullscreen', Romo.proxy(function(e) {
269
+ if (this.romoVideo != undefined) {
270
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerToggleFullscreen', []);
293
271
  }
294
272
  }, this));
295
273
 
296
274
  // load triggers
297
275
 
298
- this.elem.on('modalVideo:video:triggerLoad', $.proxy(function(e) {
299
- if (this.video != undefined) {
300
- this.video.elem.trigger('video:triggerLoad', []);
276
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerLoad', Romo.proxy(function(e) {
277
+ if (this.romoVideo != undefined) {
278
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerLoad', []);
301
279
  }
302
280
  }, this));
303
- this.elem.on('modalVideo:video:triggerModSource', $.proxy(function(e, source) {
304
- if (this.video != undefined) {
305
- this.video.elem.trigger('video:triggerModSource', [source]);
281
+ Romo.on(this.elem, 'romoModalVideo:romoVideo:triggerModSource', Romo.proxy(function(e, source) {
282
+ if (this.romoVideo != undefined) {
283
+ Romo.trigger(this.romoVideo.elem, 'romoVideo:triggerModSource', [source]);
306
284
  }
307
285
  }, this));
308
286
  }
309
287
 
310
- Romo.onInitUI(function(e) {
311
- Romo.initUIElems(e, '[data-romo-modalVideo-auto="true"]').romoModalVideo();
312
- });
288
+ // init
289
+
290
+ Romo.addElemsInitSelector('[data-romo-modalVideo-auto="true"]', RomoModalVideo);