"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 true
'Videos begin playing immediately when opened.' 'Videos begin playing immediately when opened.'
] ]
'Restart when Opened': [
true
'Restart GIFs and WebMs when you hover over or expand them.'
]
'Show Controls': [ 'Show Controls': [
true true
'Show controls on videos expanded inline. Turn this off if you want to contract videos by clicking on them.' '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() el.pause()
for eventName, cb of ImageExpand.videoCB for eventName, cb of ImageExpand.videoCB
$.off el, eventName, cb $.off el, eventName, cb
ImageCommon.rewind file.thumb ImageCommon.rewind file.thumb if Conf['Restart when Opened']
delete file.fullImage delete file.fullImage
$.queueTask -> $.queueTask ->
# XXX Work around Chrome/Chromium not firing mouseover on the thumbnail. # 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 else if ImageCommon.cache?.dataset.fullID is post.fullID
el = file.fullImage = ImageCommon.popCache() el = file.fullImage = ImageCommon.popCache()
$.on el, 'error', ImageExpand.error $.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' el.removeAttribute 'id'
else else
el = file.fullImage = $.el (if isVideo then 'video' else 'img') el = file.fullImage = $.el (if isVideo then 'video' else 'img')

View File

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