Add a tooltip showing the OP's post info in the catalog.
This commit is contained in:
parent
349009ab67
commit
7ec83c24bc
@ -495,6 +495,16 @@ a[href="javascript:;"] {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.thread-info {
|
||||||
|
position: fixed;
|
||||||
|
background: inherit;
|
||||||
|
padding: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, .25);
|
||||||
|
}
|
||||||
|
.thread-info .post {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Announcement Hiding */
|
/* Announcement Hiding */
|
||||||
:root.hide-announcement #globalMessage,
|
:root.hide-announcement #globalMessage,
|
||||||
|
|||||||
@ -159,6 +159,8 @@ Index =
|
|||||||
@pin() if data.isPinned
|
@pin() if data.isPinned
|
||||||
catalogNode: ->
|
catalogNode: ->
|
||||||
$.on @nodes.thumb, 'click', Index.onClick
|
$.on @nodes.thumb, 'click', Index.onClick
|
||||||
|
return if Conf['Image Hover in Catalog']
|
||||||
|
$.on @nodes.thumb, 'mouseover', Index.onOver
|
||||||
onClick: (e) ->
|
onClick: (e) ->
|
||||||
return if e.button isnt 0
|
return if e.button isnt 0
|
||||||
thread = g.threads[@parentNode.dataset.fullID]
|
thread = g.threads[@parentNode.dataset.fullID]
|
||||||
@ -169,6 +171,28 @@ Index =
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
onOver: (e) ->
|
||||||
|
# 4chan's less than stellar CSS forces us to include a .post and .postInfo
|
||||||
|
# in order to have proper styling for the .nameBlock's content.
|
||||||
|
{nodes} = g.threads[@parentNode.dataset.fullID].OP
|
||||||
|
el = $.el 'div',
|
||||||
|
innerHTML: '<div class=post><div class=postInfo>'
|
||||||
|
className: 'thread-info'
|
||||||
|
hidden: true
|
||||||
|
$.add el.firstElementChild.firstElementChild, [
|
||||||
|
$('.nameBlock', nodes.info).cloneNode true
|
||||||
|
$.tn ' '
|
||||||
|
nodes.date.cloneNode true
|
||||||
|
]
|
||||||
|
$.add d.body, el
|
||||||
|
UI.hover
|
||||||
|
root: @
|
||||||
|
el: el
|
||||||
|
latestEvent: e
|
||||||
|
endEvents: 'mouseout'
|
||||||
|
offsetX: 15
|
||||||
|
offsetY: -20
|
||||||
|
setTimeout (-> el.hidden = false if el.parentNode), .25 * $.SECOND
|
||||||
toggleHide: (thread) ->
|
toggleHide: (thread) ->
|
||||||
$.rm thread.catalogView.nodes.root
|
$.rm thread.catalogView.nodes.root
|
||||||
if Index.showHiddenThreads
|
if Index.showHiddenThreads
|
||||||
|
|||||||
@ -273,7 +273,7 @@ UI = do ->
|
|||||||
$.off d, 'mouseup', @up
|
$.off d, 'mouseup', @up
|
||||||
$.set "#{@id}.position", @style.cssText
|
$.set "#{@id}.position", @style.cssText
|
||||||
|
|
||||||
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) ->
|
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb, offsetX, offsetY}) ->
|
||||||
o = {
|
o = {
|
||||||
root
|
root
|
||||||
el
|
el
|
||||||
@ -283,14 +283,17 @@ UI = do ->
|
|||||||
latestEvent
|
latestEvent
|
||||||
clientHeight: doc.clientHeight
|
clientHeight: doc.clientHeight
|
||||||
clientWidth: doc.clientWidth
|
clientWidth: doc.clientWidth
|
||||||
|
offsetX: offsetX or 45
|
||||||
|
offsetY: offsetY or -120
|
||||||
}
|
}
|
||||||
o.hover = hover.bind o
|
o.hover = hover.bind o
|
||||||
o.hoverend = hoverend.bind o
|
o.hoverend = hoverend.bind o
|
||||||
|
|
||||||
$.asap ->
|
if asapTest
|
||||||
!el.parentNode or asapTest()
|
$.asap ->
|
||||||
, ->
|
!el.parentNode or asapTest()
|
||||||
o.hover o.latestEvent if el.parentNode
|
, ->
|
||||||
|
o.hover o.latestEvent if el.parentNode
|
||||||
|
|
||||||
$.on root, endEvents, o.hoverend
|
$.on root, endEvents, o.hoverend
|
||||||
$.on root, 'mousemove', o.hover
|
$.on root, 'mousemove', o.hover
|
||||||
@ -304,7 +307,7 @@ UI = do ->
|
|||||||
height = @el.offsetHeight
|
height = @el.offsetHeight
|
||||||
{clientX, clientY} = e
|
{clientX, clientY} = e
|
||||||
|
|
||||||
top = clientY - 120
|
top = clientY + @offsetY
|
||||||
top = if @clientHeight <= height or top <= 0
|
top = if @clientHeight <= height or top <= 0
|
||||||
0
|
0
|
||||||
else if top + height >= @clientHeight
|
else if top + height >= @clientHeight
|
||||||
@ -313,9 +316,9 @@ UI = do ->
|
|||||||
top
|
top
|
||||||
|
|
||||||
[left, right] = if clientX <= @clientWidth / 2
|
[left, right] = if clientX <= @clientWidth / 2
|
||||||
[clientX + 45 + 'px', null]
|
[clientX + @offsetX + 'px', null]
|
||||||
else
|
else
|
||||||
[null, @clientWidth - clientX + 45 + 'px']
|
[null, @clientWidth - clientX + @offsetX + 'px']
|
||||||
|
|
||||||
{style} = @
|
{style} = @
|
||||||
style.top = top + 'px'
|
style.top = top + 'px'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user