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