Make original parent node of thumbnail post.file.thumbLink.
This commit is contained in:
parent
4fcb304b96
commit
049fe3b118
@ -25,7 +25,7 @@ Gallery =
|
|||||||
Gallery.nodes.total.textContent = Gallery.images.length
|
Gallery.nodes.total.textContent = Gallery.images.length
|
||||||
|
|
||||||
unless Conf['Image Expansion']
|
unless Conf['Image Expansion']
|
||||||
$.on @file.thumb.parentNode, 'click', Gallery.cb.image
|
$.on @file.thumbLink, 'click', Gallery.cb.image
|
||||||
|
|
||||||
build: (image) ->
|
build: (image) ->
|
||||||
{cb} = Gallery
|
{cb} = Gallery
|
||||||
@ -88,7 +88,7 @@ Gallery =
|
|||||||
Gallery.generateThumb post
|
Gallery.generateThumb post
|
||||||
# If no image to open is given, pick image we have scrolled to.
|
# If no image to open is given, pick image we have scrolled to.
|
||||||
if !image and Gallery.fullIDs[post.fullID]
|
if !image and Gallery.fullIDs[post.fullID]
|
||||||
candidate = post.file.thumb.parentNode
|
candidate = post.file.thumbLink
|
||||||
if Header.getTopOf(candidate) + candidate.getBoundingClientRect().height >= 0
|
if Header.getTopOf(candidate) + candidate.getBoundingClientRect().height >= 0
|
||||||
image = candidate
|
image = candidate
|
||||||
$.addClass doc, 'gallery-open'
|
$.addClass doc, 'gallery-open'
|
||||||
|
|||||||
@ -20,7 +20,7 @@ ImageExpand =
|
|||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return unless @file and (@file.isImage or @file.isVideo)
|
return unless @file and (@file.isImage or @file.isVideo)
|
||||||
$.on @file.thumb.parentNode, 'click', ImageExpand.cb.toggle
|
$.on @file.thumbLink, 'click', ImageExpand.cb.toggle
|
||||||
|
|
||||||
if @isClone
|
if @isClone
|
||||||
if @file.isExpanding
|
if @file.isExpanding
|
||||||
@ -122,8 +122,8 @@ ImageExpand =
|
|||||||
$.rmClass post.nodes.root, 'expanded-image'
|
$.rmClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass file.thumb, 'expanding'
|
$.rmClass file.thumb, 'expanding'
|
||||||
$.rm file.videoControls
|
$.rm file.videoControls
|
||||||
file.thumb.parentNode.href = file.url
|
file.thumbLink.href = file.url
|
||||||
file.thumb.parentNode.target = '_blank'
|
file.thumbLink.target = '_blank'
|
||||||
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView']
|
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView']
|
||||||
delete file[x]
|
delete file[x]
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ ImageExpand =
|
|||||||
expand: (post, src) ->
|
expand: (post, src) ->
|
||||||
# Do not expand images of hidden/filtered replies, or already expanded pictures.
|
# Do not expand images of hidden/filtered replies, or already expanded pictures.
|
||||||
{file} = post
|
{file} = post
|
||||||
{thumb, isVideo} = file
|
{thumb, thumbLink, isVideo} = file
|
||||||
return if post.isHidden or file.isExpanding or file.isExpanded
|
return if post.isHidden or file.isExpanding or file.isExpanded
|
||||||
|
|
||||||
$.addClass thumb, 'expanding'
|
$.addClass thumb, 'expanding'
|
||||||
@ -187,8 +187,8 @@ ImageExpand =
|
|||||||
$.add file.text, file.videoControls
|
$.add file.text, file.videoControls
|
||||||
|
|
||||||
# disable link to file so native controls can work
|
# disable link to file so native controls can work
|
||||||
thumb.parentNode.removeAttribute 'href'
|
thumbLink.removeAttribute 'href'
|
||||||
thumb.parentNode.removeAttribute 'target'
|
thumbLink.removeAttribute 'target'
|
||||||
|
|
||||||
el.loop = true
|
el.loop = true
|
||||||
Volume.setup el
|
Volume.setup el
|
||||||
|
|||||||
@ -62,7 +62,7 @@ Volume =
|
|||||||
node: ->
|
node: ->
|
||||||
return unless @board.ID in ['gif', 'wsg'] and @file?.isVideo
|
return unless @board.ID in ['gif', 'wsg'] and @file?.isVideo
|
||||||
$.on @file.thumb, 'wheel', Volume.wheel.bind(Header.hover)
|
$.on @file.thumb, 'wheel', Volume.wheel.bind(Header.hover)
|
||||||
$.on $('a', @file.text), 'wheel', Volume.wheel.bind(@file.thumb.parentNode)
|
$.on $('a', @file.text), 'wheel', Volume.wheel.bind(@file.thumbLink)
|
||||||
|
|
||||||
catalogNode: ->
|
catalogNode: ->
|
||||||
{file} = @thread.OP
|
{file} = @thread.OP
|
||||||
|
|||||||
@ -44,7 +44,8 @@ Post.Clone = class extends Post
|
|||||||
{fileRoot} = @nodes
|
{fileRoot} = @nodes
|
||||||
@file.text = fileRoot.firstElementChild
|
@file.text = fileRoot.firstElementChild
|
||||||
@file.link = $ '.fileText > a, .fileText-original', fileRoot
|
@file.link = $ '.fileText > a, .fileText-original', fileRoot
|
||||||
@file.thumb = $ '.fileThumb > [data-md5]', fileRoot
|
@file.thumb = $ 'a.fileThumb > [data-md5]', fileRoot
|
||||||
|
@file.thumbLink = @file.thumb.parentNode
|
||||||
@file.fullImage = $ '.full-image', fileRoot
|
@file.fullImage = $ '.full-image', fileRoot
|
||||||
@file.videoControls = $ '.video-controls', @file.text
|
@file.videoControls = $ '.video-controls', @file.text
|
||||||
|
|
||||||
|
|||||||
@ -182,9 +182,10 @@ class Post
|
|||||||
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
||||||
size *= 1024 while unit-- > 0
|
size *= 1024 while unit-- > 0
|
||||||
@file.sizeInBytes = size
|
@file.sizeInBytes = size
|
||||||
if (thumb = $ '.fileThumb > [data-md5]', fileRoot)
|
if (thumb = $ 'a.fileThumb > [data-md5]', fileRoot)
|
||||||
$.extend @file,
|
$.extend @file,
|
||||||
thumb: thumb
|
thumb: thumb
|
||||||
|
thumbLink: thumb.parentNode
|
||||||
thumbURL: if m = link.href.match(/\d+(?=\.\w+$)/) then "#{location.protocol}//i.4cdn.org/#{@board}/#{m[0]}s.jpg"
|
thumbURL: if m = link.href.match(/\d+(?=\.\w+$)/) then "#{location.protocol}//i.4cdn.org/#{@board}/#{m[0]}s.jpg"
|
||||||
MD5: thumb.dataset.md5
|
MD5: thumb.dataset.md5
|
||||||
isSpoiler: $.hasClass thumb.parentNode, 'imgspoiler'
|
isSpoiler: $.hasClass thumb.parentNode, 'imgspoiler'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user