From 30ddaf77576f74651354c51682476c638a1baf42 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Mon, 7 Oct 2013 16:50:00 +0300 Subject: [PATCH] Enabling showing of captions always when mouse is over CC. --- .../xmodule/xmodule/css/video/display.scss | 4 ++-- .../xmodule/js/src/video/09_video_caption.js | 23 ++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/css/video/display.scss b/common/lib/xmodule/xmodule/css/video/display.scss index c087d18098..36dbc76353 100644 --- a/common/lib/xmodule/xmodule/css/video/display.scss +++ b/common/lib/xmodule/xmodule/css/video/display.scss @@ -392,7 +392,7 @@ div.video { @include transition(none); -webkit-font-smoothing: antialiased; width: 30px; - + &:hover, &:active { background-color: #444; color: #fff; @@ -457,7 +457,7 @@ div.video { text-indent: -9999px; @include transition(none); width: 30px; - + &:hover, &:active { background-color: #444; color: #fff; diff --git a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js index b11f08ce21..f69bcc1600 100644 --- a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js +++ b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js @@ -170,15 +170,22 @@ function () { } else if (!this.config.autohideHtml5) { this.videoCaption.subtitlesEl.on({ keydown: this.videoCaption.autoShowCaptions, + focus: this.videoCaption.autoShowCaptions, // Moving slider on subtitles is not a mouse move, but captions // should not be auto-hidden. - scroll: this.videoCaption.autoShowCaptions + scroll: this.videoCaption.autoShowCaptions, + + mouseout: this.videoCaption.autoHideCaptions, + blur: this.videoCaption.autoHideCaptions }); this.videoCaption.hideSubtitlesEl.on({ mousemove: this.videoCaption.autoShowCaptions, - keydown: this.videoCaption.autoShowCaptions + focus: this.videoCaption.autoShowCaptions, + + mouseout: this.videoCaption.autoHideCaptions, + blur: this.videoCaption.autoHideCaptions }); } } @@ -272,10 +279,12 @@ function () { clearTimeout(this.captionHideTimeout); } - this.captionHideTimeout = setTimeout( - this.videoCaption.autoHideCaptions, - this.videoCaption.fadeOutTimeout - ); + if (this.config.autohideHtml5) { + this.captionHideTimeout = setTimeout( + this.videoCaption.autoHideCaptions, + this.videoCaption.fadeOutTimeout + ); + } this.captionsShowLock = false; } @@ -502,6 +511,8 @@ function () { // forward out of the captions. if (captionIndex === 0 || captionIndex === this.videoCaption.captions.length-1) { + this.videoCaption.autoHideCaptions(); + this.videoCaption.autoScrolling = true; } }