diff --git a/4chan_x.user.js b/4chan_x.user.js index 7a743b9fd..d6b36efb7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3313,16 +3313,21 @@ node: function(root) { var thumb; if (!(thumb = $('img[md5]', root))) return; - $.on(thumb, 'mouseover', imgHover.mouseover); - $.on(thumb, 'mousemove', ui.hover); - return $.on(thumb, 'mouseout', ui.hoverend); + return $.on(thumb, 'mouseover', imgHover.mouseover); }, mouseover: function() { ui.el = $.el('img', { id: 'ihover', src: this.parentNode.href }); + $.on(this, 'mousemove', ui.hover); + $.on(this, 'mouseout', imgHover.mouseout); return $.add(d.body, ui.el); + }, + mouseout: function() { + ui.hoverend(); + $.off(this, 'mousemove', ui.hover); + return $.off(this, 'mouseout', imgHover.mouseout); } }; diff --git a/script.coffee b/script.coffee index beef4625c..df1bf358e 100644 --- a/script.coffee +++ b/script.coffee @@ -2612,13 +2612,17 @@ imgHover = node: (root) -> return unless thumb = $ 'img[md5]', root $.on thumb, 'mouseover', imgHover.mouseover - $.on thumb, 'mousemove', ui.hover - $.on thumb, 'mouseout', ui.hoverend mouseover: -> ui.el = $.el 'img' id: 'ihover' src: @parentNode.href + $.on @, 'mousemove', ui.hover + $.on @, 'mouseout', imgHover.mouseout $.add d.body, ui.el + mouseout: -> + ui.hoverend() + $.off @, 'mousemove', ui.hover + $.off @, 'mouseout', imgHover.mouseout imgGif = init: ->