This commit is contained in:
2026-08-19 22:34:23 +02:00
parent c644f7fa2a
commit 5c25182f6a
4 changed files with 33 additions and 15 deletions

View File

@@ -3413,7 +3413,7 @@ body.layout-legacy .scroll-to-bottom svg {
box-shadow: 0 20px 50px #000000; box-shadow: 0 20px 50px #000000;
/* Fully opaque black shadow */ /* Fully opaque black shadow */
padding: 15px; padding: 15px;
max-width: 600px; max-width: min(600px, calc(100vw - 30px));
max-height: 500px; max-height: 500px;
overflow-y: auto; overflow-y: auto;
pointer-events: auto; pointer-events: auto;

View File

@@ -1062,10 +1062,6 @@ class CommentSystem {
preview.style.position = 'fixed'; preview.style.position = 'fixed';
preview.style.zIndex = (100000 + level).toString(); 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); document.body.appendChild(preview);
CommentSystem.playEmojiVideos(preview); CommentSystem.playEmojiVideos(preview);
@@ -1090,16 +1086,28 @@ class CommentSystem {
const previewRect = preview.getBoundingClientRect(); const previewRect = preview.getBoundingClientRect();
// Boundary checks // Default: position preview to the right of the link
if (left + previewRect.width > window.innerWidth) { 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; 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; top = window.innerHeight - previewRect.height - 10;
} }
if (top < 0) top = 10; if (top < 10) top = 10;
preview.style.left = left + 'px'; preview.style.left = left + 'px';
preview.style.top = top + 'px'; preview.style.top = top + 'px';

View File

@@ -849,7 +849,12 @@ window.cancelAnimFrame = (function () {
if (e.target.closest('.nav-avatar-img')) { if (e.target.closest('.nav-avatar-img')) {
const username = window.f0ckSession?.user; const username = window.f0ckSession?.user;
if (username) { 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; return;
} }
} }
@@ -9275,7 +9280,12 @@ document.addEventListener("DOMContentLoaded", function () {
if (e.target.closest('.nav-avatar-img')) { if (e.target.closest('.nav-avatar-img')) {
const username = window.f0ckSession?.user; const username = window.f0ckSession?.user;
if (username) { 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; return;
} }
} }

View File

@@ -43,11 +43,11 @@
<div class="nav-user-dropdown"> <div class="nav-user-dropdown">
<button class="nav-user-btn nav-avatar-btn" id="nav-user-toggle"> <button class="nav-user-btn nav-avatar-btn" id="nav-user-toggle">
@if(session.avatar_file) @if(session.avatar_file)
<img class="nav-avatar-img" src="/a/{{ session.avatar_file }}" onerror="this.src='/a/default.png'" onclick="event.stopPropagation(); window.location.href='/user/{!! session.user.toLowerCase() !!}';" title="{{ session.user }}"> <img class="nav-avatar-img" src="/a/{{ session.avatar_file }}" onerror="this.src='/a/default.png'" onclick="event.stopPropagation(); if(typeof window.loadPageAjax==='function'){ window.loadPageAjax('/user/{!! session.user.toLowerCase() !!}', true); } else { window.location.href='/user/{!! session.user.toLowerCase() !!}'; }" title="{{ session.user }}">
@elseif(session.avatar && session.avatar > 0) @elseif(session.avatar && session.avatar > 0)
<img class="nav-avatar-img" src="/t/{{ session.avatar }}.webp" onerror="this.src='/a/default.png'" onclick="event.stopPropagation(); window.location.href='/user/{!! session.user.toLowerCase() !!}';" title="{{ session.user }}"> <img class="nav-avatar-img" src="/t/{{ session.avatar }}.webp" onerror="this.src='/a/default.png'" onclick="event.stopPropagation(); if(typeof window.loadPageAjax==='function'){ window.loadPageAjax('/user/{!! session.user.toLowerCase() !!}', true); } else { window.location.href='/user/{!! session.user.toLowerCase() !!}'; }" title="{{ session.user }}">
@else @else
<img class="nav-avatar-img" src="/a/default.png" onclick="event.stopPropagation(); window.location.href='/user/{!! session.user.toLowerCase() !!}';" title="{{ session.user }}"> <img class="nav-avatar-img" src="/a/default.png" onclick="event.stopPropagation(); if(typeof window.loadPageAjax==='function'){ window.loadPageAjax('/user/{!! session.user.toLowerCase() !!}', true); } else { window.location.href='/user/{!! session.user.toLowerCase() !!}'; }" title="{{ session.user }}">
@endif @endif
<span class="nav-avatar-name" id="nav-display-name" @if(session.username_color)style="color: {{ session.username_color }}"@endif>{!! session.display_name || session.user !!}</span> <span class="nav-avatar-name" id="nav-display-name" @if(session.username_color)style="color: {{ session.username_color }}"@endif>{!! session.display_name || session.user !!}</span>
<span class="nav-avatar-caret"></span> <span class="nav-avatar-caret"></span>