Merge branch 'bstable'

This commit is contained in:
ccd0 2016-07-06 17:33:44 -07:00
commit acd5cbf430
5 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,9 @@
## v1.12.0 ## v1.12.0
**v1.12.0.8** *(2016-07-07)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.8/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.8/builds/4chan-X-noupdate.crx)]
- Restore `Restart when Opened` option.
**v1.12.0.7** *(2016-07-06)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.7/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.7/builds/4chan-X-noupdate.crx)] **v1.12.0.7** *(2016-07-06)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.7/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.12.0.7/builds/4chan-X-noupdate.crx)]
- Restore `Open Post in New Tab` option. - Restore `Open Post in New Tab` option.

View File

@ -6,6 +6,12 @@ ImageCommon =
$.off video, 'volumechange', Volume.change $.off video, 'volumechange', Volume.change
video.muted = true video.muted = true
rewind: (el) ->
if el.nodeName is 'VIDEO'
el.currentTime = 0 if el.readyState >= el.HAVE_METADATA
else if /\.gif$/.test el.src
$.queueTask -> el.src = el.src
pushCache: (el) -> pushCache: (el) ->
ImageCommon.cache = el ImageCommon.cache = el
$.on el, 'error', ImageCommon.cacheError $.on el, 'error', ImageCommon.cacheError

View File

@ -146,6 +146,7 @@ ImageExpand =
ImageCommon.pause el ImageCommon.pause el
for eventName, cb of ImageExpand.videoCB for eventName, cb of ImageExpand.videoCB
$.off el, eventName, cb $.off el, eventName, cb
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.
@ -168,6 +169,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 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

@ -34,6 +34,9 @@ ImageHover =
$.on el, 'error', error $.on el, 'error', error
el.src = file.url el.src = file.url
if Conf['Restart when Opened']
ImageCommon.rewind el
ImageCommon.rewind @
el.id = 'ihover' el.id = 'ihover'
$.add Header.hover, el $.add Header.hover, el
if isVideo if isVideo

View File

@ -254,6 +254,10 @@ Config =
true true
'Videos begin playing immediately when opened.' 'Videos begin playing immediately when opened.'
] ]
'Restart when Opened': [
false
'Restart GIFs and WebMs when you hover over or expand them.'
]
'Show Controls': [ 'Show Controls': [
true true
'Show controls on videos expanded inline.' 'Show controls on videos expanded inline.'