diff --git a/4chan_x.js b/4chan_x.js index fc4efb639..c2659cf4c 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1738,6 +1738,9 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; + if (!quote.hash) { + continue; + } quote.removeAttribute('onclick'); _results.push($.bind(quote, 'click', quoteInline.toggle)); } @@ -1745,9 +1748,7 @@ }, toggle: function(e) { var el, id, inline, req, root, table, threadID; - if (!(id = this.hash.slice(1))) { - return; - } + id = this.hash.slice(1); e.preventDefault(); root = $.x('ancestor::td[1]', this); if (table = $("#i" + id, root)) { @@ -1837,6 +1838,9 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; + if (!quote.hash) { + continue; + } $.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mousemove', ui.hover); $.bind(quote, 'mouseout', ui.hoverend); @@ -1853,9 +1857,7 @@ }, mouseover: function(e) { var el, id, qp, quote, replyID, req, threadID, _i, _len, _ref; - if (!(id = this.hash.slice(1))) { - return; - } + id = this.hash.slice(1); qp = $('#qp'); if (el = d.getElementById(id)) { qp.innerHTML = el.innerHTML; diff --git a/script.coffee b/script.coffee index 18ccd14e3..5baf6c58a 100644 --- a/script.coffee +++ b/script.coffee @@ -1394,10 +1394,11 @@ quoteInline = g.callbacks.push quoteInline.node node: (root) -> for quote in $$ 'a.quotelink, a.backlink', root + continue unless quote.hash quote.removeAttribute 'onclick' $.bind quote, 'click', quoteInline.toggle toggle: (e) -> - return unless id = @hash[1..] + id = @hash[1..] e.preventDefault() root = $.x 'ancestor::td[1]', @ if table = $ "#i#{id}", root @@ -1462,6 +1463,7 @@ quotePreview = $.append d.body, preview node: (root) -> for quote in $$ 'a.quotelink, a.backlink', root + continue unless quote.hash $.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mousemove', ui.hover $.bind quote, 'mouseout', ui.hoverend @@ -1470,7 +1472,7 @@ quotePreview = return unless el = d.getElementById @hash[1..] $.removeClass el, 'qphl' mouseover: (e) -> - return unless id = @hash[1..] + id = @hash[1..] qp = $ '#qp' if el = d.getElementById id qp.innerHTML = el.innerHTML