From 3a798adb0f085754d55f1adc316ab56deeccbaab Mon Sep 17 00:00:00 2001 From: jmclaus Date: Fri, 11 Oct 2013 10:38:59 +0200 Subject: [PATCH 1/3] Added two states to HD control: HD off - HD on --- .../xmodule/js/src/video/05_video_quality_control.js | 6 +++++- lms/templates/video.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js index cff103468d..bc3a33b799 100644 --- a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js +++ b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js @@ -63,10 +63,14 @@ function () { if (_.indexOf(this.config.availableQualities, value) !== -1) { this.videoQualityControl.el.addClass('active'); + this.videoQualityControl.el.attr('title', gettext('HD on')) + .text(gettext('HD on')); } else { this.videoQualityControl.el.removeClass('active'); + this.videoQualityControl.el.attr('title', gettext('HD off')) + .text(gettext('HD off')); } - } + } // This function change quality of video. // Right now we haven't ability to choose quality of HD video, diff --git a/lms/templates/video.html b/lms/templates/video.html index 677433898b..e2b59eecb0 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -77,7 +77,7 @@ ${_('Fill browser')} - ${_('HD')} + ${_('HD off')} ${_('Turn off captions')} From 585751ffca7df482b1b670771a3effbda587bc7e Mon Sep 17 00:00:00 2001 From: jmclaus Date: Fri, 11 Oct 2013 10:57:38 +0200 Subject: [PATCH 2/3] Updated template and fixtures --- common/lib/xmodule/xmodule/js/fixtures/video.html | 2 +- common/lib/xmodule/xmodule/js/fixtures/video_all.html | 2 +- common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html | 2 +- lms/templates/video.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/fixtures/video.html b/common/lib/xmodule/xmodule/js/fixtures/video.html index e658912885..e80bd3a0dd 100644 --- a/common/lib/xmodule/xmodule/js/fixtures/video.html +++ b/common/lib/xmodule/xmodule/js/fixtures/video.html @@ -45,7 +45,7 @@ Fill Browser - HD + HD off Captions diff --git a/common/lib/xmodule/xmodule/js/fixtures/video_all.html b/common/lib/xmodule/xmodule/js/fixtures/video_all.html index b774134cf7..e7a46e1bc2 100644 --- a/common/lib/xmodule/xmodule/js/fixtures/video_all.html +++ b/common/lib/xmodule/xmodule/js/fixtures/video_all.html @@ -48,7 +48,7 @@ Fill Browser - HD + HD off Captions diff --git a/common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html b/common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html index bf9272d230..6a53a33970 100644 --- a/common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html +++ b/common/lib/xmodule/xmodule/js/fixtures/video_yt_multiple.html @@ -45,7 +45,7 @@ Fill Browser - HD + HD off Captions diff --git a/lms/templates/video.html b/lms/templates/video.html index e2b59eecb0..a32070432d 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -77,7 +77,7 @@ ${_('Fill browser')} - ${_('HD off')} + ${_('HD off')} ${_('Turn off captions')} From 49bd356766e74eb7dc569f6408cf1d6b31d82fd7 Mon Sep 17 00:00:00 2001 From: jmclaus Date: Fri, 11 Oct 2013 14:33:44 +0200 Subject: [PATCH 3/3] Used chaining. Cached gettext call. --- .../js/src/video/05_video_quality_control.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js index bc3a33b799..fc8449c8d2 100644 --- a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js +++ b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js @@ -59,16 +59,22 @@ function () { // *************************************************************** function onQualityChange(value) { + var controlStateStr; this.videoQualityControl.quality = value; if (_.indexOf(this.config.availableQualities, value) !== -1) { - this.videoQualityControl.el.addClass('active'); - this.videoQualityControl.el.attr('title', gettext('HD on')) - .text(gettext('HD on')); + controlStateStr = gettext('HD on'); + this.videoQualityControl.el + .addClass('active') + .attr('title', controlStateStr) + .text(controlStateStr); } else { - this.videoQualityControl.el.removeClass('active'); - this.videoQualityControl.el.attr('title', gettext('HD off')) - .text(gettext('HD off')); + controlStateStr = gettext('HD off'); + this.videoQualityControl.el + .removeClass('active') + .attr('title', controlStateStr) + .text(controlStateStr); + } }