This commit is contained in:
2026-07-16 03:59:31 +02:00
parent 4ffe83fa9d
commit 6c07bdcb33

View File

@@ -4243,7 +4243,7 @@ class CommentSystem {
holdTimer = setTimeout(() => { holdTimer = setTimeout(() => {
holdFired = true; holdFired = true;
window.stickerPreview?.show(url, isVideo, name, url); window.stickerPreview?.show(url, isVideo, name, url);
}, 600); }, 800);
}; };
const cancelHold = () => { clearTimeout(holdTimer); isTouchHold = false; }; const cancelHold = () => { clearTimeout(holdTimer); isTouchHold = false; };
const endHold = () => { const endHold = () => {
@@ -4255,12 +4255,11 @@ class CommentSystem {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
e.preventDefault(); e.preventDefault();
}, { once: true, capture: true }); }, { once: true, capture: true });
if (isTouchHold) { if (!isTouchHold) {
// Mobile: linger so user can tap the fav ★ button // Desktop: hide immediately on mouse release
window.stickerPreview?.scheduleHide(1800);
} else {
window.stickerPreview?.hide(); window.stickerPreview?.hide();
} }
// Mobile: preview stays open until user taps the overlay
} else { } else {
window.stickerPreview?.hide(); window.stickerPreview?.hide();
} }
@@ -4276,10 +4275,12 @@ class CommentSystem {
media.addEventListener('touchmove', cancelHold, { passive: true }); media.addEventListener('touchmove', cancelHold, { passive: true });
media.addEventListener('touchend', endHold); media.addEventListener('touchend', endHold);
media.addEventListener('touchcancel', cancelHold); media.addEventListener('touchcancel', cancelHold);
// Right-click (desktop) → favorites; suppressed on mobile when hold gesture is active // Right-click (desktop only) → favorites context menu
media.addEventListener('contextmenu', (e) => { media.addEventListener('contextmenu', (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
// Never show the custom menu on touch devices
if (navigator.maxTouchPoints > 0) return;
if (holdFired || favHoldFired) return; if (holdFired || favHoldFired) return;
window._favContextMenu?.show(e.clientX, e.clientY, name, url, () => { window._favContextMenu?.show(e.clientX, e.clientY, name, url, () => {
showTab(activeTabId); showTab(activeTabId);