From 3750c5bdf552bc374c600373aae033a302facddc Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 13 Dec 2015 09:48:07 -0800 Subject: [PATCH] Incorporate Mayhem's Get.postFromRoot simplifications from 59f2ca6a5128bfadb8c3472c9e081d2b46d7e970. --- src/General/Get.coffee | 7 ++----- src/classes/Post.coffee | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/General/Get.coffee b/src/General/Get.coffee index f87a17342..aff510085 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -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 diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index a960b3e8e..7fd84a844 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -30,6 +30,7 @@ class Post @fullID = "#{@board}.#{@ID}" @context = @ + root.dataset.fullID = @fullID post = $ '.post', root info = $ '.postInfo', post @nodes =