diff --git a/LICENSE b/LICENSE index 466133539..d45e0ed08 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.4.1 - 2014-03-10 +* 4chan X - Version 1.4.1 - 2014-03-11 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 8da0d8c27..bba046fd7 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.4.1 - 2014-03-10 +* 4chan X - Version 1.4.1 - 2014-03-11 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -1087,6 +1087,7 @@ this.thread.OP = this; this.thread.isSticky = !!$('.stickyIcon', info); this.thread.isClosed = !!$('.closedIcon', info); + root.parentElement.dataset.fullID = this.fullID; } this.info = {}; if (subject = $('.subject', info)) { @@ -3844,7 +3845,7 @@ return "/" + thread.board + "/ - " + excerpt; }, threadFromRoot: function(root) { - return g.threads["" + g.BOARD + "." + root.id.slice(1)]; + return g.threads[root.dataset.fullID]; }, threadFromNode: function(node) { return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node)); @@ -3862,9 +3863,7 @@ return Get.postFromRoot($.x('ancestor::div[contains(@class,"postContainer")][1]', node)); }, contextFromNode: function(node) { - var snapshot; - snapshot = $.X('ancestor::div[contains(@class,"postContainer")]', node); - return Get.postFromRoot(snapshot.snapshotItem(snapshot.length - 1)); + return Get.postFromRoot($.x('ancestor::div[@class="thread"]', node).firstElementChild); }, postDataFromLink: function(link) { var boardID, path, postID, threadID, _ref; diff --git a/builds/crx/script.js b/builds/crx/script.js index 9a6aa427e..bbf52aa44 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.4.1 - 2014-03-10 +* 4chan X - Version 1.4.1 - 2014-03-11 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -1141,6 +1141,7 @@ this.thread.OP = this; this.thread.isSticky = !!$('.stickyIcon', info); this.thread.isClosed = !!$('.closedIcon', info); + root.parentElement.dataset.fullID = this.fullID; } this.info = {}; if (subject = $('.subject', info)) { @@ -3903,7 +3904,7 @@ return "/" + thread.board + "/ - " + excerpt; }, threadFromRoot: function(root) { - return g.threads["" + g.BOARD + "." + root.id.slice(1)]; + return g.threads[root.dataset.fullID]; }, threadFromNode: function(node) { return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node)); @@ -3921,9 +3922,7 @@ return Get.postFromRoot($.x('ancestor::div[contains(@class,"postContainer")][1]', node)); }, contextFromNode: function(node) { - var snapshot; - snapshot = $.X('ancestor::div[contains(@class,"postContainer")]', node); - return Get.postFromRoot(snapshot.snapshotItem(snapshot.length - 1)); + return Get.postFromRoot($.x('ancestor::div[@class="thread"]', node).firstElementChild); }, postDataFromLink: function(link) { var boardID, path, postID, threadID, _ref; diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 11ea71b6b..f042fde45 100755 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -8,7 +8,7 @@ Get = excerpt = "#{excerpt[...67]}..." "/#{thread.board}/ - #{excerpt}" threadFromRoot: (root) -> - g.threads["#{g.BOARD}.#{root.id[1..]}"] + g.threads[root.dataset.fullID] threadFromNode: (node) -> Get.threadFromRoot $.x 'ancestor::div[@class="thread"]', node postFromRoot: (root) -> @@ -17,8 +17,7 @@ Get = postFromNode: (node) -> Get.postFromRoot $.x 'ancestor::div[contains(@class,"postContainer")][1]', node contextFromNode: (node) -> - snapshot = $.X 'ancestor::div[contains(@class,"postContainer")]', node - Get.postFromRoot snapshot.snapshotItem(snapshot.length - 1) + Get.postFromRoot $.x('ancestor::div[@class="thread"]', node).firstElementChild postDataFromLink: (link) -> if link.hostname is 'boards.4chan.org' path = link.pathname.split '/' diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 54c8dcf5d..7f4c778e4 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -23,6 +23,7 @@ class Post @thread.OP = @ @thread.isSticky = !!$ '.stickyIcon', info @thread.isClosed = !!$ '.closedIcon', info + root.parentElement.dataset.fullID = @fullID @info = {} if subject = $ '.subject', info