post-hover.js: ukko fix

This commit is contained in:
czaks 2013-08-04 06:08:10 -04:00
parent 3e4545d1b8
commit 71db417206

View File

@ -24,6 +24,13 @@ onready(function(){
return; return;
} }
var board = $(this);
while (board.data('board') === undefined) {
board = board.parent();
}
var threadid = board.attr('id');
board = board.data('board');
var $post = false; var $post = false;
var hovering = false; var hovering = false;
var hovered_at; var hovered_at;
@ -43,6 +50,7 @@ onready(function(){
$newPost.find('span.mentioned').remove(); $newPost.find('span.mentioned').remove();
$newPost $newPost
.attr('id', 'post-hover-' + id) .attr('id', 'post-hover-' + id)
.attr('data-board', board)
.addClass('post-hover') .addClass('post-hover')
.css('position', 'absolute') .css('position', 'absolute')
.css('border-style', 'solid') .css('border-style', 'solid')
@ -53,7 +61,7 @@ onready(function(){
} }
}; };
$post = $('div.post#reply_' + id); $post = $('[data-board="' + board + '"] div.post#reply_' + id);
if($post.length > 0) { if($post.length > 0) {
start_hover($(this)); start_hover($(this));
} else { } else {
@ -69,12 +77,12 @@ onready(function(){
context: document.body, context: document.body,
success: function(data) { success: function(data) {
$(data).find('div.post.reply').each(function() { $(data).find('div.post.reply').each(function() {
if($('#' + $(this).attr('id')).length == 0) if($('[data-board="' + board + '"] #' + $(this).attr('id')).length == 0)
$('div.post:first').prepend($(this).css('display', 'none').addClass('hidden')); $('[data-board="' + board + '"]#' + threadid + " .post.reply:first").before($(this).css('display', 'none').addClass('hidden'));
}); });
$post = $('div.post#reply_' + id); $post = $('[data-board="' + board + '"] div.post#reply_' + id);
if(hovering && $post.length > 0) { if(hovering && $post.length > 0) {
start_hover($link); start_hover($link);
} }
@ -94,7 +102,7 @@ onready(function(){
if(!$post) if(!$post)
return; return;
var $hover = $('#post-hover-' + id); var $hover = $('#post-hover-' + id + '[data-board="' + board + '"]');
if($hover.length == 0) if($hover.length == 0)
return; return;