diff --git a/4chan_x.user.js b/4chan_x.user.js index fa98213d7..2c10db926 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -624,7 +624,7 @@ } }, parse: function(req, pathname, thread, a) { - var body, br, next, quote, table, tables, _i, _j, _len, _len2, _ref, _results; + var body, br, 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); @@ -638,18 +638,25 @@ body = $.el('body', { innerHTML: req.responseText }); - _ref = $$('a.quotelink', body); + _ref = $$('td[id]', body); for (_i = 0, _len = _ref.length; _i < _len; _i++) { - quote = _ref[_i]; - if (quote.getAttribute('href') === quote.hash) { - quote.pathname = pathname; + reply = _ref[_i]; + _ref2 = $$('a.quotelink', reply); + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + quote = _ref2[_j]; + if (quote.getAttribute('href') === quote.hash) { + quote.pathname = pathname; + } } + link = $('a.quotejs', reply); + link.href = "res/" + thread.firstChild.id + "#" + reply.id; + link.nextSibling.href = "res/" + thread.firstChild.id + "#q" + reply.id; } tables = $$('form[name=delform] table', body); tables.pop(); _results = []; - for (_j = 0, _len2 = tables.length; _j < _len2; _j++) { - table = tables[_j]; + for (_k = 0, _len3 = tables.length; _k < _len3; _k++) { + table = tables[_k]; _results.push($.before(br, table)); } return _results; @@ -2736,7 +2743,7 @@ $.bind(form, 'submit', qr.submit); } threading.init(); - if ((id = location.hash.slice(1)) && !$.id(id)) { + if ((id = location.hash.slice(1)) && !$.id(id) && !/\D/.test(id)) { scrollTo(0, d.body.scrollHeight); } if (conf['Auto Noko']) { diff --git a/changelog b/changelog index de150fb47..1ad01c264 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ github +- mayhem: + - fix post links in expanded threads - aeosynth: - only auto scroll focused tabs - quote inlining: only work on unmodified left-click diff --git a/script.coffee b/script.coffee index 28814c9c9..30f6ad5d1 100644 --- a/script.coffee +++ b/script.coffee @@ -452,9 +452,13 @@ expandThread = body = $.el 'body', innerHTML: req.responseText - for quote in $$ 'a.quotelink', body - if quote.getAttribute('href') is quote.hash - quote.pathname = pathname + for reply in $$ 'td[id]', body + for quote in $$ 'a.quotelink', reply + if quote.getAttribute('href') is quote.hash + quote.pathname = pathname + link = $ 'a.quotejs', reply + link.href = "res/#{thread.firstChild.id}##{reply.id}" + link.nextSibling.href = "res/#{thread.firstChild.id}#q#{reply.id}" tables = $$ 'form[name=delform] table', body tables.pop() for table in tables @@ -2124,7 +2128,7 @@ main = # scroll to bottom if post isn't found # thumbnail generation takes time - if (id = location.hash[1..]) and !$.id id + if (id = location.hash[1..]) and !$.id(id) and !/\D/.test id scrollTo 0, d.body.scrollHeight if conf['Auto Noko']