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
cf69e35f
Commit
cf69e35f
authored
Sep 11, 2013
by
jmclaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adressed pull request comments
parent
b2ff98f0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
30 deletions
+28
-30
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
+28
-30
No files found.
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
View file @
cf69e35f
...
...
@@ -62,8 +62,7 @@ function () {
state
.
videoCaption
.
bindHandlers
=
_
.
bind
(
bindHandlers
,
state
);
state
.
videoCaption
.
fetchCaption
=
_
.
bind
(
fetchCaption
,
state
);
state
.
videoCaption
.
captionURL
=
_
.
bind
(
captionURL
,
state
);
state
.
videoCaption
.
captionMouseEnter
=
_
.
bind
(
captionMouseEnter
,
state
);
state
.
videoCaption
.
captionMouseLeave
=
_
.
bind
(
captionMouseLeave
,
state
);
state
.
videoCaption
.
captionMouseEnterLeave
=
_
.
bind
(
captionMouseEnterLeave
,
state
);
state
.
videoCaption
.
captionMouseDown
=
_
.
bind
(
captionMouseDown
,
state
);
state
.
videoCaption
.
captionMouseUp
=
_
.
bind
(
captionMouseUp
,
state
);
state
.
videoCaption
.
captionFocus
=
_
.
bind
(
captionFocus
,
state
);
...
...
@@ -325,14 +324,17 @@ function () {
this
.
videoCaption
.
subtitlesEl
.
html
(
container
.
html
());
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'mouseenter'
,
this
.
videoCaption
.
captionMouseEnter
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'mouseleave'
,
this
.
videoCaption
.
captionMouseLeave
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'mousedown'
,
this
.
videoCaption
.
captionMouseDown
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'mouseup'
,
this
.
videoCaption
.
captionMouseUp
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'click'
,
this
.
videoCaption
.
captionMouseUp
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'focus'
,
this
.
videoCaption
.
captionFocus
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'blur'
,
this
.
videoCaption
.
captionBlur
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'keydown'
,
this
.
videoCaption
.
captionKeyDown
);
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
({
mouseenter
:
this
.
videoCaption
.
captionMouseEnterLeave
,
mouseleave
:
this
.
videoCaption
.
captionMouseEnterLeave
,
mousedown
:
this
.
videoCaption
.
captionMouseDown
,
mouseup
:
this
.
videoCaption
.
captionMouseUp
,
click
:
this
.
videoCaption
.
captionMouseUp
,
focus
:
this
.
videoCaption
.
captionFocus
,
blur
:
this
.
videoCaption
.
captionBlur
,
keydown
:
this
.
videoCaption
.
captionKeyDown
});
this
.
videoCaption
.
automaticScroll
=
true
;
this
.
videoCaption
.
currentCaptionIndex
=
0
;
this
.
videoCaption
.
isMouseFocus
=
false
;
...
...
@@ -344,20 +346,13 @@ function () {
}
// On mouseEnter, hide the outline of a caption that has been tabbed to.
function
captionMouseEnter
(
event
)
{
var
caption
=
$
(
event
.
target
);
var
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
if
(
captionIndex
===
this
.
videoCaption
.
currentCaptionIndex
)
{
caption
.
css
(
'outlineWidth'
,
'0px'
);
}
}
// On mouseLeave, show the outline of a caption that has been tabbed to.
function
captionMouseLeave
(
event
)
{
function
captionMouse
Enter
Leave
(
event
)
{
var
caption
=
$
(
event
.
target
),
outlineWidth
=
(
event
.
type
===
'mouseleave'
)
?
1
:
0
,
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
if
(
captionIndex
===
this
.
videoCaption
.
currentCaptionIndex
)
{
caption
.
css
(
'outlineWidth'
,
'1
px'
);
caption
.
css
(
'outlineWidth'
,
outlineWidth
+
'
px'
);
}
}
...
...
@@ -379,21 +374,22 @@ function () {
// automatic scrolling.
if
(
this
.
videoCaption
.
isMouseFocus
)
{
this
.
videoCaption
.
automaticScroll
=
true
;
caption
.
css
(
'outlineWidth'
,
'0px'
);
caption
.
css
(
'outlineStyle'
,
'none'
);
caption
.
css
({
'outlineWidth'
:
'0px'
,
'outlineStyle'
:
'none'
});
}
// If the focus comes from tabbing, show the outline and turn off
// automatic scrolling.
else
{
this
.
videoCaption
.
currentCaptionIndex
=
captionIndex
;
caption
.
css
(
'outlineWidth'
,
'1px'
);
caption
.
css
(
'outlineStyle'
,
'dotted'
);
caption
.
css
({
'outlineWidth'
:
'1px'
,
'outlineStyle'
:
'dotted'
});
// The second and second to last elements turn automatic scrolling
// off again as it may have been enabled in captionBlur.
if
(
captionIndex
===
0
||
captionIndex
===
1
||
captionIndex
===
this
.
videoCaption
.
captions
.
length
-
2
||
captionIndex
===
this
.
videoCaption
.
captions
.
length
-
1
)
{
if
(
captionIndex
<=
1
||
captionIndex
>=
this
.
videoCaption
.
captions
.
length
-
2
)
{
this
.
videoCaption
.
automaticScroll
=
false
;
}
}
...
...
@@ -402,8 +398,10 @@ function () {
function
captionBlur
(
event
)
{
var
caption
=
$
(
event
.
target
),
captionIndex
=
parseInt
(
caption
.
attr
(
'data-index'
),
10
);
caption
.
css
(
'outlineWidth'
,
'0px'
);
caption
.
css
(
'outlineStyle'
,
'none'
);
caption
.
css
({
'outlineWidth'
:
'0px'
,
'outlineStyle'
:
'none'
});
// If we are on first or last index, we have to turn automatic scroll on
// again when losing focus. There is no way to know in what direction we
// are tabbing. So we could be on the first element and tabbing back out
...
...
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