Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not include videojs-transcripts.js to page if no transcripts #50

Merged
merged 1 commit into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions video_xblock/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ def get_frag(self, **context):
frag.add_javascript(self.render_resource(
'../static/js/videojs-speed-handler.js', **context
))
frag.add_javascript(self.resource_string(
'../static/bower_components/videojs-transcript/dist/videojs-transcript.js'
))
frag.add_javascript(self.resource_string(
'../static/bower_components/videojs-contextmenu/dist/videojs-contextmenu.min.js'
))
Expand All @@ -68,15 +65,19 @@ def get_frag(self, **context):
frag.add_javascript(
self.render_resource('../static/js/player_state.js', **context)
)
if context['player_state']['transcripts']:
frag.add_javascript(self.resource_string(
'../static/bower_components/videojs-transcript/dist/videojs-transcript.js'
))
frag.add_javascript(
self.render_resource('../static/js/videojs-transcript.js', **context)
)
frag.add_javascript(
self.render_resource('../static/js/videojs-tabindex.js', **context)
)
frag.add_javascript(
self.resource_string('../static/js/toggle-button.js')
)
frag.add_javascript(
self.render_resource('../static/js/videojs-transcript.js', **context)
)
frag.add_javascript(self.render_resource(
'../static/js/videojs_event_plugin.js', **context
))
Expand Down
13 changes: 7 additions & 6 deletions video_xblock/backends/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ def get_frag(self, **context):
frag.add_css_url(
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'
)
frag.add_content(
self.add_js_content('../static/bower_components/videojs-transcript/dist/videojs-transcript.js')
)
frag.add_content(
self.add_js_content('../static/js/player_state.js', **context)
)
if context['player_state']['transcripts']:
frag.add_content(
self.add_js_content('../static/bower_components/videojs-transcript/dist/videojs-transcript.js')
)
frag.add_content(
self.add_js_content('../static/js/videojs-transcript.js', **context)
)
frag.add_content(
self.add_js_content('../static/js/videojs-tabindex.js', **context)
)
frag.add_content(
self.add_js_content('../static/js/toggle-button.js')
)
frag.add_content(
self.add_js_content('../static/js/videojs-transcript.js', **context)
)
frag.add_content(
self.add_js_content('../static/js/videojs_event_plugin.js', **context)
)
Expand Down
5 changes: 4 additions & 1 deletion video_xblock/static/css/transcripts.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
#transcript {
max-height: 100%;
overflow: scroll;
padding: 0 0 0 20px;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
background-color: inherit;
}

.transcript-body {
padding: 0 0 0 20px;
}

.transcript-line {
margin-bottom: 8px;
border: 0;
Expand Down
5 changes: 4 additions & 1 deletion video_xblock/static/css/videojs.css
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,15 @@ body {
#transcript {
max-height: 100%;
overflow: scroll;
padding: 0 0 0 20px;
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
background-color: inherit;
}

.transcript-body {
padding: 0 0 0 20px;
}

.transcript-line {
margin-bottom: 8px;
border: 0;
Expand Down
1 change: 0 additions & 1 deletion video_xblock/static/js/videojs-transcript.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
domReady(function() {
videojs('{{ video_player_id }}').ready(function(){

// fire up the plugin
var transcript = this.transcript({
'showTrackSelector': false,
Expand Down