mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-03-01 08:10:44 +01:00
Bug fix: fix highlightReply() with the new floating boardlist
This commit is contained in:
parent
1cab7bc74f
commit
1c207c0aa5
@ -255,9 +255,10 @@ function get_cookie(cookie_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function highlightReply(id) {
|
function highlightReply(id) {
|
||||||
if (typeof window.event != "undefined" && event.which == 2) {
|
if (typeof window.event != "undefined") {
|
||||||
// don't highlight on middle click
|
// don't highlight on middle click
|
||||||
return true;
|
if (event.which == 2) return true;
|
||||||
|
window.event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
var divs = document.getElementsByTagName('div');
|
var divs = document.getElementsByTagName('div');
|
||||||
@ -268,9 +269,18 @@ function highlightReply(id) {
|
|||||||
}
|
}
|
||||||
if (id) {
|
if (id) {
|
||||||
var post = document.getElementById('reply_'+id);
|
var post = document.getElementById('reply_'+id);
|
||||||
if (post)
|
if (post) {
|
||||||
post.className += ' highlighted';
|
post.className += ' highlighted';
|
||||||
window.location.hash = id;
|
window.location.hash = id;
|
||||||
|
|
||||||
|
// Better offset to keep in mind new hovering boardlist
|
||||||
|
var post_top = post.getBoundingClientRect().top;
|
||||||
|
var body_top = document.body.getBoundingClientRect().top;
|
||||||
|
var boardlist_height = document.getElementsByClassName('boardlist')[0].getBoundingClientRect().height;
|
||||||
|
var offset = (post_top - body_top) - boardlist_height;
|
||||||
|
|
||||||
|
window.scrollTo(0, offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user