From ba2720900741d3dfc2d3811677589d0fdc4e6f23 Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 30 May 2011 23:01:38 -0700 Subject: [PATCH] Revert "fix quoting" This reverts commit d8f13d1129821e01ab53be196e442d8eecc1f8de. --- 4chan_x.user.js | 22 +++++++++------------- script.coffee | 23 ++++++++++------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 9a43d342c..cd552762b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1731,8 +1731,7 @@ _ref = $$('a.quotelink', root); for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - qid = quote.hash.slice(1) || quote.getAttribute('data-href').match(/\d+$/)[0]; - if (!qid) { + if (!(qid = quote.hash.slice(1))) { continue; } if (!opbl && qid === tid) { @@ -1775,7 +1774,7 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash || quote.getAttribute('data-href'))) { + if (!quote.hash) { continue; } quote.removeAttribute('onclick'); @@ -1877,13 +1876,11 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - if (!(quote.hash || quote.getAttribute('data-href'))) { + if (!quote.hash) { continue; } - if (quote.href) { - quote.setAttribute('data-href', quote.href); - quote.removeAttribute('href'); - } + quote.setAttribute('data-href', quote.href); + quote.removeAttribute('href'); $.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mousemove', ui.hover); $.bind(quote, 'mouseout', ui.hoverend); @@ -1914,7 +1911,7 @@ _ref2 = $$('a.quotelink', qp); for (_i = 0, _len = _ref2.length; _i < _len; _i++) { quote = _ref2[_i]; - if (quote.getAttribute('data-href').match(/\d+$/)[0] === replyID) { + if (quote.hash.slice(1) === replyID) { quote.className = 'forwardlink'; } } @@ -1963,7 +1960,7 @@ return g.callbacks.push(quoteOP.node); }, node: function(root) { - var qid, quote, tid, _i, _len, _ref, _results; + var quote, tid, _i, _len, _ref, _results; if (root.className === 'inline') { return; } @@ -1972,8 +1969,7 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { quote = _ref[_i]; - qid = quote.hash.slice(1) || quote.getAttribute('data-href').match(/\d+/)[0]; - _results.push(qid === tid ? quote.innerHTML += ' (OP)' : void 0); + _results.push(quote.hash.slice(1) === tid ? quote.innerHTML += ' (OP)' : void 0); } return _results; } @@ -2563,7 +2559,7 @@ cursor: pointer;\ }\ \ - .backlink, .quotelink, .forwardlink {\ + .backlink, .quotelink {\ text-decoration: underline;\ }\ .new {\ diff --git a/script.coffee b/script.coffee index e50f0e3e0..a1b9fdb4d 100644 --- a/script.coffee +++ b/script.coffee @@ -1387,8 +1387,7 @@ quoteBacklink = tid = g.THREAD_ID or root.parentNode.firstChild.id opbl = $.config 'OP Backlinks' for quote in $$ 'a.quotelink', root - qid = quote.hash[1..] or quote.getAttribute('data-href').match(/\d+$/)[0] - continue unless qid + continue unless qid = quote.hash[1..] #don't backlink the op continue if !opbl and qid is tid #duplicate quotes get overwritten @@ -1413,7 +1412,7 @@ quoteInline = g.callbacks.push quoteInline.node node: (root) -> for quote in $$ 'a.quotelink, a.backlink', root - continue unless quote.hash or quote.getAttribute 'data-href' + continue unless quote.hash quote.removeAttribute 'onclick' $.bind quote, 'click', quoteInline.toggle toggle: (e) -> @@ -1480,12 +1479,11 @@ quotePreview = $.append d.body, preview node: (root) -> for quote in $$ 'a.quotelink, a.backlink', root - continue unless quote.hash or quote.getAttribute 'data-href' - if quote.href - # XXX dataset requires firefox 6.0+ - # quote.dataset.href = quote.href - quote.setAttribute 'data-href', quote.href - quote.removeAttribute 'href' + continue unless quote.hash + # XXX dataset requires firefox 6.0+ + # quote.dataset.href = quote.href + quote.setAttribute 'data-href', quote.href + quote.removeAttribute 'href' $.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mousemove', ui.hover $.bind quote, 'mouseout', ui.hoverend @@ -1504,7 +1502,7 @@ quotePreview = if @className is 'backlink' replyID = $.x('ancestor::*[@id][1]', @)?.id.match(/\d+/)[0] for quote in $$ 'a.quotelink', qp - if quote.getAttribute('data-href').match(/\d+$/)[0] is replyID + if quote.hash[1..] is replyID quote.className = 'forwardlink' else qp.innerHTML = "Loading #{id}..." @@ -1539,8 +1537,7 @@ quoteOP = return if root.className is 'inline' tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id for quote in $$ 'a.quotelink', root - qid = quote.hash[1..] or quote.getAttribute('data-href').match(/\d+/)[0] - if qid is tid + if quote.hash[1..] is tid quote.innerHTML += ' (OP)' reportButton = @@ -1972,7 +1969,7 @@ main = cursor: pointer; } - .backlink, .quotelink, .forwardlink { + .backlink, .quotelink { text-decoration: underline; } .new {