Incorporate Mayhem's Get.postFromRoot simplifications from 59f2ca6a5128bfadb8c3472c9e081d2b46d7e970.

This commit is contained in:
ccd0 2015-12-13 09:48:07 -08:00
parent 6b167d42b9
commit 3750c5bdf5
2 changed files with 3 additions and 5 deletions

View File

@ -13,11 +13,8 @@ Get =
Get.threadFromRoot $.x 'ancestor::div[@class="thread"]', node
postFromRoot: (root) ->
return null unless root?
link = $ '.postNum > a[href*="#"]', root
boardID = link.pathname.split(/\/+/)[1]
postID = link.hash[2..]
index = root.dataset.clone
post = g.posts["#{boardID}.#{postID}"]
post = g.posts[root.dataset.fullID]
index = root.dataset.clone
if index then post.clones[index] else post
postFromNode: (root) ->
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root

View File

@ -30,6 +30,7 @@ class Post
@fullID = "#{@board}.#{@ID}"
@context = @
root.dataset.fullID = @fullID
post = $ '.post', root
info = $ '.postInfo', post
@nodes =