Fix #377 with a workaround.

This commit is contained in:
Mayhem 2013-06-24 22:33:47 +02:00
parent 80afed86b6
commit a7346b6103

View File

@ -278,12 +278,12 @@ UI = do ->
hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) -> hoverstart = ({root, el, latestEvent, endEvents, asapTest, cb}) ->
o = { o = {
root: root root
el: el el
style: el.style style: el.style
cb: cb cb
endEvents: endEvents endEvents
latestEvent: latestEvent latestEvent
clientHeight: doc.clientHeight clientHeight: doc.clientHeight
clientWidth: doc.clientWidth clientWidth: doc.clientWidth
} }
@ -297,6 +297,11 @@ UI = do ->
$.on root, endEvents, o.hoverend $.on root, endEvents, o.hoverend
$.on root, 'mousemove', o.hover $.on root, 'mousemove', o.hover
<% if (type === 'userscript') { %>
# Workaround for https://github.com/MayhemYDG/4chan-x/issues/377
o.workaround = -> o.hoverend() unless doc.contains root
$.on doc, 'mousemove', o.workaround
<% } %>
hover = (e) -> hover = (e) ->
@latestEvent = e @latestEvent = e
height = @el.offsetHeight height = @el.offsetHeight
@ -323,6 +328,10 @@ UI = do ->
$.rm @el $.rm @el
$.off @root, @endEvents, @hoverend $.off @root, @endEvents, @hoverend
$.off @root, 'mousemove', @hover $.off @root, 'mousemove', @hover
<% if (type === 'userscript') { %>
# Workaround for https://github.com/MayhemYDG/4chan-x/issues/377
$.off doc, 'mousemove', @workaround
<% } %>
@cb.call @ if @cb @cb.call @ if @cb