post-hover.js: allow working between threads and boards (ukko patchset required!)
This commit is contained in:
parent
06d2dafa2a
commit
185e68de47
@ -17,20 +17,28 @@ onready(function(){
|
|||||||
var $link = $(this);
|
var $link = $(this);
|
||||||
|
|
||||||
var id;
|
var id;
|
||||||
|
var matches;
|
||||||
if(id = $link.text().match(/^>>(\d+)$/)) {
|
|
||||||
id = id[1];
|
if(matches = $link.text().match(/^>>(?:>\/([^\/]+)\/)?(\d+)$/)) {
|
||||||
|
id = matches[2];
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var board = $(this);
|
var board = $(this);
|
||||||
while (board.data('board') === undefined) {
|
while (board.data('board') === undefined) {
|
||||||
board = board.parent();
|
board = board.parent();
|
||||||
}
|
}
|
||||||
var threadid = board.attr('id');
|
var threadid = board.attr('id').replace("thread_", "");
|
||||||
board = board.data('board');
|
board = board.data('board');
|
||||||
|
|
||||||
|
var parentboard = board;
|
||||||
|
|
||||||
|
if (matches[1] !== undefined) {
|
||||||
|
board = matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var $post = false;
|
var $post = false;
|
||||||
var hovering = false;
|
var hovering = false;
|
||||||
var hovered_at;
|
var hovered_at;
|
||||||
@ -76,11 +84,25 @@ onready(function(){
|
|||||||
url: url,
|
url: url,
|
||||||
context: document.body,
|
context: document.body,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(data).find('div.post.reply').each(function() {
|
var mythreadid = $(data).find('div[id^="thread_"]').attr('id').replace("thread_", "");
|
||||||
if($('[data-board="' + board + '"] #' + $(this).attr('id')).length == 0)
|
|
||||||
$('[data-board="' + board + '"]#' + threadid + " .post.reply:first").before($(this).css('display', 'none').addClass('hidden'));
|
|
||||||
|
|
||||||
});
|
if (mythreadid == threadid && parentboard == board) {
|
||||||
|
$(data).find('div.post.reply').each(function() {
|
||||||
|
if($('[data-board="' + board + '"] #' + $(this).attr('id')).length == 0) {
|
||||||
|
$('[data-board="' + board + '"]#thread_' + threadid + " .post.reply:first").before($(this).hide().addClass('hidden'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if ($('[data-board="' + board + '"]#thread_'+mythreadid).length > 0) {
|
||||||
|
$(data).find('div.post.reply').each(function() {
|
||||||
|
if($('[data-board="' + board + '"] #' + $(this).attr('id')).length == 0) {
|
||||||
|
$('[data-board="' + board + '"]#thread_' + mythreadid + " .post.reply:first").before($(this).hide().addClass('hidden'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(data).find('div[id^="thread_"]').hide().attr('data-cached', 'yes').prependTo('form[name="postcontrols"]');
|
||||||
|
}
|
||||||
|
|
||||||
$post = $('[data-board="' + board + '"] div.post#reply_' + id);
|
$post = $('[data-board="' + board + '"] div.post#reply_' + id);
|
||||||
if(hovering && $post.length > 0) {
|
if(hovering && $post.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user