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
5db419d2
Commit
5db419d2
authored
Mar 07, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used cookies to store speed
--HG-- branch : ernie-static-video-fixes
parent
90a70e66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
js/jquery.cookie.js
+47
-0
js/video_player.js
+6
-2
No files found.
js/jquery.cookie.js
0 → 100644
View file @
5db419d2
/*!
* jQuery Cookie Plugin
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2011, Klaus Hartl
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*/
(
function
(
$
)
{
$
.
cookie
=
function
(
key
,
value
,
options
)
{
// key and at least value given, set cookie...
if
(
arguments
.
length
>
1
&&
(
!
/Object/
.
test
(
Object
.
prototype
.
toString
.
call
(
value
))
||
value
===
null
||
value
===
undefined
))
{
options
=
$
.
extend
({},
options
);
if
(
value
===
null
||
value
===
undefined
)
{
options
.
expires
=
-
1
;
}
if
(
typeof
options
.
expires
===
'number'
)
{
var
days
=
options
.
expires
,
t
=
options
.
expires
=
new
Date
();
t
.
setDate
(
t
.
getDate
()
+
days
);
}
value
=
String
(
value
);
return
(
document
.
cookie
=
[
encodeURIComponent
(
key
),
'='
,
options
.
raw
?
value
:
encodeURIComponent
(
value
),
options
.
expires
?
'; expires='
+
options
.
expires
.
toUTCString
()
:
''
,
// use expires attribute, max-age is not supported by IE
options
.
path
?
'; path='
+
options
.
path
:
''
,
options
.
domain
?
'; domain='
+
options
.
domain
:
''
,
options
.
secure
?
'; secure'
:
''
].
join
(
''
));
}
// key and possibly options given, get cookie...
options
=
value
||
{};
var
decode
=
options
.
raw
?
function
(
s
)
{
return
s
;
}
:
decodeURIComponent
;
var
pairs
=
document
.
cookie
.
split
(
'; '
);
for
(
var
i
=
0
,
pair
;
pair
=
pairs
[
i
]
&&
pairs
[
i
].
split
(
'='
);
i
++
)
{
if
(
decode
(
pair
[
0
])
===
key
)
return
decode
(
pair
[
1
]
||
''
);
// IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
}
return
null
;
};
})(
jQuery
);
js/video_player.js
View file @
5db419d2
...
...
@@ -89,6 +89,10 @@ function change_video_speed(speed, youtube_id) {
ytplayer
.
loadVideoById
(
youtube_id
,
new_position
);
syncPlayButton
();
log_event
(
"speed"
,
{
"new_speed"
:
speed
,
"clip"
:
youtube_id
});
console
.
log
(
"setting"
);
console
.
log
(
speed
);
$
.
cookie
(
"video_speed"
,
speed
,
{
'expires'
:
3650
,
'path'
:
'/'
});
}
function
caption_at
(
index
)
{
...
...
@@ -383,9 +387,9 @@ function loadNewVideo(cap_id, id, startSeconds) {
function
syncPlayButton
(){
var
state
=
getPlayerState
();
if
(
state
==
1
||
state
==
3
)
{
$
(
"#video_control"
).
removeClass
().
addClass
(
"pause"
);
$
(
"#video_control"
).
removeClass
(
"play"
).
addClass
(
"pause"
);
}
else
if
(
state
==
2
||
state
==
-
1
||
state
==
0
){
$
(
"#video_control"
).
removeClass
().
addClass
(
"play"
);
$
(
"#video_control"
).
removeClass
(
"pause"
).
addClass
(
"play"
);
}
}
...
...
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