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
5ec01207
Commit
5ec01207
authored
Mar 24, 2016
by
sanfordstudent
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11924 from edx/sstudent/safe_video_template
Sstudent/safe video template
parents
4a496e7d
3d6fb38d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
common/lib/xmodule/xmodule/video_module/video_module.py
+2
-0
lms/templates/video.html
+14
-7
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
5ec01207
...
...
@@ -108,6 +108,8 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
# To make sure that js files are called in proper order we use numerical
# index. We do that to avoid issues that occurs in tests.
module
=
__name__
.
replace
(
'.video_module'
,
''
,
2
)
#TODO: For each of the following, ensure that any generated html is properly escaped.
js
=
{
'js'
:
[
resource_string
(
module
,
'js/src/video/00_component.js'
),
...
...
lms/templates/video.html
View file @
5ec01207
<
%
!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
page
expression_filter=
"h"
/
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
from
openedx
.
core
.
djangolib
.
js_utils
import
js_escaped_string
%
>
% if display_name is not UNDEFINED and display_name is not None:
<h3
class=
"hd hd-2"
>
${display_name}
</h3>
% endif
...
...
@@ -89,27 +93,29 @@
</div>
% if cdn_eval:
<script>
//TODO: refactor this js into a separate file.
function
sendPerformanceBeacon
(
id
,
expgroup
,
value
,
event_name
)
{
var
data
=
{
event
:
event_name
,
id
:
id
,
expgroup
:
expgroup
,
value
:
value
,
page
:
"html5vid"
};
$
.
ajax
({
method
:
"POST"
,
url
:
"/performance"
,
data
:
data
});
}
var
cdnStartTime
;
var
salt
=
Math
.
floor
((
1
+
Math
.
random
())
*
0x100000
).
toString
(
36
);
var
id
=
"${id | n, js_escaped_string}"
;
function
initializeCDNExperiment
()
{
sendPerformanceBeacon
(
"${id}
_"
+
salt
,
$
{
cdn_exp_group
},
""
,
"load"
);
sendPerformanceBeacon
(
id
+
"
_"
+
salt
,
$
{
cdn_exp_group
},
""
,
"load"
);
cdnStartTime
=
Date
.
now
();
$
.
each
([
'loadstart'
,
'abort'
,
'error'
,
'stalled'
,
'loadedmetadata'
,
'loadeddata'
,
'canplay'
,
'canplaythrough'
,
'seeked'
],
function
(
index
,
eventName
)
{
$
(
"#video_
${id}"
).
bind
(
"html5:"
+
eventName
,
null
,
function
()
{
$
(
"#video_
"
+
id
).
bind
(
"html5:"
+
eventName
,
null
,
function
()
{
timeElapsed
=
Date
.
now
()
-
cdnStartTime
;
sendPerformanceBeacon
(
"${id}
_"
+
salt
,
$
{
cdn_exp_group
},
timeElapsed
,
eventName
);
sendPerformanceBeacon
(
id
+
"
_"
+
salt
,
$
{
cdn_exp_group
},
timeElapsed
,
eventName
);
});
});
}
$
(
"#video_
${id}"
).
bind
(
"initialize"
,
null
,
initializeCDNExperiment
);
if
(
$
(
"#video_
${id}"
).
hasClass
(
"is-initialized"
))
{
$
(
"#video_
"
+
id
).
bind
(
"initialize"
,
null
,
initializeCDNExperiment
);
if
(
$
(
"#video_
"
+
id
).
hasClass
(
"is-initialized"
))
{
initializeCDNExperiment
();
}
</script>
% endif;
% endif;
\ No newline at end of file
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