hgdf
This commit is contained in:
@@ -1062,10 +1062,6 @@ class CommentSystem {
|
||||
preview.style.position = 'fixed';
|
||||
preview.style.zIndex = (100000 + level).toString();
|
||||
|
||||
// Try to place it to the right of the link, or top/bottom if needed
|
||||
let left = rect.right + 10;
|
||||
let top = rect.top;
|
||||
|
||||
document.body.appendChild(preview);
|
||||
CommentSystem.playEmojiVideos(preview);
|
||||
|
||||
@@ -1090,16 +1086,28 @@ class CommentSystem {
|
||||
|
||||
const previewRect = preview.getBoundingClientRect();
|
||||
|
||||
// Boundary checks
|
||||
if (left + previewRect.width > window.innerWidth) {
|
||||
// Default: position preview to the right of the link
|
||||
let left = rect.right + 10;
|
||||
let top = rect.top;
|
||||
|
||||
// If there's NOT enough space on the right, open to the left
|
||||
if (left + previewRect.width > window.innerWidth - 10) {
|
||||
left = rect.left - previewRect.width - 10;
|
||||
}
|
||||
if (left < 0) left = 10;
|
||||
|
||||
if (top + previewRect.height > window.innerHeight) {
|
||||
// Clamp to screen boundaries if left/right are both tight
|
||||
if (left < 10) {
|
||||
left = 10;
|
||||
}
|
||||
if (left + previewRect.width > window.innerWidth - 10) {
|
||||
left = Math.max(10, window.innerWidth - previewRect.width - 10);
|
||||
}
|
||||
|
||||
// Clamp top & bottom boundary
|
||||
if (top + previewRect.height > window.innerHeight - 10) {
|
||||
top = window.innerHeight - previewRect.height - 10;
|
||||
}
|
||||
if (top < 0) top = 10;
|
||||
if (top < 10) top = 10;
|
||||
|
||||
preview.style.left = left + 'px';
|
||||
preview.style.top = top + 'px';
|
||||
|
||||
@@ -849,7 +849,12 @@ window.cancelAnimFrame = (function () {
|
||||
if (e.target.closest('.nav-avatar-img')) {
|
||||
const username = window.f0ckSession?.user;
|
||||
if (username) {
|
||||
window.location.href = `/user/${username.toLowerCase()}`;
|
||||
const url = `/user/${username.toLowerCase()}`;
|
||||
if (typeof window.loadPageAjax === 'function') {
|
||||
window.loadPageAjax(url, true);
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -9275,7 +9280,12 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
if (e.target.closest('.nav-avatar-img')) {
|
||||
const username = window.f0ckSession?.user;
|
||||
if (username) {
|
||||
window.location.href = `/user/${username.toLowerCase()}`;
|
||||
const url = `/user/${username.toLowerCase()}`;
|
||||
if (typeof window.loadPageAjax === 'function') {
|
||||
window.loadPageAjax(url, true);
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user