fdas
This commit is contained in:
@@ -8633,12 +8633,14 @@ class NotificationSystem {
|
||||
aUsername.textContent = display_name || userName;
|
||||
}
|
||||
// Grid thumbnails: update data-user attribute (shown as CSS content on hover)
|
||||
document.querySelectorAll('.thumb[data-user]').forEach(el => {
|
||||
const cur = el.getAttribute('data-user');
|
||||
if (cur === userName || (oldDisplayName && cur === oldDisplayName)) {
|
||||
el.setAttribute('data-user', display_name || userName);
|
||||
}
|
||||
});
|
||||
if (!window.f0ckSession?.guest_anonymize) {
|
||||
document.querySelectorAll('.thumb[data-user]').forEach(el => {
|
||||
const cur = el.getAttribute('data-user');
|
||||
if (cur === userName || (oldDisplayName && cur === oldDisplayName)) {
|
||||
el.setAttribute('data-user', display_name || userName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -25,13 +25,19 @@
|
||||
const isMobile = /Mobi/i.test(navigator.userAgent);
|
||||
|
||||
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
|
||||
if (document.getElementById('my-video') || document.querySelector('#main.item-view, .item-view, .item-layout-container, .item-main-content')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
const segments = path.split('/').filter(Boolean);
|
||||
@@ -356,8 +362,8 @@
|
||||
function setupVideo(video) {
|
||||
if (!video) return;
|
||||
|
||||
// Ignore sidebar sticker / emoji preview / modal videos
|
||||
if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal')) {
|
||||
// Ignore sidebar sticker / emoji preview / modal videos or scroller feed
|
||||
if (video.closest && video.closest('.sidebar-activity, .global-sidebar-right, .emoji-preview, .modal, #scroller-feed, .scroll-slide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -712,6 +718,11 @@
|
||||
hotkeyAttached = true;
|
||||
|
||||
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.key.toLowerCase() !== 's') return;
|
||||
|
||||
|
||||
+1
-29
@@ -81,7 +81,6 @@
|
||||
const VOL_KEY = 'scroller_volume';
|
||||
const PREFS_KEY = 'scroller_prefs';
|
||||
const PRESETS_KEY = 'scroller_presets';
|
||||
const THUMB_SIZE_KEY = 'scroller_thumb_size';
|
||||
|
||||
// ── User Preferences ──────────────────────────────────────────────────────
|
||||
function loadPrefs() {
|
||||
@@ -98,33 +97,6 @@
|
||||
let autoNextLoops = Math.max(0, parseInt(prefs.autoNextLoops ?? 1, 10));
|
||||
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 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('#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('#thumb-size-pills .filter-pill').forEach(p => p.classList.toggle('active', p.dataset.thumbSize === thumbSize));
|
||||
if (externalUrlInput) externalUrlInput.value = pending.externalUrl || '';
|
||||
renderActiveTags();
|
||||
}
|
||||
@@ -3277,6 +3248,7 @@
|
||||
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 === '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 = '/'; }
|
||||
}, true); // capture phase — fires before f0ckm.js bubble listeners
|
||||
|
||||
|
||||
Reference in New Issue
Block a user