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
dcabccc1
Commit
dcabccc1
authored
Sep 10, 2013
by
jmclaus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tabbing through captions works except for persistence of outline after mouse click
parent
b6cde36d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
3 deletions
+76
-3
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
+76
-3
No files found.
common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
View file @
dcabccc1
...
...
@@ -62,6 +62,13 @@ 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
.
captionMouseDown
=
_
.
bind
(
captionMouseDown
,
state
);
state
.
videoCaption
.
captionMouseUp
=
_
.
bind
(
captionMouseUp
,
state
);
state
.
videoCaption
.
captionFocus
=
_
.
bind
(
captionFocus
,
state
);
state
.
videoCaption
.
captionBlur
=
_
.
bind
(
captionBlur
,
state
);
state
.
videoCaption
.
captionPressEnter
=
_
.
bind
(
captionPressEnter
,
state
);
}
// ***************************************************************
...
...
@@ -309,7 +316,8 @@ function () {
liEl
.
attr
({
'data-index'
:
index
,
'data-start'
:
_this
.
videoCaption
.
start
[
index
]
'data-start'
:
_this
.
videoCaption
.
start
[
index
],
'tabindex'
:
0
});
container
.
append
(
liEl
);
...
...
@@ -317,7 +325,16 @@ function () {
this
.
videoCaption
.
subtitlesEl
.
html
(
container
.
html
());
this
.
videoCaption
.
subtitlesEl
.
find
(
'li[data-index]'
).
on
(
'click'
,
this
.
videoCaption
.
seekPlayer
);
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
.
captionPressEnter
);
this
.
videoCaption
.
tabbing
=
false
;
this
.
videoCaption
.
tabIndex
=
0
;
this
.
videoCaption
.
subtitlesEl
.
prepend
(
$
(
'<li class="spacing">'
).
height
(
this
.
videoCaption
.
topSpacingHeight
()));
this
.
videoCaption
.
subtitlesEl
.
append
(
$
(
'<li class="spacing">'
).
height
(
this
.
videoCaption
.
bottomSpacingHeight
()));
...
...
@@ -325,10 +342,66 @@ function () {
this
.
videoCaption
.
rendered
=
true
;
}
function
captionMouseEnter
(
event
)
{
var
target
=
$
(
event
.
target
);
var
targetIndex
=
parseInt
(
target
.
attr
(
'data-index'
),
10
);
if
(
targetIndex
===
this
.
tabIndex
)
{
target
.
css
(
'outlineWidth'
,
'0px'
);
}
}
function
captionMouseLeave
(
event
)
{
var
target
=
$
(
event
.
target
);
var
targetIndex
=
parseInt
(
target
.
attr
(
'data-index'
),
10
);
if
(
targetIndex
===
this
.
tabIndex
)
{
target
.
css
(
'outlineWidth'
,
'1px'
);
}
}
function
captionMouseDown
(
event
)
{
var
target
=
$
(
event
.
target
);
target
.
css
(
'outlineWidth'
,
'0px'
);
this
.
videoCaption
.
tabbing
=
false
;
}
function
captionMouseUp
(
event
)
{
this
.
videoCaption
.
seekPlayer
(
event
);
}
function
captionFocus
(
event
)
{
var
target
=
$
(
event
.
target
);
var
targetIndex
=
parseInt
(
target
.
attr
(
'data-index'
),
10
);
this
.
tabIndex
=
targetIndex
;
target
.
css
(
'outlineWidth'
,
'1px'
);
target
.
css
(
'outlineStyle'
,
'dotted'
);
if
(
targetIndex
===
0
||
targetIndex
===
1
||
targetIndex
===
this
.
videoCaption
.
captions
.
length
-
2
||
targetIndex
===
this
.
videoCaption
.
captions
.
length
-
1
)
{
this
.
videoCaption
.
tabbing
=
true
;
}
}
function
captionBlur
(
event
)
{
var
target
=
$
(
event
.
target
);
targetIndex
=
parseInt
(
target
.
attr
(
'data-index'
),
10
);
target
.
css
(
'outlineWidth'
,
'0px'
);
target
.
css
(
'outlineStyle'
,
'none'
);
if
(
targetIndex
===
0
||
targetIndex
===
this
.
videoCaption
.
captions
.
length
-
1
)
{
this
.
videoCaption
.
tabbing
=
false
;
}
}
function
captionPressEnter
(
event
)
{
if
(
event
.
which
===
13
)
{
//Enter key
this
.
videoCaption
.
seekPlayer
(
event
);
}
}
function
scrollCaption
()
{
var
el
=
this
.
videoCaption
.
subtitlesEl
.
find
(
'.current:first'
);
if
(
!
this
.
videoCaption
.
frozen
&&
el
.
length
)
{
if
(
!
this
.
videoCaption
.
frozen
&&
el
.
length
&&
!
this
.
videoCaption
.
tabbing
)
{
this
.
videoCaption
.
subtitlesEl
.
scrollTo
(
el
,
{
...
...
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