Start to remember caption state
This commit is contained in:
@@ -9,6 +9,12 @@ class @Video
|
||||
@parseVideos @el.data('streams')
|
||||
@fetchMetadata()
|
||||
@parseSpeed()
|
||||
|
||||
if $.cookie('hide_captions') == 'true'
|
||||
@el.addClass('closed')
|
||||
else
|
||||
@el.removeClass('closed')
|
||||
|
||||
$("#video_#{@id}").data('video', this).addClass('video-load-complete')
|
||||
|
||||
if YT.Player
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class @VideoCaption extends Subview
|
||||
initialize: ->
|
||||
@loaded = false
|
||||
@loaded = false
|
||||
|
||||
bind: ->
|
||||
$(window).bind('resize', @resize)
|
||||
@@ -49,7 +49,7 @@ class @VideoCaption extends Subview
|
||||
@$('.subtitles').html(container.html())
|
||||
@$('.subtitles li[data-index]').click @seekPlayer
|
||||
|
||||
# prepend and append an empty <li> for cosmatic reason
|
||||
# prepend and append an empty <li> for cosmetic reason
|
||||
@$('.subtitles').prepend($('<li class="spacing">').height(@topSpacingHeight()))
|
||||
.append($('<li class="spacing">').height(@bottomSpacingHeight()))
|
||||
|
||||
@@ -131,10 +131,12 @@ class @VideoCaption extends Subview
|
||||
toggle: (event) =>
|
||||
event.preventDefault()
|
||||
if @el.hasClass('closed')
|
||||
$.cookie('hide_captions', 'false', expires: 3650, path: '/')
|
||||
@$('.hide-subtitles').attr('title', 'Turn off captions')
|
||||
@el.removeClass('closed')
|
||||
@scrollCaption()
|
||||
else
|
||||
$.cookie('hide_captions', 'true', expires: 3650, path: '/')
|
||||
@$('.hide-subtitles').attr('title', 'Turn on captions')
|
||||
@el.addClass('closed')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user