From abd4aea3c1bc8105ae6fd36753c3a141c6ef62ca Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 20 Jul 2011 20:56:52 +0200 Subject: [PATCH] Shave a line/selector. Chrome bug comment. --- 4chan_x.user.js | 16 ++++++++-------- script.coffee | 15 +++++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 11c03e822..4948542fe 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2449,11 +2449,10 @@ }; imageHover = { init: function() { - var img; - img = $.el('img', { + imageHover.img = $.el('img', { id: 'iHover' }); - $.append(d.body, img); + $.append(d.body, imageHover.img); return g.callbacks.push(imageHover.node); }, node: function(root) { @@ -2466,11 +2465,12 @@ return $.bind(thumb, 'mouseout', ui.hoverend); }, mouseover: function(e) { - var el; - el = $('#iHover'); - el.src = null; - el.src = this.parentNode.href; - return ui.el = el; + /* + img.src = null doesn't work on Chrome + http://code.google.com/p/chromium/issues/detail?id=36142 + */ imageHover.img.src = null; + imageHover.img.src = this.parentNode.href; + return ui.el = imageHover.img; } }; imgPreloading = { diff --git a/script.coffee b/script.coffee index 70b84b433..7c65de9f3 100644 --- a/script.coffee +++ b/script.coffee @@ -1850,8 +1850,8 @@ nodeInserted = (e) -> imageHover = init: -> - img = $.el 'img', id: 'iHover' - $.append d.body, img + imageHover.img = $.el 'img', id: 'iHover' + $.append d.body, imageHover.img g.callbacks.push imageHover.node node: (root) -> return unless thumb = $ 'img[md5]', root @@ -1859,10 +1859,13 @@ imageHover = $.bind thumb, 'mousemove', ui.hover $.bind thumb, 'mouseout', ui.hoverend mouseover: (e) -> - el = $ '#iHover' - el.src = null - el.src = @parentNode.href - ui.el = el + ### + img.src = null doesn't work on Chrome + http://code.google.com/p/chromium/issues/detail?id=36142 + ### + imageHover.img.src = null + imageHover.img.src = @parentNode.href + ui.el = imageHover.img imgPreloading = init: ->