Image Hover in Catalog

This commit is contained in:
ccd0 2014-09-27 00:47:14 -07:00
parent a0e1268e60
commit a94dd0c71f
2 changed files with 18 additions and 6 deletions

View File

@ -159,6 +159,10 @@ Config =
true true
'Show full image / video on mouseover.' 'Show full image / video on mouseover.'
] ]
'Image Hover in Catalog': [
false
'Show full image / video on mouseover in 4chan X catalog.'
]
'Gallery': [ 'Gallery': [
true true
'Adds a simple and cute image gallery.' 'Adds a simple and cute image gallery.'

View File

@ -1,13 +1,21 @@
ImageHover = ImageHover =
init: -> init: ->
return if g.VIEW is 'catalog' or !Conf['Image Hover'] return if g.VIEW is 'catalog'
if Conf['Image Hover']
Post.callbacks.push Post.callbacks.push
name: 'Image Hover' name: 'Image Hover'
cb: @node cb: @node
if Conf['Image Hover in Catalog']
CatalogThread.callbacks.push
name: 'Catalog Image Hover'
cb: @catalogNode
node: -> node: ->
return unless @file?.isImage or @file?.isVideo return unless @file and (@file.isImage or @file.isVideo)
$.on @file.thumb, 'mouseover', ImageHover.mouseover @ $.on @file.thumb, 'mouseover', ImageHover.mouseover @
catalogNode: ->
{file} = @thread.OP
return unless file and (file.isImage or file.isVideo)
$.on @nodes.thumb, 'mouseover', ImageHover.mouseover @thread.OP
mouseover: (post) -> (e) -> mouseover: (post) -> (e) ->
return unless doc.contains @ return unless doc.contains @
{file} = post {file} = post