mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-02 19:17:21 +01:00
watch.js and post-hover.js integrations
This commit is contained in:
parent
cf0c7c86ad
commit
5f7db88a2d
@ -19,9 +19,13 @@ onready(function(){
|
|||||||
var id;
|
var id;
|
||||||
var matches;
|
var matches;
|
||||||
|
|
||||||
if(matches = $link.text().match(/^>>(?:>\/([^\/]+)\/)?(\d+)$/)) {
|
if ($link.is('[data-thread]')) {
|
||||||
|
id = $link.attr('data-thread');
|
||||||
|
}
|
||||||
|
else if(matches = $link.text().match(/^>>(?:>\/([^\/]+)\/)?(\d+)$/)) {
|
||||||
id = matches[2];
|
id = matches[2];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,15 +33,16 @@ onready(function(){
|
|||||||
while (board.data('board') === undefined) {
|
while (board.data('board') === undefined) {
|
||||||
board = board.parent();
|
board = board.parent();
|
||||||
}
|
}
|
||||||
var threadid = board.attr('id').replace("thread_", "");
|
var threadid;
|
||||||
|
if ($link.is('[data-thread]')) threadid = 0;
|
||||||
|
else threadid = board.attr('id').replace("thread_", "");
|
||||||
|
|
||||||
board = board.data('board');
|
board = board.data('board');
|
||||||
|
|
||||||
var parentboard = board;
|
var parentboard = board;
|
||||||
|
|
||||||
if (matches[1] !== undefined) {
|
if ($link.is('[data-thread]')) parentboard = $('form[name="post"] input[name="board"]').val();
|
||||||
board = matches[1];
|
else if (matches[1] !== undefined) board = matches[1];
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var $post = false;
|
var $post = false;
|
||||||
var hovering = false;
|
var hovering = false;
|
||||||
@ -64,13 +69,15 @@ onready(function(){
|
|||||||
.attr('id', 'post-hover-' + id)
|
.attr('id', 'post-hover-' + id)
|
||||||
.attr('data-board', board)
|
.attr('data-board', board)
|
||||||
.addClass('post-hover')
|
.addClass('post-hover')
|
||||||
.css('position', 'absolute')
|
|
||||||
.css('border-style', 'solid')
|
.css('border-style', 'solid')
|
||||||
.css('box-shadow', '1px 1px 1px #999')
|
.css('box-shadow', '1px 1px 1px #999')
|
||||||
.css('display', 'block')
|
.css('display', 'block')
|
||||||
|
.css('position', 'absolute')
|
||||||
|
.css('font-style', 'normal')
|
||||||
.css('z-index', '100')
|
.css('z-index', '100')
|
||||||
.addClass('reply').addClass('post')
|
.addClass('reply').addClass('post')
|
||||||
.insertAfter($link.parent())
|
.insertAfter($link.parent())
|
||||||
|
|
||||||
$link.trigger('mousemove');
|
$link.trigger('mousemove');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -135,12 +142,17 @@ onready(function(){
|
|||||||
if($hover.length == 0)
|
if($hover.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var top = (e.pageY ? e.pageY : hovered_at['y']) - 10;
|
var scrollTop = $(window).scrollTop();
|
||||||
|
if ($link.is("[data-thread]")) scrollTop = 0;
|
||||||
|
var epy = e.pageY;
|
||||||
|
if ($link.is("[data-thread]")) epy -= $(window).scrollTop();
|
||||||
|
|
||||||
if(e.pageY < $(window).scrollTop() + 15) {
|
var top = (epy ? epy : hovered_at['y']) - 10;
|
||||||
top = $(window).scrollTop();
|
|
||||||
} else if(e.pageY > $(window).scrollTop() + $(window).height() - $hover.height() - 15) {
|
if(epy < scrollTop + 15) {
|
||||||
top = $(window).scrollTop() + $(window).height() - $hover.height() - 15;
|
top = scrollTop;
|
||||||
|
} else if(epy > scrollTop + $(window).height() - $hover.height() - 15) {
|
||||||
|
top = scrollTop + $(window).height() - $hover.height() - 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ $(function(){
|
|||||||
for (var i in st) {
|
for (var i in st) {
|
||||||
if (is_pinned(st[i])) {
|
if (is_pinned(st[i])) {
|
||||||
var link;
|
var link;
|
||||||
if (bl.find('[href*="/'+i+'/"]:not(.cb-menuitem)').length) link = bl.find('[href*="/'+i+'/"]').first();
|
if (bl.find('[href*="/'+i+'/index.html"]:not(.cb-menuitem)').length) link = bl.find('[href*="/'+i+'/"]').first();
|
||||||
|
|
||||||
// TODO: fix path
|
// TODO: fix path
|
||||||
else link = $('<a href="/'+i+'/" class="cb-item cb-cat">/'+i+'/</a>').appendTo(pinned);
|
else link = $('<a href="/'+i+'/" class="cb-item cb-cat">/'+i+'/</a>').appendTo(pinned);
|
||||||
@ -126,6 +126,7 @@ $(function(){
|
|||||||
.css("top", $(this).position().top + 13 + $(this).height())
|
.css("top", $(this).position().top + 13 + $(this).height())
|
||||||
.css("left", $(this).position().left)
|
.css("left", $(this).position().left)
|
||||||
.css("right", "auto")
|
.css("right", "auto")
|
||||||
|
.css("font-style", "normal")
|
||||||
.appendTo($(this));
|
.appendTo($(this));
|
||||||
var board = $(this).attr("data-board");
|
var board = $(this).attr("data-board");
|
||||||
|
|
||||||
@ -162,6 +163,9 @@ $(function(){
|
|||||||
$(this).parent().parent().parent().mouseleave();
|
$(this).parent().parent().parent().mouseleave();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (typeof init_hover != "undefined")
|
||||||
|
init_hover.bind(tag[0])();
|
||||||
}
|
}
|
||||||
|
|
||||||
}).mouseleave(function() {
|
}).mouseleave(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user