From a82665c9c12771b1859a79c198a5a6130bb07b49 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 28 May 2012 14:29:11 +0200 Subject: [PATCH] Fix #497 --- 4chan_x.user.js | 8 +++++--- script.coffee | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ff6c1308f..708a679a7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -256,6 +256,9 @@ } }, hoverend: function() { + if (!UI.el) { + return; + } $.rm(UI.el); return delete UI.el; } @@ -3207,9 +3210,7 @@ if (/\binlined\b/.test(this.className)) { return; } - if (qp = $.id('qp')) { - $.rm(qp); - } + UI.hoverend(); qp = UI.el = $.el('div', { id: 'qp', className: 'post reply dialog' @@ -3647,6 +3648,7 @@ return $.on(post.img, 'mouseover', ImageHover.mouseover); }, mouseover: function() { + UI.hoverend(); UI.el = $.el('img', { id: 'ihover', src: this.parentNode.href diff --git a/script.coffee b/script.coffee index 895d2d898..551306bf5 100644 --- a/script.coffee +++ b/script.coffee @@ -230,6 +230,7 @@ UI = style.right = clientWidth - clientX + 45 + 'px' hoverend: -> + return unless UI.el $.rm UI.el delete UI.el @@ -2431,8 +2432,10 @@ QuotePreview = return mouseover: (e) -> return if /\binlined\b/.test @className - if qp = $.id 'qp' - $.rm qp + + # Make sure to remove the previous UI.el + UI.hoverend() + qp = UI.el = $.el 'div', id: 'qp' className: 'post reply dialog' @@ -2771,6 +2774,9 @@ ImageHover = return unless post.img $.on post.img, 'mouseover', ImageHover.mouseover mouseover: -> + # Make sure to remove the previous UI.el + UI.hoverend() + UI.el = $.el 'img' id: 'ihover' src: @parentNode.href