diff --git a/4chan_x.user.js b/4chan_x.user.js index 1938f3528..5502d2572 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -652,7 +652,7 @@ } }, parse: function(req, pathname, thread, a) { - var body, br, link, next, quote, reply, table, tables, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _results; + var body, br, href, link, next, quote, reply, table, tables, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _results; if (req.status !== 200) { a.textContent = "" + req.status + " " + req.statusText; $.unbind(a, 'click', expandThread.cb.toggle); @@ -672,8 +672,10 @@ _ref2 = $$('a.quotelink', reply); for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { quote = _ref2[_j]; - if (quote.getAttribute('href') === quote.hash) { + if ((href = quote.getAttribute('href')) === quote.hash) { quote.pathname = pathname; + } else if (href !== quote.href) { + quote.href = "res/" + href; } } link = $('a.quotejs', reply); @@ -2289,7 +2291,7 @@ return $.addClass(this, 'inlined'); }, parse: function(req, pathname, id, threadID, inline) { - var body, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; + var body, href, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; if (!inline.parentNode) { return; } @@ -2317,8 +2319,10 @@ _ref2 = $$('a.quotelink', newInline); for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { quote = _ref2[_j]; - if (quote.getAttribute('href') === quote.hash) { + if ((href = quote.getAttribute('href')) === quote.hash) { quote.pathname = pathname; + } else if (!g.REPLY && href !== quote.href) { + quote.href = "res/" + href; } } link = $('a.quotejs', newInline); diff --git a/changelog b/changelog index 7613dffb6..dc615e9b2 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ master - mayhem do not display inlined quotes within the quote preview + fix cross threads quotes in expanded threads or inlined cross quotes 2.19.3 - mayhem diff --git a/script.coffee b/script.coffee index 96ce86b7c..afbc0161c 100644 --- a/script.coffee +++ b/script.coffee @@ -476,8 +476,10 @@ expandThread = for reply in $$ 'td[id]', body for quote in $$ 'a.quotelink', reply - if quote.getAttribute('href') is quote.hash + if (href = quote.getAttribute('href')) is quote.hash #add pathname to normal quotes quote.pathname = pathname + else if href isnt quote.href #fix x-thread links, not x-board ones + quote.href = "res/#{href}" link = $ 'a.quotejs', reply link.href = "res/#{thread.firstChild.id}##{reply.id}" link.nextSibling.href = "res/#{thread.firstChild.id}#q#{reply.id}" @@ -1786,8 +1788,10 @@ quoteInline = break newInline = quoteInline.table id, html for quote in $$ 'a.quotelink', newInline - if quote.getAttribute('href') is quote.hash + if (href = quote.getAttribute('href')) is quote.hash #add pathname to normal quotes quote.pathname = pathname + else if !g.REPLY and href isnt quote.href #fix x-thread links, not x-board ones + quote.href = "res/#{href}" link = $ 'a.quotejs', newInline link.href = "#{pathname}##{id}" link.nextSibling.href = "#{pathname}#q#{id}"