"Restart when Opened" option (see #159)

This commit is contained in:
ccd0 2014-10-09 21:53:32 -07:00
parent 16e0742147
commit e54054cf8f
3 changed files with 9 additions and 4 deletions

View File

@ -211,6 +211,10 @@ Config =
true
'Videos begin playing immediately when opened.'
]
'Restart when Opened': [
true
'Restart GIFs and WebMs when you hover over or expand them.'
]
'Show Controls': [
true
'Show controls on videos expanded inline. Turn this off if you want to contract videos by clicking on them.'

View File

@ -140,7 +140,7 @@ ImageExpand =
el.pause()
for eventName, cb of ImageExpand.videoCB
$.off el, eventName, cb
ImageCommon.rewind file.thumb
ImageCommon.rewind file.thumb if Conf['Restart when Opened']
delete file.fullImage
$.queueTask ->
# XXX Work around Chrome/Chromium not firing mouseover on the thumbnail.
@ -163,7 +163,7 @@ ImageExpand =
else if ImageCommon.cache?.dataset.fullID is post.fullID
el = file.fullImage = ImageCommon.popCache()
$.on el, 'error', ImageExpand.error
ImageCommon.rewind el unless el.id is 'ihover'
ImageCommon.rewind el if Conf['Restart when Opened'] and el.id isnt 'ihover'
el.removeAttribute 'id'
else
el = file.fullImage = $.el (if isVideo then 'video' else 'img')

View File

@ -30,8 +30,9 @@ ImageHover =
el.dataset.fullID = post.fullID
$.on el, 'error', error
el.src = file.URL
ImageCommon.rewind el
ImageCommon.rewind @
if Conf['Restart when Opened']
ImageCommon.rewind el
ImageCommon.rewind @
el.id = 'ihover'
$.after Header.hover, el
if isVideo