Fix duplicate IDs from inlined quotes. #533

This commit is contained in:
ccd0 2015-12-13 11:17:50 -08:00
parent 4c83b284cd
commit 90b16fc2ab
3 changed files with 6 additions and 3 deletions

View File

@ -428,7 +428,7 @@ Header =
history.replaceState {}, '' unless history.state
hash = @location.hash[1..]
return unless /^p\d+$/.test(hash) and post = $.id hash
return unless /^\d*p\d+$/.test(hash) and (post = $.id hash)
return if (Get.postFromRoot post).isHidden
$.queueTask -> Header.scrollTo post

View File

@ -52,7 +52,6 @@ QuoteInline =
add: (quotelink, boardID, threadID, postID, context, quoter) ->
isBacklink = $.hasClass quotelink, 'backlink'
inline = $.el 'div',
id: "i#{postID}"
className: 'inline'
root = QuoteInline.findRoot(quotelink, isBacklink)
$.after root, inline
@ -80,7 +79,7 @@ QuoteInline =
isBacklink = $.hasClass quotelink, 'backlink'
# Select the corresponding inlined quote, and remove it.
root = QuoteInline.findRoot quotelink, isBacklink
root = $.x "following-sibling::div[@id='i#{postID}'][1]", root
root = $.x "following-sibling::div[div/@data-full-i-d='#{boardID}.#{postID}'][1]", root
qroot = $.x 'ancestor::*[contains(@class,"postContainer")][1]', root
$.rm root

View File

@ -9,6 +9,10 @@ class Clone extends Post
@cloneWithoutVideo nodes.root
else
nodes.root.cloneNode true
Clone.prefix or= 0
for node in [root, $$('[id]', root)...]
node.id = Clone.prefix + node.id
Clone.prefix++
post = $ '.post', root
info = $ '.postInfo', post
@nodes =