Merge branch 'ccd0' into v3

Conflicts:
	builds/4chan-X.user.js
	builds/crx/script.js
	src/Images/ImageExpand.coffee
This commit is contained in:
Zixaphir 2014-04-06 22:45:30 -07:00
commit e286c247ea
5 changed files with 65 additions and 45 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -830,7 +830,7 @@ span.hide-announcement {
.full-image:not(#ihover) { .full-image:not(#ihover) {
display: none; display: none;
} }
.expanded-image > .post > .file .full-image:not(#ihover) { .expanded-image > .post > .file > .fileThumb > .full-image:not(#ihover) {
display: inline; display: inline;
} }
.expanding { .expanding {
@ -842,6 +842,9 @@ span.hide-announcement {
:root.fit-width .full-image:not(#ihover) { :root.fit-width .full-image:not(#ihover) {
max-width: 100%; max-width: 100%;
} }
:root.gecko.fit-width .full-image:not(#ihover) {
width: 100%;
}
#ihover { #ihover {
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;

View File

@ -28,8 +28,10 @@ ImageExpand =
cb: cb:
toggle: (e) -> toggle: (e) ->
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0 return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
post = Get.postFromNode @
return if post.file.isExpanded and post.file.fullImage?.controls
e.preventDefault() e.preventDefault()
ImageExpand.toggle Get.postFromNode @ ImageExpand.toggle post
toggleAll: -> toggleAll: ->
$.event 'CloseMenu' $.event 'CloseMenu'
@ -89,9 +91,11 @@ ImageExpand =
contract: (post) -> contract: (post) ->
if post.file.isVideo and video = post.file.fullImage if post.file.isVideo and video = post.file.fullImage
video.pause() video.pause()
TrashQueue.add video, post
post.file.thumb.parentNode.href = video.src
post.file.thumb.parentNode.target = '_blank'
for eventName, cb of ImageExpand.videoCB for eventName, cb of ImageExpand.videoCB
$.off video, eventName, cb $.off video, eventName, cb
TrashQueue.add video, post
post.file.videoControls?.map($.rm) post.file.videoControls?.map($.rm)
delete post.file.videoControls delete post.file.videoControls
$.rmClass post.nodes.root, 'expanded-image' $.rmClass post.nodes.root, 'expanded-image'
@ -112,8 +116,7 @@ ImageExpand =
el.loop = true if isVideo el.loop = true if isVideo
$.on el, 'error', ImageExpand.error $.on el, 'error', ImageExpand.error
el.src = src or post.file.URL el.src = src or post.file.URL
position = if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb $.after thumb, el unless el is thumb.nextSibling
$.after position, el unless el is position.nextSibling
$.asap (-> el.videoHeight or el.naturalHeight), -> $.asap (-> el.videoHeight or el.naturalHeight), ->
ImageExpand.completeExpand post ImageExpand.completeExpand post
@ -147,8 +150,13 @@ ImageExpand =
{file} = post {file} = post
video = file.fullImage video = file.fullImage
file.videoControls = [] file.videoControls = []
file.thumb.parentNode.removeAttribute 'href'
file.thumb.parentNode.removeAttribute 'target'
video.muted = !Conf['Allow Sound'] video.muted = !Conf['Allow Sound']
video.controls = Conf['Show Controls'] video.controls = Conf['Show Controls']
# drag left to contract
video.dataset.mousedown = 'false'
$.on video, eventName, cb for eventName, cb of ImageExpand.videoCB
if Conf['Show Controls'] if Conf['Show Controls']
# contract link in file info # contract link in file info
contract = $.el 'a', contract = $.el 'a',
@ -157,10 +165,6 @@ ImageExpand =
title: 'You can also contract the video by dragging it to the left.' title: 'You can also contract the video by dragging it to the left.'
$.on contract, 'click', (e) -> ImageExpand.contract post $.on contract, 'click', (e) -> ImageExpand.contract post
file.videoControls.push $.tn('\u00A0'), contract file.videoControls.push $.tn('\u00A0'), contract
# drag left to contract
video.dataset.mousedown = 'false'
for eventName, cb of ImageExpand.videoCB
$.on video, eventName, cb
if Conf['Autoplay'] if Conf['Autoplay']
video.controls = false video.controls = false
video.play() video.play()

View File

@ -30,8 +30,7 @@ ImageHover =
post.file.fullImage = el post.file.fullImage = el
{thumb} = post.file {thumb} = post.file
if d.body.contains thumb if d.body.contains thumb
position = if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb $.after thumb, el unless el is thumb.nextSibling
$.after position, el unless el is position.nextSibling
else else
$.add Header.hover, el if el.parentNode isnt Header.hover $.add Header.hover, el if el.parentNode isnt Header.hover
el.id = 'ihover' el.id = 'ihover'