diff --git a/4chan_x.js b/4chan_x.js index 93a4f903c..61308ab92 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1869,19 +1869,19 @@ return $.removeClass(el, 'qphl'); }, mouseover: function(e) { - var el, id, qp, quote, replyID, threadID, url, _i, _len, _ref; + var el, id, qp, quote, replyID, threadID, url, _i, _len, _ref, _ref2; id = this.hash.slice(1); qp = $('#qp'); if (el = d.getElementById(id)) { qp.innerHTML = el.innerHTML; $.addClass(el, 'qphl'); if (this.className === 'backlink') { - replyID = this.parentNode.id; - _ref = $$('a.quotelink', qp); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - quote = _ref[_i]; + replyID = (_ref = $.x('ancestor::*[@id][1]', this)) != null ? _ref.id.match(/\d+/)[0] : void 0; + _ref2 = $$('a.quotelink', qp); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + quote = _ref2[_i]; if (quote.hash.slice(1) === replyID) { - quote.className = 'backlink'; + quote.className = 'forwardlink'; } } } diff --git a/script.coffee b/script.coffee index db25f653f..bc091a36a 100644 --- a/script.coffee +++ b/script.coffee @@ -1486,10 +1486,10 @@ quotePreview = qp.innerHTML = el.innerHTML $.addClass el, 'qphl' if @className is 'backlink' - replyID = @parentNode.id + replyID = $.x('ancestor::*[@id][1]', @)?.id.match(/\d+/)[0] for quote in $$ 'a.quotelink', qp if quote.hash[1..] is replyID - quote.className = 'backlink' + quote.className = 'forwardlink' else qp.innerHTML = "Loading #{id}..." threadID = @pathname.split('/').pop() or $.x('ancestor::div[@class="thread"]/div', @).id