Make Get.contextFromNode compatible with Quote Threading.

This commit is contained in:
Zixaphir 2014-03-09 14:43:53 -07:00
parent 2504cedfee
commit 435b8d91e5
4 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.4.1 - 2014-03-08
* 4chan X - Version 1.4.1 - 2014-03-09
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

View File

@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.4.1 - 2014-03-08
* 4chan X - Version 1.4.1 - 2014-03-09
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -3857,7 +3857,9 @@
return Get.postFromRoot($.x('ancestor::div[contains(@class,"postContainer")][1]', node));
},
contextFromNode: function(node) {
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', node));
var snapshot;
snapshot = $.X('ancestor::div[contains(@class,"postContainer")]', node);
return Get.postFromRoot(snapshot.snapshotItem(snapshot.length - 1));
},
postDataFromLink: function(link) {
var boardID, path, postID, threadID, _ref;

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.4.1 - 2014-03-08
* 4chan X - Version 1.4.1 - 2014-03-09
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -3916,7 +3916,9 @@
return Get.postFromRoot($.x('ancestor::div[contains(@class,"postContainer")][1]', node));
},
contextFromNode: function(node) {
return Get.postFromRoot($.x('ancestor::div[parent::div[@class="thread"]][1]', node));
var snapshot;
snapshot = $.X('ancestor::div[contains(@class,"postContainer")]', node);
return Get.postFromRoot(snapshot.snapshotItem(snapshot.length - 1));
},
postDataFromLink: function(link) {
var boardID, path, postID, threadID, _ref;

View File

@ -17,7 +17,8 @@ Get =
postFromNode: (node) ->
Get.postFromRoot $.x 'ancestor::div[contains(@class,"postContainer")][1]', node
contextFromNode: (node) ->
Get.postFromRoot $.x 'ancestor::div[parent::div[@class="thread"]][1]', node
snapshot = $.X 'ancestor::div[contains(@class,"postContainer")]', node
Get.postFromRoot snapshot.snapshotItem(snapshot.length - 1)
postDataFromLink: (link) ->
if link.hostname is 'boards.4chan.org'
path = link.pathname.split '/'