Tiny fix in Quote Inlining.

This commit is contained in:
Nicolas Stepien 2012-09-04 02:55:30 +02:00
parent 264f03697b
commit 7837b15ac0
2 changed files with 20 additions and 6 deletions

View File

@ -1216,7 +1216,8 @@
},
rm: function(quotelink, board, threadID, postID) {
var el, inThreadID, inline, inlines, post, root, _i, _len, _ref;
root = $.x("following::div[@id='i" + postID + "'][1]", quotelink);
root = $.hasClass(quotelink, 'backlink') ? quotelink.parentNode.parentNode : $.x('ancestor-or-self::*[parent::blockquote][1]', quotelink);
root = $.x("following-sibling::div[@id='i" + postID + "'][1]", root);
$.rm(root);
if (!(el = root.firstElementChild)) {
return;
@ -1234,11 +1235,13 @@
for (_i = 0, _len = inlines.length; _i < _len; _i++) {
inline = inlines[_i];
_ref = Get.postDataFromLink(inline), board = _ref.board, threadID = _ref.threadID, postID = _ref.postID;
if (!(root = $.x("following::div[@id='i" + postID + "'][1]", inline).firstElementChild)) {
root = $.hasClass(inline, 'backlink') ? inline.parentNode.parentNode : $.x('ancestor-or-self::*[parent::blockquote][1]', inline);
root = $.x("following-sibling::div[@id='i" + postID + "'][1]", root);
if (!(el = root.firstElementChild)) {
continue;
}
post = g.posts["" + board + "." + postID];
post.rmClone(root.dataset.clone);
post.rmClone(el.dataset.clone);
if (Conf['Forward Hiding'] && board === g.BOARD.ID && threadID === inThreadID && $.hasClass(inline, 'backlink')) {
if (!--post.forwarded) {
delete post.forwarded;

View File

@ -1129,7 +1129,12 @@ QuoteInline =
rm: (quotelink, board, threadID, postID) ->
# Select the corresponding inlined quote, and remove it.
root = $.x "following::div[@id='i#{postID}'][1]", quotelink
root =
if $.hasClass quotelink, 'backlink'
quotelink.parentNode.parentNode
else
$.x 'ancestor-or-self::*[parent::blockquote][1]', quotelink
root = $.x "following-sibling::div[@id='i#{postID}'][1]", root
$.rm root
# Stop if it only contains text.
@ -1154,9 +1159,15 @@ QuoteInline =
inlines = $$ '.inlined', el
for inline in inlines
{board, threadID, postID} = Get.postDataFromLink inline
continue unless root = $.x("following::div[@id='i#{postID}'][1]", inline).firstElementChild
root =
if $.hasClass inline, 'backlink'
inline.parentNode.parentNode
else
$.x 'ancestor-or-self::*[parent::blockquote][1]', inline
root = $.x "following-sibling::div[@id='i#{postID}'][1]", root
continue unless el = root.firstElementChild
post = g.posts["#{board}.#{postID}"]
post.rmClone root.dataset.clone
post.rmClone el.dataset.clone
if Conf['Forward Hiding'] and
board is g.BOARD.ID and