diff --git a/4chan_x.js b/4chan_x.js index 8a2999551..0f59ea5a1 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -234,6 +234,9 @@ bot = top + height; el.style.top = ui.winHeight < height || top < 0 ? '0px' : bot > ui.winHeight ? ui.winHeight - height + 'px' : top + 'px'; return el.style.left = clientX + 45; + }, + hoverend: function(e) { + return $.hide(ui.el); } }; d = document; @@ -1684,7 +1687,7 @@ quote = _ref[_i]; $.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mousemove', ui.hover); - _results.push($.bind(quote, 'mouseout', quotePreview.mouseout)); + _results.push($.bind(quote, 'mouseout', ui.hoverend)); } return _results; }, @@ -1710,9 +1713,6 @@ $.show(qp); return ui.el = qp; }, - mouseout: function(e) { - return $.hide(ui.el); - }, get: function(id, threadID, innerHTML) { var body, html, reply, _i, _len, _ref; body = $.el('body', { @@ -1930,24 +1930,19 @@ thumb = _ref2[_i]; $.bind(thumb, 'mouseover', imageHover.cb.mouseover); $.bind(thumb, 'mousemove', ui.hover); - _results.push($.bind(thumb, 'mouseout', imageHover.cb.mouseout)); + _results.push($.bind(thumb, 'mouseout', ui.hoverend)); } return _results; }, mouseover: function(e) { var el; el = $('#iHover'); + el.src = null; el.src = this.parentNode.href; $.show(el); ui.el = el; ui.winHeight = d.body.clientHeight; return ui.winWidth = d.body.clientWidth; - }, - mouseout: function(e) { - var el; - el = ui.el; - $.hide(el); - return el.src = null; } } }; diff --git a/script.coffee b/script.coffee index 779aaa399..6c3714ff8 100644 --- a/script.coffee +++ b/script.coffee @@ -156,6 +156,8 @@ ui = else top + 'px' el.style.left = clientX + 45 + hoverend: (e) -> + $.hide ui.el #convenience d = document @@ -1345,7 +1347,7 @@ quotePreview = for quote in $$ 'a.quotelink', root $.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mousemove', ui.hover - $.bind quote, 'mouseout', quotePreview.mouseout + $.bind quote, 'mouseout', ui.hoverend mouseover: (e) -> id = @textContent.replace ">>", '' qp = $ '#qp' @@ -1364,8 +1366,6 @@ quotePreview = ) $.show qp ui.el = qp - mouseout: (e) -> - $.hide ui.el get: (id, threadID, innerHTML) -> body = $.el 'body', {innerHTML} @@ -1501,18 +1501,15 @@ imageHover = for thumb in $$ 'img[md5]', root $.bind thumb, 'mouseover', imageHover.cb.mouseover $.bind thumb, 'mousemove', ui.hover - $.bind thumb, 'mouseout', imageHover.cb.mouseout + $.bind thumb, 'mouseout', ui.hoverend mouseover: (e) -> el = $ '#iHover' + el.src = null el.src = @parentNode.href $.show el ui.el = el ui.winHeight = d.body.clientHeight ui.winWidth = d.body.clientWidth - mouseout: (e) -> - {el} = ui - $.hide el - el.src = null imgPreloading = init: ->