This commit is contained in:
2026-09-11 23:26:20 +02:00
parent 4b615428de
commit 3dda406954
6 changed files with 25 additions and 49 deletions
+2
View File
@@ -8633,6 +8633,7 @@ class NotificationSystem {
aUsername.textContent = display_name || userName; aUsername.textContent = display_name || userName;
} }
// Grid thumbnails: update data-user attribute (shown as CSS content on hover) // Grid thumbnails: update data-user attribute (shown as CSS content on hover)
if (!window.f0ckSession?.guest_anonymize) {
document.querySelectorAll('.thumb[data-user]').forEach(el => { document.querySelectorAll('.thumb[data-user]').forEach(el => {
const cur = el.getAttribute('data-user'); const cur = el.getAttribute('data-user');
if (cur === userName || (oldDisplayName && cur === oldDisplayName)) { if (cur === userName || (oldDisplayName && cur === oldDisplayName)) {
@@ -8640,6 +8641,7 @@ class NotificationSystem {
} }
}); });
} }
}
}; };
// Helper: apply a username color change to relevant DOM nodes // Helper: apply a username color change to relevant DOM nodes
+14 -3
View File
@@ -25,13 +25,19 @@
const isMobile = /Mobi/i.test(navigator.userAgent); const isMobile = /Mobi/i.test(navigator.userAgent);
function isItemPage() { function isItemPage() {
if (document.body?.classList.contains('scroller-active') ||
document.getElementById('scroller-feed') ||
/^\/scroller(\/|$)/.test(window.location.pathname)) {
return false;
}
// Fast DOM check: item view or primary media element present // Fast DOM check: item view or primary media element present
if (document.getElementById('my-video') || document.querySelector('#main.item-view, .item-view, .item-layout-container, .item-main-content')) { if (document.getElementById('my-video') || document.querySelector('#main.item-view, .item-view, .item-layout-container, .item-main-content')) {
return true; return true;
} }
const path = window.location.pathname; const path = window.location.pathname;
const isForbidden = /^\/(s|b|t|ca|a|login|register|settings|about|terms|rules|api|logout|auth|admin|mod|comments|notifications|feed|upload|tags|halls|ranking|abyss|random)(\/|$)/.test(path); const isForbidden = /^\/(s|b|t|ca|a|login|register|settings|about|terms|rules|api|logout|auth|admin|mod|comments|notifications|feed|upload|tags|halls|ranking|abyss|random|scroller)(\/|$)/.test(path);
if (isForbidden) return false; if (isForbidden) return false;
const segments = path.split('/').filter(Boolean); const segments = path.split('/').filter(Boolean);
@@ -356,8 +362,8 @@
function setupVideo(video) { function setupVideo(video) {
if (!video) return; if (!video) return;
// Ignore sidebar sticker / emoji preview / modal videos // Ignore sidebar sticker / emoji preview / modal videos or scroller feed
if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal')) { if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal, #scroller-feed, .scroll-slide')) {
return; return;
} }
@@ -712,6 +718,11 @@
hotkeyAttached = true; hotkeyAttached = true;
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
if (document.body?.classList.contains('scroller-active') ||
document.getElementById('scroller-feed') ||
/^\/scroller(\/|$)/.test(window.location.pathname)) {
return;
}
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !isItemPage()) return; if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || !isItemPage()) return;
if (e.key.toLowerCase() !== 's') return; if (e.key.toLowerCase() !== 's') return;
+1 -29
View File
@@ -81,7 +81,6 @@
const VOL_KEY = 'scroller_volume'; const VOL_KEY = 'scroller_volume';
const PREFS_KEY = 'scroller_prefs'; const PREFS_KEY = 'scroller_prefs';
const PRESETS_KEY = 'scroller_presets'; const PRESETS_KEY = 'scroller_presets';
const THUMB_SIZE_KEY = 'scroller_thumb_size';
// ── User Preferences ────────────────────────────────────────────────────── // ── User Preferences ──────────────────────────────────────────────────────
function loadPrefs() { function loadPrefs() {
@@ -98,33 +97,6 @@
let autoNextLoops = Math.max(0, parseInt(prefs.autoNextLoops ?? 1, 10)); let autoNextLoops = Math.max(0, parseInt(prefs.autoNextLoops ?? 1, 10));
let leftHandEnabled = prefs.leftHand === true; let leftHandEnabled = prefs.leftHand === true;
// ── Grid / Thumbnail size ─────────────────────────────────────────────────
const THUMB_SIZES = ['s', 'm', 'l', 'xl'];
let thumbSize = localStorage.getItem(THUMB_SIZE_KEY) || window.f0ckDefaultThumbSize || 'm';
if (!THUMB_SIZES.includes(thumbSize)) thumbSize = window.f0ckDefaultThumbSize || 'm';
function applyThumbSize(size, persist = true) {
thumbSize = size;
document.documentElement.dataset.thumbSize = size;
if (persist) localStorage.setItem(THUMB_SIZE_KEY, size);
// Sync pill active state whenever called outside the click handler
document.querySelectorAll('#thumb-size-pills .filter-pill').forEach(p =>
p.classList.toggle('active', p.dataset.thumbSize === size)
);
}
// Apply on init — do NOT persist so config default stays effective until user chooses
applyThumbSize(thumbSize, false);
// Wire pill click events
const thumbSizePillsEl = document.getElementById('thumb-size-pills');
if (thumbSizePillsEl) {
thumbSizePillsEl.querySelectorAll('.filter-pill').forEach(pill => {
pill.addEventListener('click', () => {
applyThumbSize(pill.dataset.thumbSize, true);
});
});
}
let applied = { mode: defaultMode, mime: '', order: 'random', tags: [], externalUrl: null }; let applied = { mode: defaultMode, mime: '', order: 'random', tags: [], externalUrl: null };
let pending = { ...applied, tags: [] }; let pending = { ...applied, tags: [] };
@@ -3027,7 +2999,6 @@
document.querySelectorAll('#mode-pills .filter-pill').forEach(p => p.classList.toggle('active', +p.dataset.mode === pending.mode)); document.querySelectorAll('#mode-pills .filter-pill').forEach(p => p.classList.toggle('active', +p.dataset.mode === pending.mode));
document.querySelectorAll('#mime-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.mime === pending.mime)); document.querySelectorAll('#mime-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.mime === pending.mime));
document.querySelectorAll('#order-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.order === pending.order)); document.querySelectorAll('#order-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.order === pending.order));
document.querySelectorAll('#thumb-size-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.thumbSize === thumbSize));
if (externalUrlInput) externalUrlInput.value = pending.externalUrl || ''; if (externalUrlInput) externalUrlInput.value = pending.externalUrl || '';
renderActiveTags(); renderActiveTags();
} }
@@ -3277,6 +3248,7 @@
else if (e.key === 'l' || e.key === 'L') { e.preventDefault(); if (currentSlide) toggleFav(currentSlide); } else if (e.key === 'l' || e.key === 'L') { e.preventDefault(); if (currentSlide) toggleFav(currentSlide); }
else if (e.key === 'i' || e.key === 'I') { e.preventDefault(); if (currentSlide) openTagBar(currentSlide.dataset.id); } else if (e.key === 'i' || e.key === 'I') { e.preventDefault(); if (currentSlide) openTagBar(currentSlide.dataset.id); }
else if (e.key === 'e' || e.key === 'E') { e.preventDefault(); e.stopImmediatePropagation(); } // suppress upload modal shortcut in abyss else if (e.key === 'e' || e.key === 'E') { e.preventDefault(); e.stopImmediatePropagation(); } // suppress upload modal shortcut in abyss
else if (e.key === 's' || e.key === 'S') { e.preventDefault(); e.stopImmediatePropagation(); } // suppress flash yank shortcut in scroller
else if (e.key === 'Escape') { window.location.href = '/'; } else if (e.key === 'Escape') { window.location.href = '/'; }
}, true); // capture phase — fires before f0ckm.js bubble listeners }, true); // capture phase — fires before f0ckm.js bubble listeners
+1 -1
View File
@@ -3,7 +3,7 @@
@include(snippets/page-title) @include(snippets/page-title)
<div class="posts" data-current-page="{{ pagination.current }}" data-has-more="{{ pagination.next ? 'true' : 'false' }}"> <div class="posts" data-current-page="{{ pagination.current }}" data-has-more="{{ pagination.next ? 'true' : 'false' }}">
@each(items as item) @each(items as item)
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }} {{ item.is_onara_active ? 'onara-active' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}"> <a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }} {{ item.is_onara_active ? 'onara-active' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(session || !guest_anonymize){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
<div class="thumb-indicators"> <div class="thumb-indicators">
@if(item.is_pinned) @if(item.is_pinned)
<i class="fa-solid fa-thumbtack pin-indicator anim"></i> <i class="fa-solid fa-thumbtack pin-indicator anim"></i>
-9
View File
@@ -1152,15 +1152,6 @@
</div> </div>
</div> </div>
<div class="filter-section" id="grid-mode-section">
<div class="filter-section-label"><i class="fa-solid fa-grid-2" style="margin-right:5px;font-size:.72rem"></i>Grid Mode</div>
<div class="pill-group" id="thumb-size-pills">
<button class="filter-pill" data-thumb-size="s"><i class="fa-solid fa-table-cells"></i>S</button>
<button class="filter-pill active" data-thumb-size="m"><i class="fa-solid fa-table-cells-large"></i>M</button>
<button class="filter-pill" data-thumb-size="l"><i class="fa-solid fa-table-list"></i>L</button>
<button class="filter-pill" data-thumb-size="xl"><i class="fa-solid fa-square"></i>XL</button>
</div>
</div>
<div class="filter-section"> <div class="filter-section">
<div class="filter-section-label">{{ t('scroller.tags') }}</div> <div class="filter-section-label">{{ t('scroller.tags') }}</div>
+1 -1
View File
@@ -1,5 +1,5 @@
@each(items as item) @each(items as item)
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').replace('x-zip-compressed', 'zip').replace('x-rar-compressed', 'rar').replace('vnd.rar', 'rar').replace('x-7z-compressed', '7z').replace('x-tar', 'tar').replace('x-bzip2', 'bz2').replace('x-xz', 'xz').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}"> <a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(session || !guest_anonymize){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').replace('x-zip-compressed', 'zip').replace('x-rar-compressed', 'rar').replace('vnd.rar', 'rar').replace('x-7z-compressed', '7z').replace('x-tar', 'tar').replace('x-bzip2', 'bz2').replace('x-xz', 'xz').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
<div class="thumb-indicators"> <div class="thumb-indicators">
@if(item.is_pinned) @if(item.is_pinned)
<i class="fa-solid fa-thumbtack pin-indicator anim"></i> <i class="fa-solid fa-thumbtack pin-indicator anim"></i>