get new hover working in catalog
Conflicts: builds/4chan-X.user.js builds/crx/script.js src/General/UI.coffee src/Images/ImageHover.coffee
This commit is contained in:
parent
74ef633fd7
commit
0f770459c0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -308,7 +308,7 @@ UI = do ->
|
||||
$.off d, 'mouseup', @up
|
||||
$.set "#{@id}.position", @style.cssText
|
||||
|
||||
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) ->
|
||||
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb, noRemove}) ->
|
||||
o = {
|
||||
root
|
||||
el
|
||||
@ -318,6 +318,7 @@ UI = do ->
|
||||
latestEvent
|
||||
clientHeight: doc.clientHeight
|
||||
clientWidth: doc.clientWidth
|
||||
noRemove
|
||||
}
|
||||
o.hover = hover.bind o
|
||||
o.hoverend = hoverend.bind o
|
||||
@ -333,7 +334,7 @@ UI = do ->
|
||||
$.on root, 'mousemove', o.hover
|
||||
<% if (type === 'userscript') { %>
|
||||
# Workaround for https://github.com/MayhemYDG/4chan-x/issues/377
|
||||
o.workaround = (e) -> o.hoverend() unless root.contains e.target
|
||||
o.workaround = (e) -> o.hoverend(e) unless root.contains e.target
|
||||
$.on doc, 'mousemove', o.workaround
|
||||
<% } %>
|
||||
|
||||
@ -362,7 +363,7 @@ UI = do ->
|
||||
|
||||
hoverend = (e) ->
|
||||
return if e.type is 'keydown' and e.keyCode isnt 13 or e.target.nodeName is "TEXTAREA"
|
||||
$.rm @el if @el.parentNode is Header.hover
|
||||
$.rm @el unless @noRemove
|
||||
$.off @root, @endEvents, @hoverend
|
||||
$.off d, 'keydown', @hoverend
|
||||
$.off @root, 'mousemove', @hover
|
||||
|
||||
@ -713,10 +713,15 @@ span.hide-announcement {
|
||||
/* File */
|
||||
.fileText:hover .fntrunc,
|
||||
.fileText:not(:hover) .fnfull,
|
||||
.expanded-image > .post > .file > .fileThumb > img[data-md5],
|
||||
:not(.expanded-image) > .post > .file .full-image:not(#ihover) {
|
||||
.expanded-image > .post > .file > .fileThumb > img[data-md5] {
|
||||
display: none;
|
||||
}
|
||||
.full-image:not(#ihover) {
|
||||
display: none;
|
||||
}
|
||||
.expanded-image > .post > .file .full-image:not(#ihover) {
|
||||
display: inline;
|
||||
}
|
||||
.expanding {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ ImageExpand =
|
||||
video.pause()
|
||||
for eventName, cb of ImageExpand.videoCB
|
||||
$.off video, eventName, cb
|
||||
TrashQueue.add video
|
||||
TrashQueue.add video, post
|
||||
post.file.videoControls?.map($.rm)
|
||||
delete post.file.videoControls
|
||||
$.rmClass post.nodes.root, 'expanded-image'
|
||||
|
||||
@ -20,7 +20,10 @@ ImageHover =
|
||||
src: post.file.URL
|
||||
post.file.fullImage = el
|
||||
{thumb} = post.file
|
||||
$.after (if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb), el
|
||||
if d.body.contains thumb
|
||||
$.after (if isVideo and Conf['Show Controls'] then thumb.parentNode else thumb), el
|
||||
else
|
||||
$.add Header.hover, el
|
||||
el.id = 'ihover'
|
||||
el.dataset.fullID = post.fullID
|
||||
if isVideo
|
||||
@ -35,10 +38,11 @@ ImageHover =
|
||||
latestEvent: e
|
||||
endEvents: 'mouseout click'
|
||||
asapTest: -> el[naturalHeight]
|
||||
noRemove: true
|
||||
cb: ->
|
||||
if isVideo
|
||||
el.pause()
|
||||
TrashQueue.add el
|
||||
TrashQueue.add el, post
|
||||
el.removeAttribute 'id'
|
||||
$.on el, 'error', ImageHover.error
|
||||
error: ->
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
TrashQueue =
|
||||
init: -> return
|
||||
|
||||
add: (video) ->
|
||||
if video isnt @killNext and @killNext
|
||||
post = Get.postFromNode @killNext
|
||||
delete post?.file?.fullImage
|
||||
add: (video, post) ->
|
||||
if @killNext and video isnt @killNext
|
||||
delete @killNextPost?.file?.fullImage
|
||||
$.rm @killNext
|
||||
@killNext = video
|
||||
@killNextPost = post
|
||||
|
||||
remove: (video) ->
|
||||
if video is @killNext
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user