From 605363c3632a14b16553c281c8f5de067c7212e0 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 10 Feb 2012 21:01:46 +0100 Subject: [PATCH] Prevent quote previewing on already inlined quotes. --- 4chan_x.user.js | 7 +++++-- script.coffee | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index dc4db8fe5..b371b8366 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2950,6 +2950,7 @@ }, mouseover: function(e) { var el, id, qp, quote, replyID, threadID, _i, _len, _ref; + if (/\binlined\b/.test(this.className)) return; qp = ui.el = $.el('div', { id: 'qp', className: 'reply dialog' @@ -2976,14 +2977,16 @@ ui.hover(e); } $.on(this, 'mousemove', ui.hover); - return $.on(this, 'mouseout', quotePreview.mouseout); + $.on(this, 'mouseout', quotePreview.mouseout); + return $.on(this, 'click', quotePreview.mouseout); }, mouseout: function() { var el; if (el = $.id(this.hash.slice(1))) $.removeClass(el, 'qphl'); ui.hoverend(); $.off(this, 'mousemove', ui.hover); - return $.off(this, 'mouseout', quotePreview.mouseout); + $.off(this, 'mouseout', quotePreview.mouseout); + return $.off(this, 'click', quotePreview.mouseout); }, parse: function(req, id, threadID) { var body, html, op, qp, reply, _i, _len, _ref; diff --git a/script.coffee b/script.coffee index 82f5c32fd..79a36d02c 100644 --- a/script.coffee +++ b/script.coffee @@ -2316,6 +2316,7 @@ quotePreview = $.on quote, 'mouseover', quotePreview.mouseover if quote.hash return mouseover: (e) -> + return if /\binlined\b/.test @className qp = ui.el = $.el 'div', id: 'qp' className: 'reply dialog' @@ -2337,12 +2338,14 @@ quotePreview = ui.hover e $.on @, 'mousemove', ui.hover $.on @, 'mouseout', quotePreview.mouseout + $.on @, 'click', quotePreview.mouseout mouseout: -> if el = $.id @hash[1..] $.removeClass el, 'qphl' ui.hoverend() $.off @, 'mousemove', ui.hover $.off @, 'mouseout', quotePreview.mouseout + $.off @, 'click', quotePreview.mouseout parse: (req, id, threadID) -> return unless (qp = ui.el) and (qp.innerHTML is "Loading #{id}...")