Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6713d6c7
Commit
6713d6c7
authored
Sep 27, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work in progress.
parent
7cfe279f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
90 deletions
+169
-90
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
+1
-0
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
+168
-90
No files found.
common/lib/xmodule/xmodule/js/src/video/01_initialize.js
View file @
6713d6c7
...
@@ -271,6 +271,7 @@ function (VideoPlayer) {
...
@@ -271,6 +271,7 @@ function (VideoPlayer) {
// The parent element of the video, and the ID.
// The parent element of the video, and the ID.
this
.
el
=
$
(
element
).
find
(
'.video'
);
this
.
el
=
$
(
element
).
find
(
'.video'
);
this
.
elVideoWrapper
=
this
.
el
.
find
(
'.video-wrapper'
);
this
.
id
=
this
.
el
.
attr
(
'id'
).
replace
(
/video_/
,
''
);
this
.
id
=
this
.
el
.
attr
(
'id'
).
replace
(
/video_/
,
''
);
console
.
log
(
console
.
log
(
...
...
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
View file @
6713d6c7
...
@@ -34,46 +34,63 @@ function () {
...
@@ -34,46 +34,63 @@ function () {
// function _makeFunctionsPublic(state)
// function _makeFunctionsPublic(state)
//
//
// Functions which will be accessible via 'state' object. When called,
these functions will
// Functions which will be accessible via 'state' object. When called,
// get the 'state' object as a context.
//
these functions will
get the 'state' object as a context.
function
_makeFunctionsPublic
(
state
)
{
function
_makeFunctionsPublic
(
state
)
{
state
.
videoCaption
.
autoShowCaptions
=
_
.
bind
(
autoShowCaptions
,
state
);
state
.
videoCaption
.
autoShowCaptions
=
_
.
bind
(
state
.
videoCaption
.
autoHideCaptions
=
_
.
bind
(
autoHideCaptions
,
state
);
autoShowCaptions
,
state
state
.
videoCaption
.
resize
=
_
.
bind
(
resize
,
state
);
);
state
.
videoCaption
.
toggle
=
_
.
bind
(
toggle
,
state
);
state
.
videoCaption
.
autoHideCaptions
=
_
.
bind
(
state
.
videoCaption
.
onMouseEnter
=
_
.
bind
(
onMouseEnter
,
state
);
autoHideCaptions
,
state
state
.
videoCaption
.
onMouseLeave
=
_
.
bind
(
onMouseLeave
,
state
);
);
state
.
videoCaption
.
onMovement
=
_
.
bind
(
onMovement
,
state
);
state
.
videoCaption
.
resize
=
_
.
bind
(
resize
,
state
);
state
.
videoCaption
.
renderCaption
=
_
.
bind
(
renderCaption
,
state
);
state
.
videoCaption
.
toggle
=
_
.
bind
(
toggle
,
state
);
state
.
videoCaption
.
captionHeight
=
_
.
bind
(
captionHeight
,
state
);
state
.
videoCaption
.
onMouseEnter
=
_
.
bind
(
onMouseEnter
,
state
);
state
.
videoCaption
.
topSpacingHeight
=
_
.
bind
(
topSpacingHeight
,
state
);
state
.
videoCaption
.
onMouseLeave
=
_
.
bind
(
onMouseLeave
,
state
);
state
.
videoCaption
.
bottomSpacingHeight
=
_
.
bind
(
bottomSpacingHeight
,
state
);
state
.
videoCaption
.
onMovement
=
_
.
bind
(
onMovement
,
state
);
state
.
videoCaption
.
scrollCaption
=
_
.
bind
(
scrollCaption
,
state
);
state
.
videoCaption
.
renderCaption
=
_
.
bind
(
renderCaption
,
state
);
state
.
videoCaption
.
search
=
_
.
bind
(
search
,
state
);
state
.
videoCaption
.
captionHeight
=
_
.
bind
(
captionHeight
,
state
);
state
.
videoCaption
.
play
=
_
.
bind
(
play
,
state
);
state
.
videoCaption
.
topSpacingHeight
=
_
.
bind
(
state
.
videoCaption
.
pause
=
_
.
bind
(
pause
,
state
);
topSpacingHeight
,
state
state
.
videoCaption
.
seekPlayer
=
_
.
bind
(
seekPlayer
,
state
);
);
state
.
videoCaption
.
hideCaptions
=
_
.
bind
(
hideCaptions
,
state
);
state
.
videoCaption
.
bottomSpacingHeight
=
_
.
bind
(
state
.
videoCaption
.
calculateOffset
=
_
.
bind
(
calculateOffset
,
state
);
bottomSpacingHeight
,
state
state
.
videoCaption
.
updatePlayTime
=
_
.
bind
(
updatePlayTime
,
state
);
);
state
.
videoCaption
.
setSubtitlesHeight
=
_
.
bind
(
setSubtitlesHeight
,
state
);
state
.
videoCaption
.
scrollCaption
=
_
.
bind
(
scrollCaption
,
state
);
state
.
videoCaption
.
search
=
_
.
bind
(
search
,
state
);
state
.
videoCaption
.
renderElements
=
_
.
bind
(
renderElements
,
state
);
state
.
videoCaption
.
play
=
_
.
bind
(
play
,
state
);
state
.
videoCaption
.
bindHandlers
=
_
.
bind
(
bindHandlers
,
state
);
state
.
videoCaption
.
pause
=
_
.
bind
(
pause
,
state
);
state
.
videoCaption
.
fetchCaption
=
_
.
bind
(
fetchCaption
,
state
);
state
.
videoCaption
.
seekPlayer
=
_
.
bind
(
seekPlayer
,
state
);
state
.
videoCaption
.
captionURL
=
_
.
bind
(
captionURL
,
state
);
state
.
videoCaption
.
hideCaptions
=
_
.
bind
(
hideCaptions
,
state
);
state
.
videoCaption
.
captionMouseOverOut
=
_
.
bind
(
captionMouseOverOut
,
state
);
state
.
videoCaption
.
calculateOffset
=
_
.
bind
(
state
.
videoCaption
.
captionMouseDown
=
_
.
bind
(
captionMouseDown
,
state
);
calculateOffset
,
state
state
.
videoCaption
.
captionClick
=
_
.
bind
(
captionClick
,
state
);
);
state
.
videoCaption
.
captionFocus
=
_
.
bind
(
captionFocus
,
state
);
state
.
videoCaption
.
updatePlayTime
=
_
.
bind
(
updatePlayTime
,
state
);
state
.
videoCaption
.
captionBlur
=
_
.
bind
(
captionBlur
,
state
);
state
.
videoCaption
.
setSubtitlesHeight
=
_
.
bind
(
state
.
videoCaption
.
captionKeyDown
=
_
.
bind
(
captionKeyDown
,
state
);
setSubtitlesHeight
,
state
);
state
.
videoCaption
.
renderElements
=
_
.
bind
(
renderElements
,
state
);
state
.
videoCaption
.
bindHandlers
=
_
.
bind
(
bindHandlers
,
state
);
state
.
videoCaption
.
fetchCaption
=
_
.
bind
(
fetchCaption
,
state
);
state
.
videoCaption
.
captionURL
=
_
.
bind
(
captionURL
,
state
);
state
.
videoCaption
.
captionMouseOverOut
=
_
.
bind
(
captionMouseOverOut
,
state
);
state
.
videoCaption
.
captionMouseDown
=
_
.
bind
(
captionMouseDown
,
state
);
state
.
videoCaption
.
captionClick
=
_
.
bind
(
captionClick
,
state
);
state
.
videoCaption
.
captionFocus
=
_
.
bind
(
captionFocus
,
state
);
state
.
videoCaption
.
captionBlur
=
_
.
bind
(
captionBlur
,
state
);
state
.
videoCaption
.
captionKeyDown
=
_
.
bind
(
captionKeyDown
,
state
);
}
}
// ***************************************************************
// ***************************************************************
// Public functions start here.
// Public functions start here.
// These are available via the 'state' object. Their context ('this' keyword) is the 'state' object.
// These are available via the 'state' object. Their context ('this'
// The magic private function that makes them available and sets up their context is makeFunctionsPublic().
// keyword) is the 'state' object. The magic private function that makes
// them available and sets up their context is makeFunctionsPublic().
// ***************************************************************
// ***************************************************************
/**
/**
...
@@ -109,10 +126,13 @@ function () {
...
@@ -109,10 +126,13 @@ function () {
// function bindHandlers()
// function bindHandlers()
//
//
// Bind any necessary function callbacks to DOM events (click, mousemove, etc.).
// Bind any necessary function callbacks to DOM events (click,
// mousemove, etc.).
function
bindHandlers
()
{
function
bindHandlers
()
{
$
(
window
).
bind
(
'resize'
,
this
.
videoCaption
.
resize
);
$
(
window
).
bind
(
'resize'
,
this
.
videoCaption
.
resize
);
this
.
videoCaption
.
hideSubtitlesEl
.
on
(
'click'
,
this
.
videoCaption
.
toggle
);
this
.
videoCaption
.
hideSubtitlesEl
.
on
(
'click'
,
this
.
videoCaption
.
toggle
);
this
.
videoCaption
.
subtitlesEl
this
.
videoCaption
.
subtitlesEl
.
on
(
.
on
(
...
@@ -138,8 +158,12 @@ function () {
...
@@ -138,8 +158,12 @@ function () {
// Moving slider on subtitles is not a mouse move,
// Moving slider on subtitles is not a mouse move,
// but captions and controls should be showed.
// but captions and controls should be showed.
this
.
videoCaption
.
subtitlesEl
.
on
(
'scroll'
,
this
.
videoCaption
.
autoShowCaptions
);
this
.
videoCaption
.
subtitlesEl
.
on
(
this
.
videoCaption
.
subtitlesEl
.
on
(
'scroll'
,
this
.
videoControl
.
showControls
);
'scroll'
,
this
.
videoCaption
.
autoShowCaptions
);
this
.
videoCaption
.
subtitlesEl
.
on
(
'scroll'
,
this
.
videoControl
.
showControls
);
}
}
}
}
...
@@ -209,7 +233,8 @@ function () {
...
@@ -209,7 +233,8 @@ function () {
}
}
function
captionURL
()
{
function
captionURL
()
{
return
''
+
this
.
config
.
caption_asset_path
+
this
.
youtubeId
(
'1.0'
)
+
'.srt.sjson'
;
return
''
+
this
.
config
.
caption_asset_path
+
this
.
youtubeId
(
'1.0'
)
+
'.srt.sjson'
;
}
}
function
autoShowCaptions
(
event
)
{
function
autoShowCaptions
(
event
)
{
...
@@ -224,13 +249,17 @@ function () {
...
@@ -224,13 +249,17 @@ function () {
this
.
videoCaption
.
subtitlesEl
.
show
();
this
.
videoCaption
.
subtitlesEl
.
show
();
this
.
captionState
=
'visible'
;
this
.
captionState
=
'visible'
;
}
else
if
(
this
.
captionState
===
'hiding'
)
{
}
else
if
(
this
.
captionState
===
'hiding'
)
{
this
.
videoCaption
.
subtitlesEl
.
stop
(
true
,
false
).
css
(
'opacity'
,
1
).
show
();
this
.
videoCaption
.
subtitlesEl
.
stop
(
true
,
false
).
css
(
'opacity'
,
1
).
show
();
this
.
captionState
=
'visible'
;
this
.
captionState
=
'visible'
;
}
else
if
(
this
.
captionState
===
'visible'
)
{
}
else
if
(
this
.
captionState
===
'visible'
)
{
clearTimeout
(
this
.
captionHideTimeout
);
clearTimeout
(
this
.
captionHideTimeout
);
}
}
this
.
captionHideTimeout
=
setTimeout
(
this
.
videoCaption
.
autoHideCaptions
,
this
.
videoCaption
.
fadeOutTimeout
);
this
.
captionHideTimeout
=
setTimeout
(
this
.
videoCaption
.
autoHideCaptions
,
this
.
videoCaption
.
fadeOutTimeout
);
this
.
captionsShowLock
=
false
;
this
.
captionsShowLock
=
false
;
}
}
...
@@ -249,15 +278,20 @@ function () {
...
@@ -249,15 +278,20 @@ function () {
_this
=
this
;
_this
=
this
;
this
.
videoCaption
.
subtitlesEl
.
fadeOut
(
this
.
videoCaption
.
fadeOutTimeout
,
function
()
{
this
.
videoCaption
.
subtitlesEl
.
fadeOut
(
this
.
videoCaption
.
fadeOutTimeout
,
function
()
{
_this
.
captionState
=
'invisible'
;
_this
.
captionState
=
'invisible'
;
});
});
}
}
function
resize
()
{
function
resize
()
{
this
.
videoCaption
.
subtitlesEl
this
.
videoCaption
.
subtitlesEl
.
find
(
'.spacing:first'
).
height
(
this
.
videoCaption
.
topSpacingHeight
())
.
find
(
'.spacing:first'
)
.
find
(
'.spacing:last'
).
height
(
this
.
videoCaption
.
bottomSpacingHeight
());
.
height
(
this
.
videoCaption
.
topSpacingHeight
())
.
find
(
'.spacing:last'
)
.
height
(
this
.
videoCaption
.
bottomSpacingHeight
());
this
.
videoCaption
.
scrollCaption
();
this
.
videoCaption
.
scrollCaption
();
...
@@ -269,7 +303,10 @@ function () {
...
@@ -269,7 +303,10 @@ function () {
clearTimeout
(
this
.
videoCaption
.
frozen
);
clearTimeout
(
this
.
videoCaption
.
frozen
);
}
}
this
.
videoCaption
.
frozen
=
setTimeout
(
this
.
videoCaption
.
onMouseLeave
,
10000
);
this
.
videoCaption
.
frozen
=
setTimeout
(
this
.
videoCaption
.
onMouseLeave
,
10000
);
}
}
function
onMouseLeave
()
{
function
onMouseLeave
()
{
...
@@ -292,8 +329,9 @@ function () {
...
@@ -292,8 +329,9 @@ function () {
var
container
=
$
(
'<ol>'
),
var
container
=
$
(
'<ol>'
),
_this
=
this
;
_this
=
this
;
this
.
el
.
find
(
'.video-wrapper'
).
after
(
this
.
videoCaption
.
subtitlesEl
);
this
.
elVideoWrapper
.
after
(
this
.
videoCaption
.
subtitlesEl
);
this
.
el
.
find
(
'.video-controls .secondary-controls'
).
append
(
this
.
videoCaption
.
hideSubtitlesEl
);
this
.
el
.
find
(
'.video-controls .secondary-controls'
)
.
append
(
this
.
videoCaption
.
hideSubtitlesEl
);
this
.
videoCaption
.
setSubtitlesHeight
();
this
.
videoCaption
.
setSubtitlesHeight
();
...
@@ -301,7 +339,10 @@ function () {
...
@@ -301,7 +339,10 @@ function () {
this
.
videoCaption
.
fadeOutTimeout
=
this
.
config
.
fadeOutTimeout
;
this
.
videoCaption
.
fadeOutTimeout
=
this
.
config
.
fadeOutTimeout
;
this
.
videoCaption
.
subtitlesEl
.
addClass
(
'html5'
);
this
.
videoCaption
.
subtitlesEl
.
addClass
(
'html5'
);
this
.
captionHideTimeout
=
setTimeout
(
this
.
videoCaption
.
autoHideCaptions
,
this
.
videoCaption
.
fadeOutTimeout
);
this
.
captionHideTimeout
=
setTimeout
(
this
.
videoCaption
.
autoHideCaptions
,
this
.
videoCaption
.
fadeOutTimeout
);
}
}
this
.
videoCaption
.
hideCaptions
(
this
.
hide_captions
);
this
.
videoCaption
.
hideCaptions
(
this
.
hide_captions
);
...
@@ -337,23 +378,30 @@ function () {
...
@@ -337,23 +378,30 @@ function () {
// Enables or disables automatic scrolling of the captions when the
// Enables or disables automatic scrolling of the captions when the
// video is playing. This feature has to be disabled when tabbing
// video is playing. This feature has to be disabled when tabbing
// through them as it interferes with that action. Initially, have this
// through them as it interferes with that action. Initially, have this
// flag enabled as we assume mouse use. Then, if the first caption
// flag enabled as we assume mouse use. Then, if the first caption
// (through forward tabbing) or the last caption (through backwards
// (through forward tabbing) or the last caption (through backwards
// tabbing) gets the focus, disable that feature. Renable it if tabbing
// tabbing) gets the focus, disable that feature. Renable it if tabbing
// then cycles out of the the captions.
// then cycles out of the the captions.
this
.
videoCaption
.
autoScrolling
=
true
;
this
.
videoCaption
.
autoScrolling
=
true
;
// Keeps track of where the focus is situated in the array of captions.
// Keeps track of where the focus is situated in the array of captions.
// Used to implement the automatic scrolling behavior and decide if the
// Used to implement the automatic scrolling behavior and decide if the
// outline around a caption has to be hidden or shown on a mouseenter or
// outline around a caption has to be hidden or shown on a mouseenter
// mouseleave. Initially, no caption has the focus, set the index to -1.
// or mouseleave. Initially, no caption has the focus, set the
// index to -1.
this
.
videoCaption
.
currentCaptionIndex
=
-
1
;
this
.
videoCaption
.
currentCaptionIndex
=
-
1
;
// Used to track if the focus is coming from a click or tabbing. This
// Used to track if the focus is coming from a click or tabbing. This
// has to be known to decide if, when a caption gets the focus, an
// has to be known to decide if, when a caption gets the focus, an
// outline has to be drawn (tabbing) or not (mouse click).
// outline has to be drawn (tabbing) or not (mouse click).
this
.
videoCaption
.
isMouseFocus
=
false
;
this
.
videoCaption
.
isMouseFocus
=
false
;
this
.
videoCaption
.
subtitlesEl
.
prepend
(
$
(
'<li class="spacing">'
).
height
(
this
.
videoCaption
.
topSpacingHeight
()));
this
.
videoCaption
.
subtitlesEl
.
prepend
(
this
.
videoCaption
.
subtitlesEl
.
append
(
$
(
'<li class="spacing">'
).
height
(
this
.
videoCaption
.
bottomSpacingHeight
()));
$
(
'<li class="spacing">'
)
.
height
(
this
.
videoCaption
.
topSpacingHeight
())
);
this
.
videoCaption
.
subtitlesEl
.
append
(
$
(
'<li class="spacing">'
)
.
height
(
this
.
videoCaption
.
bottomSpacingHeight
())
);
this
.
videoCaption
.
rendered
=
true
;
this
.
videoCaption
.
rendered
=
true
;
}
}
...
@@ -362,7 +410,7 @@ function () {
...
@@ -362,7 +410,7 @@ function () {
// On mouseOut, show the outline of a caption that has been tabbed to.
// On mouseOut, show the outline of a caption that has been tabbed to.
function
captionMouseOverOut
(
event
)
{
function
captionMouseOverOut
(
event
)
{
var
caption
=
$
(
event
.
target
),
var
caption
=
$
(
event
.
target
),
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
if
(
captionIndex
===
this
.
videoCaption
.
currentCaptionIndex
)
{
if
(
captionIndex
===
this
.
videoCaption
.
currentCaptionIndex
)
{
if
(
event
.
type
===
'mouseover'
)
{
if
(
event
.
type
===
'mouseover'
)
{
caption
.
removeClass
(
'focused'
);
caption
.
removeClass
(
'focused'
);
...
@@ -370,7 +418,7 @@ function () {
...
@@ -370,7 +418,7 @@ function () {
else
{
// mouseout
else
{
// mouseout
caption
.
addClass
(
'focused'
);
caption
.
addClass
(
'focused'
);
}
}
}
}
}
}
function
captionMouseDown
(
event
)
{
function
captionMouseDown
(
event
)
{
...
@@ -390,35 +438,38 @@ function () {
...
@@ -390,35 +438,38 @@ function () {
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
// If the focus comes from a mouse click, hide the outline, turn on
// If the focus comes from a mouse click, hide the outline, turn on
// automatic scrolling and set currentCaptionIndex to point outside of
// automatic scrolling and set currentCaptionIndex to point outside of
// caption list (ie -1) to disable mouseenter, mouseleave behavior.
// caption list (ie -1) to disable mouseenter, mouseleave behavior.
if
(
this
.
videoCaption
.
isMouseFocus
)
{
if
(
this
.
videoCaption
.
isMouseFocus
)
{
this
.
videoCaption
.
autoScrolling
=
true
;
this
.
videoCaption
.
autoScrolling
=
true
;
caption
.
removeClass
(
'focused'
);
caption
.
removeClass
(
'focused'
);
this
.
videoCaption
.
currentCaptionIndex
=
-
1
;
this
.
videoCaption
.
currentCaptionIndex
=
-
1
;
}
}
// If the focus comes from tabbing, show the outline and turn off
// If the focus comes from tabbing, show the outline and turn off
// automatic scrolling.
// automatic scrolling.
else
{
else
{
this
.
videoCaption
.
currentCaptionIndex
=
captionIndex
;
this
.
videoCaption
.
currentCaptionIndex
=
captionIndex
;
caption
.
addClass
(
'focused'
);
caption
.
addClass
(
'focused'
);
// The second and second to last elements turn automatic scrolling
// The second and second to last elements turn automatic scrolling
// off again as it may have been enabled in captionBlur.
// off again as it may have been enabled in captionBlur.
if
(
captionIndex
<=
1
||
captionIndex
>=
this
.
videoCaption
.
captions
.
length
-
2
)
{
if
(
captionIndex
<=
1
||
captionIndex
>=
this
.
videoCaption
.
captions
.
length
-
2
)
{
this
.
videoCaption
.
autoScrolling
=
false
;
this
.
videoCaption
.
autoScrolling
=
false
;
}
}
}
}
}
}
function
captionBlur
(
event
)
{
function
captionBlur
(
event
)
{
var
caption
=
$
(
event
.
target
),
var
caption
=
$
(
event
.
target
),
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
caption
.
removeClass
(
'focused'
);
caption
.
removeClass
(
'focused'
);
// If we are on first or last index, we have to turn automatic scroll
on
// If we are on first or last index, we have to turn automatic scroll
//
again when losing focus. There is no way to know in what direction we
//
on again when losing focus. There is no way to know in what
//
are tabbing. So we could be on the first element and tabbing back out
//
direction we are tabbing. So we could be on the first element and
//
of the captions or on the last element and tabbing forward out of the
//
tabbing back out of the captions or on the last element and tabbing
// captions.
//
forward out of the
captions.
if
(
captionIndex
===
0
||
if
(
captionIndex
===
0
||
captionIndex
===
this
.
videoCaption
.
captions
.
length
-
1
)
{
captionIndex
===
this
.
videoCaption
.
captions
.
length
-
1
)
{
this
.
videoCaption
.
autoScrolling
=
true
;
this
.
videoCaption
.
autoScrolling
=
true
;
}
}
...
@@ -434,9 +485,13 @@ function () {
...
@@ -434,9 +485,13 @@ function () {
function
scrollCaption
()
{
function
scrollCaption
()
{
var
el
=
this
.
videoCaption
.
subtitlesEl
.
find
(
'.current:first'
);
var
el
=
this
.
videoCaption
.
subtitlesEl
.
find
(
'.current:first'
);
// Automatic scrolling gets disabled if one of the captions has received
// Automatic scrolling gets disabled if one of the captions has
// focus through tabbing.
// received focus through tabbing.
if
(
!
this
.
videoCaption
.
frozen
&&
el
.
length
&&
this
.
videoCaption
.
autoScrolling
)
{
if
(
!
this
.
videoCaption
.
frozen
&&
el
.
length
&&
this
.
videoCaption
.
autoScrolling
)
{
this
.
videoCaption
.
subtitlesEl
.
scrollTo
(
this
.
videoCaption
.
subtitlesEl
.
scrollTo
(
el
,
el
,
{
{
...
@@ -565,11 +620,15 @@ function () {
...
@@ -565,11 +620,15 @@ function () {
}
}
function
topSpacingHeight
()
{
function
topSpacingHeight
()
{
return
this
.
videoCaption
.
calculateOffset
(
this
.
videoCaption
.
subtitlesEl
.
find
(
'li:not(.spacing):first'
));
return
this
.
videoCaption
.
calculateOffset
(
this
.
videoCaption
.
subtitlesEl
.
find
(
'li:not(.spacing):first'
)
);
}
}
function
bottomSpacingHeight
()
{
function
bottomSpacingHeight
()
{
return
this
.
videoCaption
.
calculateOffset
(
this
.
videoCaption
.
subtitlesEl
.
find
(
'li:not(.spacing):last'
));
return
this
.
videoCaption
.
calculateOffset
(
this
.
videoCaption
.
subtitlesEl
.
find
(
'li:not(.spacing):last'
)
);
}
}
function
toggle
(
event
)
{
function
toggle
(
event
)
{
...
@@ -588,14 +647,20 @@ function () {
...
@@ -588,14 +647,20 @@ function () {
if
(
hide_captions
)
{
if
(
hide_captions
)
{
type
=
'hide_transcript'
;
type
=
'hide_transcript'
;
this
.
captionsHidden
=
true
;
this
.
captionsHidden
=
true
;
this
.
videoCaption
.
hideSubtitlesEl
.
attr
(
'title'
,
gettext
(
'Turn on captions'
));
this
.
videoCaption
.
hideSubtitlesEl
.
attr
(
this
.
videoCaption
.
hideSubtitlesEl
.
text
(
gettext
(
'Turn on captions'
));
'title'
,
gettext
(
'Turn on captions'
)
);
this
.
videoCaption
.
hideSubtitlesEl
.
text
(
gettext
(
'Turn on captions'
));
this
.
el
.
addClass
(
'closed'
);
this
.
el
.
addClass
(
'closed'
);
}
else
{
}
else
{
type
=
'show_transcript'
;
type
=
'show_transcript'
;
this
.
captionsHidden
=
false
;
this
.
captionsHidden
=
false
;
this
.
videoCaption
.
hideSubtitlesEl
.
attr
(
'title'
,
gettext
(
'Turn off captions'
));
this
.
videoCaption
.
hideSubtitlesEl
.
attr
(
this
.
videoCaption
.
hideSubtitlesEl
.
text
(
gettext
(
'Turn off captions'
));
'title'
,
gettext
(
'Turn off captions'
)
);
this
.
videoCaption
.
hideSubtitlesEl
.
text
(
gettext
(
'Turn off captions'
));
this
.
el
.
removeClass
(
'closed'
);
this
.
el
.
removeClass
(
'closed'
);
this
.
videoCaption
.
scrollCaption
();
this
.
videoCaption
.
scrollCaption
();
}
}
...
@@ -615,12 +680,19 @@ function () {
...
@@ -615,12 +680,19 @@ function () {
}
}
function
captionHeight
()
{
function
captionHeight
()
{
var
paddingTop
;
if
(
this
.
isFullScreen
)
{
if
(
this
.
isFullScreen
)
{
return
$
(
window
).
height
()
-
this
.
el
.
find
(
'.video-controls'
).
height
()
-
paddingTop
=
parseInt
(
0.5
*
this
.
videoControl
.
sliderEl
.
height
()
-
this
.
videoCaption
.
subtitlesEl
.
css
(
'padding-top'
),
10
2
*
parseInt
(
this
.
videoCaption
.
subtitlesEl
.
css
(
'padding-top'
),
10
);
);
return
$
(
window
).
height
()
-
this
.
videoControl
.
el
.
height
()
-
0.5
*
this
.
videoControl
.
sliderEl
.
height
()
-
2
*
paddingTop
;
}
else
{
}
else
{
return
this
.
el
.
find
(
'.video-wrapper'
)
.
height
();
return
this
.
el
VideoWrapper
.
height
();
}
}
}
}
...
@@ -629,13 +701,19 @@ function () {
...
@@ -629,13 +701,19 @@ function () {
if
(
this
.
videoType
===
'html5'
){
if
(
this
.
videoType
===
'html5'
){
// on page load captionHidden = undefined
// on page load captionHidden = undefined
if
(
if
(
(
this
.
captionsHidden
===
undefined
&&
this
.
hide_captions
===
true
)
||
(
(
this
.
captionsHidden
===
true
)
)
{
this
.
captionsHidden
===
undefined
&&
// In case of html5 autoshowing subtitles,
this
.
hide_captions
===
true
// we ajdust height of subs, by height of scrollbar
)
||
height
=
this
.
videoControl
.
el
.
height
()
+
0.5
*
this
.
videoControl
.
sliderEl
.
height
();
(
this
.
captionsHidden
===
true
)
// height of videoControl does not contain height of slider.
)
{
// (css is set to absolute, to avoid yanking when slider autochanges its height)
// In case of html5 autoshowing subtitles, we adjust height of
// subs, by height of scrollbar.
height
=
this
.
videoControl
.
el
.
height
()
+
0.5
*
this
.
videoControl
.
sliderEl
.
height
();
// Height of videoControl does not contain height of slider.
// css is set to absolute, to avoid yanking when slider
// autochanges its height.
}
}
}
}
this
.
videoCaption
.
subtitlesEl
.
css
({
this
.
videoCaption
.
subtitlesEl
.
css
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment