Fixing code as per suggestions on PR 771.

This commit is contained in:
Valera Rozuvan
2013-08-27 10:19:55 +03:00
parent e788d6ce37
commit ba954ff164

View File

@@ -28,11 +28,9 @@ function () {
// Depending on whether captions file could be loaded, the following // Depending on whether captions file could be loaded, the following
// function invocation can succeed or fail. If it fails, we do not // function invocation can succeed or fail. If it fails, we do not
// go on with binding handlers to events. // go on with binding handlers to events.
if (!state.videoCaption.renderElements()) { if (state.videoCaption.renderElements()) {
return; state.videoCaption.bindHandlers();
} }
state.videoCaption.bindHandlers();
}; };
// *************************************************************** // ***************************************************************
@@ -102,9 +100,6 @@ function () {
this.videoCaption.subtitlesEl = this.el.find('ol.subtitles'); this.videoCaption.subtitlesEl = this.el.find('ol.subtitles');
this.videoCaption.hideSubtitlesEl = this.el.find('a.hide-subtitles'); this.videoCaption.hideSubtitlesEl = this.el.find('a.hide-subtitles');
this.el.find('.video-wrapper').after(this.videoCaption.subtitlesEl);
this.el.find('.video-controls .secondary-controls').append(this.videoCaption.hideSubtitlesEl);
// Fetch the captions file. If no file was specified, then we hide // Fetch the captions file. If no file was specified, then we hide
// the "CC" button, and return. // the "CC" button, and return.
if (!this.videoCaption.fetchCaption()) { if (!this.videoCaption.fetchCaption()) {
@@ -113,6 +108,9 @@ function () {
return false; return false;
} }
this.el.find('.video-wrapper').after(this.videoCaption.subtitlesEl);
this.el.find('.video-controls .secondary-controls').append(this.videoCaption.hideSubtitlesEl);
this.videoCaption.setSubtitlesHeight(); this.videoCaption.setSubtitlesHeight();
if (this.videoType === 'html5') { if (this.videoType === 'html5') {