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
b583a4e7
Commit
b583a4e7
authored
Aug 14, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizing code. Caching an element selector.
parent
99ae6377
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js
+25
-23
No files found.
common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js
View file @
b583a4e7
...
...
@@ -77,6 +77,8 @@ function () {
* @returns {undefined}
*/
function
_bindHandlers
(
state
)
{
var
speedLinks
;
state
.
videoSpeedControl
.
videoSpeedsEl
.
find
(
'a'
)
.
on
(
'click'
,
state
.
videoSpeedControl
.
changeVideoSpeed
);
...
...
@@ -146,29 +148,29 @@ function () {
// ******************************
// Attach 'focus', and 'blur' events to elements which represent
// individual speed entries.
s
tate
.
videoSpeedControl
.
videoSpeedsEl
.
find
(
'a.speed_link:last'
)
.
on
(
'blur'
,
function
()
{
// If we have reached the last speed entry, and the focus
// changes to the next element, we need to hide the speeds
// control drop-down.
state
.
videoSpeedControl
.
el
.
removeClass
(
'open'
);
});
state
.
videoSpeedControl
.
videoSpeedsEl
.
find
(
'a.speed_link:first'
)
.
on
(
'blur'
,
function
()
{
// This flag will indicate that the focus to the next
// element that will receive it is comming from the firs
t
// speed entry.
//
// This flag will be used to correctly handle scenario of
// tabbing backwards.
state
.
firstSpeedBlur
=
true
;
})
;
state
.
videoSpeedControl
.
videoSpeedsEl
.
find
(
'a.speed_link'
)
.
on
(
'focus'
,
function
()
{
// Clear the flag which is only set when we are un-focusing
// (the blur event) from the first speed entry.
state
.
firstSpeedBlur
=
false
;
});
s
peedLinks
=
state
.
videoSpeedControl
.
videoSpeedsEl
.
find
(
'a.speed_link'
);
speedLinks
.
last
().
on
(
'blur'
,
function
()
{
// If we have reached the last speed entry, and the focus
// changes to the next element, we need to hide the speeds
// control drop-down.
state
.
videoSpeedControl
.
el
.
removeClass
(
'open'
);
});
speedLinks
.
first
().
on
(
'blur'
,
function
()
{
// This flag will indicate that the focus to the nex
t
// element that will receive it is comming from the first
// speed entry.
//
// This flag will be used to correctly handle scenario of
// tabbing backwards.
state
.
firstSpeedBlur
=
true
;
});
speedLinks
.
on
(
'focus'
,
function
()
{
// Clear the flag which is only set when we are un-focusing
// (the blur event) from the first speed entry.
state
.
firstSpeedBlur
=
false
;
});
}
}
...
...
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