fix quoting

This commit is contained in:
James Campos 2011-05-29 23:06:17 -07:00
parent 46ca280d4a
commit d8f13d1129
2 changed files with 26 additions and 19 deletions

View File

@ -1731,7 +1731,8 @@
_ref = $$('a.quotelink', root); _ref = $$('a.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
if (!(qid = quote.hash.slice(1))) { qid = quote.hash.slice(1) || quote.getAttribute('data-href').match(/\d+$/)[0];
if (!qid) {
continue; continue;
} }
if (!opbl && qid === tid) { if (!opbl && qid === tid) {
@ -1774,7 +1775,7 @@
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
if (!quote.hash) { if (!(quote.hash || quote.getAttribute('data-href'))) {
continue; continue;
} }
quote.removeAttribute('onclick'); quote.removeAttribute('onclick');
@ -1876,11 +1877,13 @@
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
if (!quote.hash) { if (!(quote.hash || quote.getAttribute('data-href'))) {
continue; continue;
} }
quote.setAttribute('data-href', quote.href); if (quote.href) {
quote.removeAttribute('href'); quote.setAttribute('data-href', quote.href);
quote.removeAttribute('href');
}
$.bind(quote, 'mouseover', quotePreview.mouseover); $.bind(quote, 'mouseover', quotePreview.mouseover);
$.bind(quote, 'mousemove', ui.hover); $.bind(quote, 'mousemove', ui.hover);
$.bind(quote, 'mouseout', ui.hoverend); $.bind(quote, 'mouseout', ui.hoverend);
@ -1911,7 +1914,7 @@
_ref2 = $$('a.quotelink', qp); _ref2 = $$('a.quotelink', qp);
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
quote = _ref2[_i]; quote = _ref2[_i];
if (quote.hash.slice(1) === replyID) { if (quote.getAttribute('data-href').match(/\d+$/)[0] === replyID) {
quote.className = 'forwardlink'; quote.className = 'forwardlink';
} }
} }
@ -1960,7 +1963,7 @@
return g.callbacks.push(quoteOP.node); return g.callbacks.push(quoteOP.node);
}, },
node: function(root) { node: function(root) {
var quote, tid, _i, _len, _ref, _results; var qid, quote, tid, _i, _len, _ref, _results;
if (root.className === 'inline') { if (root.className === 'inline') {
return; return;
} }
@ -1969,7 +1972,8 @@
_results = []; _results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
_results.push(quote.hash.slice(1) === tid ? quote.innerHTML += '&nbsp;(OP)' : void 0); qid = quote.hash.slice(1) || quote.getAttribute('data-href').match(/\d+/)[0];
_results.push(qid === tid ? quote.innerHTML += '&nbsp;(OP)' : void 0);
} }
return _results; return _results;
} }
@ -2559,7 +2563,7 @@
cursor: pointer;\ cursor: pointer;\
}\ }\
\ \
.backlink, .quotelink {\ .backlink, .quotelink, .forwardlink {\
text-decoration: underline;\ text-decoration: underline;\
}\ }\
.new {\ .new {\

View File

@ -1387,7 +1387,8 @@ quoteBacklink =
tid = g.THREAD_ID or root.parentNode.firstChild.id tid = g.THREAD_ID or root.parentNode.firstChild.id
opbl = $.config 'OP Backlinks' opbl = $.config 'OP Backlinks'
for quote in $$ 'a.quotelink', root for quote in $$ 'a.quotelink', root
continue unless qid = quote.hash[1..] qid = quote.hash[1..] or quote.getAttribute('data-href').match(/\d+$/)[0]
continue unless qid
#don't backlink the op #don't backlink the op
continue if !opbl and qid is tid continue if !opbl and qid is tid
#duplicate quotes get overwritten #duplicate quotes get overwritten
@ -1412,7 +1413,7 @@ quoteInline =
g.callbacks.push quoteInline.node g.callbacks.push quoteInline.node
node: (root) -> node: (root) ->
for quote in $$ 'a.quotelink, a.backlink', root for quote in $$ 'a.quotelink, a.backlink', root
continue unless quote.hash continue unless quote.hash or quote.getAttribute 'data-href'
quote.removeAttribute 'onclick' quote.removeAttribute 'onclick'
$.bind quote, 'click', quoteInline.toggle $.bind quote, 'click', quoteInline.toggle
toggle: (e) -> toggle: (e) ->
@ -1479,11 +1480,12 @@ quotePreview =
$.append d.body, preview $.append d.body, preview
node: (root) -> node: (root) ->
for quote in $$ 'a.quotelink, a.backlink', root for quote in $$ 'a.quotelink, a.backlink', root
continue unless quote.hash continue unless quote.hash or quote.getAttribute 'data-href'
# XXX dataset requires firefox 6.0+ if quote.href
# quote.dataset.href = quote.href # XXX dataset requires firefox 6.0+
quote.setAttribute 'data-href', quote.href # quote.dataset.href = quote.href
quote.removeAttribute 'href' quote.setAttribute 'data-href', quote.href
quote.removeAttribute 'href'
$.bind quote, 'mouseover', quotePreview.mouseover $.bind quote, 'mouseover', quotePreview.mouseover
$.bind quote, 'mousemove', ui.hover $.bind quote, 'mousemove', ui.hover
$.bind quote, 'mouseout', ui.hoverend $.bind quote, 'mouseout', ui.hoverend
@ -1502,7 +1504,7 @@ quotePreview =
if @className is 'backlink' if @className is 'backlink'
replyID = $.x('ancestor::*[@id][1]', @)?.id.match(/\d+/)[0] replyID = $.x('ancestor::*[@id][1]', @)?.id.match(/\d+/)[0]
for quote in $$ 'a.quotelink', qp for quote in $$ 'a.quotelink', qp
if quote.hash[1..] is replyID if quote.getAttribute('data-href').match(/\d+$/)[0] is replyID
quote.className = 'forwardlink' quote.className = 'forwardlink'
else else
qp.innerHTML = "Loading #{id}..." qp.innerHTML = "Loading #{id}..."
@ -1537,7 +1539,8 @@ quoteOP =
return if root.className is 'inline' return if root.className is 'inline'
tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id
for quote in $$ 'a.quotelink', root for quote in $$ 'a.quotelink', root
if quote.hash[1..] is tid qid = quote.hash[1..] or quote.getAttribute('data-href').match(/\d+/)[0]
if qid is tid
quote.innerHTML += '&nbsp;(OP)' quote.innerHTML += '&nbsp;(OP)'
reportButton = reportButton =
@ -1969,7 +1972,7 @@ main =
cursor: pointer; cursor: pointer;
} }
.backlink, .quotelink { .backlink, .quotelink, .forwardlink {
text-decoration: underline; text-decoration: underline;
} }
.new { .new {