File:
#{file.timestamp}" +
"-(#{fileSize}, #{fileDims}#{
if file.isSpoiler
''
@@ -162,7 +162,7 @@ Build =
",
#{shortFilename}"
}" + ")
"
else
fileHTML = ''
@@ -186,7 +186,7 @@ Build =
id: "pc#{postID}"
className: "postContainer #{if isOP then 'op' else 'reply'}Container"
innerHTML: \
- (if isOP then '' else "
" +
+ "
" +
"
" +
"
#{subject or ''} " +
"
" +
@@ -219,7 +219,7 @@ Build =
(if isOP then '' else fileHTML) +
- "#{comment or ''}
" +
+ "#{comment or ''}
" +
''
diff --git a/src/General/Get.coffee b/src/General/Get.coffee
index afcdbc6e2..82eccdabb 100644
--- a/src/General/Get.coffee
+++ b/src/General/Get.coffee
@@ -12,12 +12,8 @@ Get =
threadFromNode: (node) ->
Get.threadFromRoot $.x 'ancestor::div[@class="thread"]', node
postFromRoot: (root) ->
- link = $ 'a[title="Highlight this post"]', root
- boardID = link.pathname.split('/')[1]
- postID = link.hash[2..]
- index = root.dataset.clone
- post = g.posts["#{boardID}.#{postID}"]
- if index then post.clones[index] else post
+ post = g.posts[root.dataset.fullID]
+ if index = root.dataset.clone then post.clones[index] else post
postFromNode: (node) ->
Get.postFromRoot $.x 'ancestor::div[contains(@class,"postContainer")][1]', node
contextFromNode: (node) ->
diff --git a/src/General/Header.coffee b/src/General/Header.coffee
index 74eb9648a..9f072a555 100644
--- a/src/General/Header.coffee
+++ b/src/General/Header.coffee
@@ -266,7 +266,7 @@ Header =
hashScroll: ->
hash = @location.hash[1..]
return unless /^p\d+$/.test(hash) and post = $.id hash
- return if (Get.postFromRoot post).isHidden
+ return if (Get.postFromNode post).isHidden
Header.scrollTo post
scrollTo: (root, down, needed) ->
if down
diff --git a/src/General/Post.coffee b/src/General/Post.coffee
index 7591ed653..f2db77261 100644
--- a/src/General/Post.coffee
+++ b/src/General/Post.coffee
@@ -6,9 +6,10 @@ class Post
@ID = +root.id[2..]
@fullID = "#{@board}.#{@ID}"
- @cleanup root if that.isOriginalMarkup
post = $ '.post', root
info = $ '.postInfo', post
+ @cleanup root, post if that.isOriginalMarkup
+ root.dataset.fullID = @fullID
@nodes =
root: root
post: post
@@ -146,9 +147,11 @@ class Post
if @file.isImage = /(jpg|png|gif)$/i.test @file.name
@file.dimensions = fileText.textContent.match(/\d+x\d+/)[0]
- cleanup: (root) ->
+ cleanup: (root, post) ->
for node in $$ '.mobile', root
$.rm node
+ for node in $$ '[id]', post
+ node.removeAttribute 'id'
for node in $$ '.desktop', root
$.rmClass node, 'desktop'
return
diff --git a/src/Menu/Menu.coffee b/src/Menu/Menu.coffee
index 5803ed0ed..537d87e07 100644
--- a/src/Menu/Menu.coffee
+++ b/src/Menu/Menu.coffee
@@ -30,13 +30,4 @@ Menu =
clone
toggle: (e) ->
- try
- # Posts, inlined posts, hidden replies.
- post = Get.postFromNode @
- catch
- post = if fullID = @parentNode.parentNode.dataset.fullID
- g.threads[fullID].OP
- else
- # Hidden threads.
- Get.threadFromNode(@).OP
- Menu.menu.toggle e, @, post
+ Menu.menu.toggle e, @, Get.postFromNode @
diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee
index 784c4738f..39dc11170 100644
--- a/src/Monitoring/ThreadUpdater.coffee
+++ b/src/Monitoring/ThreadUpdater.coffee
@@ -26,9 +26,9 @@ ThreadUpdater =
cb: @node
node: ->
- ThreadUpdater.thread = @
- ThreadUpdater.root = @OP.nodes.root.parentNode
- ThreadUpdater.lastPost = +ThreadUpdater.root.lastElementChild.id.match(/\d+/)[0]
+ ThreadUpdater.thread = @
+ ThreadUpdater.root = @OP.nodes.root.parentNode
+ ThreadUpdater.lastPost = +Object.keys(@posts).sort()[-1..][0]
for input in $$ 'input', ThreadUpdater.dialog
if input.type is 'checkbox'
diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee
index ab570ebb0..da939918c 100644
--- a/src/Monitoring/ThreadWatcher.coffee
+++ b/src/Monitoring/ThreadWatcher.coffee
@@ -60,7 +60,7 @@ ThreadWatcher =
ThreadWatcher.refresh()
$.event 'CloseMenu'
toggle: ->
- ThreadWatcher.toggle Get.postFromNode(@).thread
+ ThreadWatcher.toggle Get.threadFromNode @
rm: ->
[boardID, threadID] = @parentNode.dataset.fullID.split '.'
ThreadWatcher.rm boardID, +threadID
diff --git a/src/Quotelinks/QuoteInline.coffee b/src/Quotelinks/QuoteInline.coffee
index b61aa5af3..15510cdc8 100644
--- a/src/Quotelinks/QuoteInline.coffee
+++ b/src/Quotelinks/QuoteInline.coffee
@@ -17,7 +17,7 @@ QuoteInline =
if $.hasClass @, 'inlined'
QuoteInline.rm @, boardID, threadID, postID, context
else
- return if $.x "ancestor::div[@id='p#{postID}']", @
+ return if $.x "ancestor::div[@id='pc#{postID}']", @
QuoteInline.add @, boardID, threadID, postID, context
@classList.toggle 'inlined'