From 5c25182f6a69c69e4d92044ebb9ce73be4b5dead Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Wed, 19 Aug 2026 22:34:23 +0200 Subject: [PATCH] hgdf --- public/s/css/f0ckm.css | 2 +- public/s/js/comments.js | 26 +++++++++++++++++--------- public/s/js/f0ckm.js | 14 ++++++++++++-- views/snippets/navbar.html | 6 +++--- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css index 3291c46..4a67ff7 100644 --- a/public/s/css/f0ckm.css +++ b/public/s/css/f0ckm.css @@ -3413,7 +3413,7 @@ body.layout-legacy .scroll-to-bottom svg { box-shadow: 0 20px 50px #000000; /* Fully opaque black shadow */ padding: 15px; - max-width: 600px; + max-width: min(600px, calc(100vw - 30px)); max-height: 500px; overflow-y: auto; pointer-events: auto; diff --git a/public/s/js/comments.js b/public/s/js/comments.js index f4fddcc..126e2d4 100644 --- a/public/s/js/comments.js +++ b/public/s/js/comments.js @@ -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'; diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index a5d7c76..caa87e6 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -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; } } diff --git a/views/snippets/navbar.html b/views/snippets/navbar.html index 6fbe931..670c97f 100644 --- a/views/snippets/navbar.html +++ b/views/snippets/navbar.html @@ -43,11 +43,11 @@