From 4f6223640fccad1acb4c8eacec38a4a306a9fc89 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sat, 12 Sep 2026 06:01:50 +0200 Subject: [PATCH] gsdf --- public/s/css/f0ckm.css | 204 +++++++------ public/s/css/upload.css | 12 +- public/s/js/f0ckm.js | 135 +++++++-- public/s/js/sidebar-activity.js | 488 +++++++++++++++++++++++++++++--- src/inc/routeinc/f0cklib.mjs | 172 +++++++++++ src/inc/routes/apiv2/index.mjs | 88 +++++- src/inc/routes/toptags.mjs | 3 +- src/inc/routes/user_tags.mjs | 3 +- views/item-partial-legacy.html | 4 +- views/item-partial-modern.html | 4 +- views/scroller.html | 8 +- views/snippets/footer.html | 21 ++ views/snippets/header.html | 2 +- views/snippets/navbar.html | 4 +- views/tag-cards.html | 2 +- 15 files changed, 991 insertions(+), 159 deletions(-) diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css index 89aedb5..a97e309 100644 --- a/public/s/css/f0ckm.css +++ b/public/s/css/f0ckm.css @@ -33,10 +33,24 @@ --pagination-background: #2b2b2b; --metadata-bg: #2b2b2b; --badge-bg: #171717; + --badge-sfw: #02500b; + --badge-nsfw: #E10DC3; + --badge-nsfl: #660000; + --badge-untagged: #555555; + --badge-tag: #090909; --posts-meta-bg: #000000b8; --x2154: #215483; } +html:not([theme]), html[theme=""] { + --badge-bg: #171717; + --badge-sfw: #02500b; + --badge-nsfw: #E10DC3; + --badge-nsfl: #660000; + --badge-untagged: #555555; + --badge-tag: #090909; +} + html, body { touch-action: pan-x pan-y; } @@ -3017,45 +3031,15 @@ body.sidebar-right-hidden #sidebar-drag-zone { transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; } -.sidebar-video-card:hover { +.sidebar-video-card:hover, +.sidebar-video-card.touch-active { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); transform: translateY(-1px); } -.sidebar-video-card:active { - transform: scale(0.99); -} - .sidebar-video-card.sidebar-card-swapping { - opacity: 0.35; - filter: grayscale(0.6); - transition: opacity 0.5s ease, filter 0.5s ease; -} - -.sidebar-video-card.sidebar-card-entering { - animation: sidebarCardEnter 2s cubic-bezier(0.16, 1, 0.3, 1) forwards; -} - -@keyframes sidebarCardEnter { - 0% { - opacity: 0; - transform: scale(0.91) translateY(8px); - filter: brightness(1.2) contrast(0.95); - } - 40% { - opacity: 0.75; - transform: scale(0.97) translateY(3px); - } - 75% { - opacity: 0.95; - transform: scale(0.995) translateY(0.5px); - } - 100% { - opacity: 1; - transform: scale(1) translateY(0); - filter: brightness(1) contrast(1); - } + opacity: 0.5; } .sidebar-video-card .sidebar-video-link { @@ -3080,43 +3064,15 @@ body.sidebar-right-hidden #sidebar-drag-zone { object-fit: cover; display: block; transition: transform 0.3s ease; + -webkit-user-drag: none; + user-select: none; + -webkit-user-select: none; } .sidebar-video-card:hover .sidebar-video-thumb { transform: scale(1.04); } -.sidebar-video-play-overlay { - position: absolute; - inset: 0; - display: flex; - align-items: center; - justify-content: center; - background: rgba(0, 0, 0, 0.25); - color: #fff; - font-size: 1.2em; - opacity: 0; - transition: opacity 0.2s ease, background 0.2s ease; -} - -.sidebar-video-play-overlay i { - width: 38px; - height: 38px; - border-radius: 50%; - background: rgba(0, 0, 0, 0.65); - display: flex; - align-items: center; - justify-content: center; - padding-left: 3px; - border: 1px solid rgba(255, 255, 255, 0.2); - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); -} - -.sidebar-video-card:hover .sidebar-video-play-overlay { - opacity: 1; - background: rgba(0, 0, 0, 0.35); -} - .sidebar-video-badge { position: absolute; bottom: 6px; @@ -3131,20 +3087,21 @@ body.sidebar-right-hidden #sidebar-drag-zone { color: #fff; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); + z-index: 10; } .sidebar-video-badge.rating-sfw { - background-color: var(--badge-sfw); + background-color: var(--badge-sfw, #02500b); border: 1px solid rgba(0, 0, 0, 0.2); } .sidebar-video-badge.rating-nsfw { - background-color: var(--badge-nsfw); + background-color: var(--badge-nsfw, #E10DC3); border: 1px solid rgba(0, 0, 0, 0.2); } .sidebar-video-badge.rating-nsfl { - background-color: var(--badge-nsfl); + background-color: var(--badge-nsfl, #660000); border: 1px solid rgba(0, 0, 0, 0.2); } @@ -3167,6 +3124,7 @@ body.sidebar-right-hidden #sidebar-drag-zone { backdrop-filter: blur(4px); border: 1px solid rgba(255, 255, 255, 0.15); line-height: 1; + z-index: 10; } .sidebar-media-placeholder { @@ -3313,11 +3271,6 @@ html[theme='paper'] .sidebar-video-channel { color: #64748b; } -html[theme='light'] .sidebar-video-play-overlay, -html[theme='paper'] .sidebar-video-play-overlay { - background: rgba(0, 0, 0, 0.2); -} - /* Theme 95 */ html[theme='95'] .sidebar-tabs { background: #c0c0c0; @@ -3346,6 +3299,68 @@ html[theme='95'] .sidebar-video-title { font-family: 'MS Sans Serif', sans-serif; } +/* Sidebar Tag Feed Header & Active Card Highlighting */ +.sidebar-tag-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8px 12px; + background: rgba(18, 18, 24, 0.95); + backdrop-filter: blur(8px); + border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)); + margin-bottom: 6px; + position: sticky; + top: -6px; + z-index: 10; +} + +.sidebar-tag-title { + display: flex; + align-items: center; + gap: 6px; + font-size: 0.85em; + font-weight: 700; + color: var(--accent, #a78bfa); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.sidebar-tag-title i { + opacity: 0.85; +} + +.sidebar-tag-count { + font-size: 0.85em; + font-weight: 500; + color: var(--text-muted, #888); + margin-left: 4px; +} + +.sidebar-tag-order-btn { + background: rgba(255, 255, 255, 0.06); + border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1)); + color: var(--text-color, #ccc); + border-radius: 4px; + padding: 3px 8px; + font-size: 0.82em; + cursor: pointer; + display: flex; + align-items: center; + gap: 5px; + transition: all 0.15s ease; +} + +.sidebar-tag-order-btn:hover { + background: rgba(255, 255, 255, 0.12); + color: #fff; + border-color: var(--accent, #a78bfa); +} + +.sidebar-video-card.active-tag-item { + border-color: var(--accent, #a78bfa) !important; +} + #sidebar-activity-container.sidebar-comments-list { flex: 1; overflow-y: auto; @@ -5646,11 +5661,16 @@ div.posts { margin-bottom: 35px; } -/* Mobile: Ensure at least 3 columns unless user picked a larger size */ +/* Mobile: Ensure at least 3 columns for S/M, and at least 2 columns for L/XL */ @media (max-width: 600px) { html:not([data-thumb-size="l"]):not([data-thumb-size="xl"]) div.posts { grid-template-columns: repeat(3, 1fr); } + + html[data-thumb-size="l"] div.posts, + html[data-thumb-size="xl"] div.posts { + grid-template-columns: repeat(2, 1fr); + } } div.posts>a:not(.notif-item) { @@ -6476,6 +6496,28 @@ body.layout-modern.sidebar-right-hidden .pagination-container-fluid { overflow: visible; } +.item_title:has(.info-title-edit-wrap) .item_title_text { + cursor: pointer; + display: inline-block; + max-width: 100%; + transition: color 0.15s ease, opacity 0.15s ease; +} + +.item_title:has(.info-title-edit-wrap) .item_title_text:hover { + color: #fff; +} + +.item_title_text.no-title, +.item_title_text em { + font-style: italic; + color: var(--text-muted, rgba(255, 255, 255, 0.45)); +} + +.item_title:has(.info-title-edit-wrap) .item_title_text.no-title:hover em, +.item_title:has(.info-title-edit-wrap) .item_title_text:hover em { + color: var(--accent, #9f0); +} + /* .location { padding-left: 5px; } */ @@ -7339,7 +7381,7 @@ span#tags:not(.tags-expanded) .tags-inner>span:nth-child(n+11) { .badge-success { color: var(--white); - background-color: var(--badge-sfw); + background-color: var(--badge-sfw, #02500b); padding-right: 5px; padding-left: 5px; border-radius: 3px; @@ -7349,7 +7391,7 @@ span#tags:not(.tags-expanded) .tags-inner>span:nth-child(n+11) { .badge-danger { color: var(--white); - background-color: var(--badge-nsfw); + background-color: var(--badge-nsfw, #E10DC3); padding-right: 5px; padding-left: 5px; border-radius: 3px; @@ -12982,7 +13024,8 @@ div.posts>a.thumb[data-size="2"] { grid-row: span 2; } -.thumb>.preview-video { +.thumb>.preview-video, +.sidebar-video-thumb-wrap>.preview-video { position: absolute; top: 0; left: 0; @@ -12996,7 +13039,8 @@ div.posts>a.thumb[data-size="2"] { transition: opacity 0.2s ease-in; } -.thumb>.preview-video.playing { +.thumb>.preview-video.playing, +.sidebar-video-thumb-wrap>.preview-video.playing { opacity: 1; } @@ -13562,17 +13606,17 @@ body.layout-modern>.pagewrapper:not(:has(.index-layout-wrapper)):not(:has(.item- } #a_toggle.rating-btn.is-sfw { - background-color: var(--badge-sfw); + background-color: var(--badge-sfw, #02500b); border-color: rgba(0, 0, 0, 0.15); } #a_toggle.rating-btn.is-nsfw { - background-color: var(--badge-nsfw); + background-color: var(--badge-nsfw, #E10DC3); border-color: rgba(0, 0, 0, 0.15); } #a_toggle.rating-btn.is-nsfl { - background-color: var(--badge-nsfl); + background-color: var(--badge-nsfl, #660000); border-color: rgba(0, 0, 0, 0.15); } diff --git a/public/s/css/upload.css b/public/s/css/upload.css index c18f564..ae70b17 100644 --- a/public/s/css/upload.css +++ b/public/s/css/upload.css @@ -404,21 +404,21 @@ } .item-rating-option input:checked + .item-rating-label.sfw { - background: var(--badge-sfw); + background: var(--badge-sfw, #02500b); color: #fff; - border-color: var(--badge-sfw); + border-color: var(--badge-sfw, #02500b); } .item-rating-option input:checked + .item-rating-label.nsfw { - background: var(--badge-nsfw); + background: var(--badge-nsfw, #E10DC3); color: #fff; - border-color: var(--badge-nsfw); + border-color: var(--badge-nsfw, #E10DC3); } .item-rating-option input:checked + .item-rating-label.nsfl { - background: var(--badge-nsfl); + background: var(--badge-nsfl, #660000); color: #fff; - border-color: var(--badge-nsfl); + border-color: var(--badge-nsfl, #660000); } /* Visibility Container - Only checked option is colored, unchecked options are gray */ diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index b9048af..7a3e5e0 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -3340,8 +3340,18 @@ window.cancelAnimFrame = (function () { // Full page: Sync attributes (CRITICAL for fullscreen and theme state) ['theme', 'res'].forEach(attr => { const val = doc.documentElement.getAttribute(attr); - if (val !== null) document.documentElement.setAttribute(attr, val); - else document.documentElement.removeAttribute(attr); + if (attr === 'theme') { + if (val && val.trim()) { + document.documentElement.setAttribute('theme', val.trim()); + } else if (!document.documentElement.getAttribute('theme')) { + const cookieTheme = document.cookie.match(/(?:^|; )theme=([^;]*)/)?.[1]; + const fallback = (cookieTheme && decodeURIComponent(cookieTheme)) || window.f0ckDefaultTheme || 'amoled'; + document.documentElement.setAttribute('theme', fallback); + } + } else { + if (val !== null) document.documentElement.setAttribute(attr, val); + else document.documentElement.removeAttribute(attr); + } }); // Sync body classes (CRITICAL for layout triggers) @@ -4837,6 +4847,12 @@ window.cancelAnimFrame = (function () { loadItemAjax(`/user/${encodeURIComponent(wUserHallOwner)}/hall/${encodeURIComponent(wUserHall)}/${targetKey}`, true, { transition: 'fade-zoom' }); } else if (wFavsUser) { loadItemAjax(`/user/${encodeURIComponent(wFavsUser)}/favs/${targetKey}`, true, { transition: 'fade-zoom' }); + } else if (wTagMatch) { + const wTag = decodeURIComponent(wTagMatch[1]); + loadItemAjax(`/tag/${encodeURIComponent(wTag).replace(/%2C/g, ',').replace(/%20/g, ' ')}/${targetKey}`, true, { transition: 'fade-zoom' }); + } else if (wHallMatch) { + const wHall = decodeURIComponent(wHallMatch[1]); + loadItemAjax(`/h/${encodeURIComponent(wHall).replace(/%20/g, ' ')}/${targetKey}`, true, { transition: 'fade-zoom' }); } else { loadItemAjax(`/${targetKey}`, true, { transition: 'fade-zoom' }); } @@ -10369,6 +10385,8 @@ document.addEventListener("DOMContentLoaded", function () { // Sync UI immediately (Before AJAX) if (window.updateMimeLabel) window.updateMimeLabel(); + document.dispatchEvent(new CustomEvent('f0ck:mimeChanged', { detail: { mime: newMime } })); + // Trigger reload context-aware const fromModal = !!menu.closest('#excluded-tags-overlay'); const postsEl = document.querySelector('.posts, .tags-grid'); @@ -10656,6 +10674,8 @@ document.addEventListener('DOMContentLoaded', () => { if (activeThumb) { activeThumb.classList.remove('previewing'); activeThumb.classList.remove('touch-active'); + const card = activeThumb.closest('.sidebar-video-card'); + if (card) card.classList.remove('previewing'); activeThumb = null; } }; @@ -10677,7 +10697,7 @@ document.addEventListener('DOMContentLoaded', () => { if (mode === 'nsfw') shouldBlurThis = blurNsfw; else if (mode === 'nsfl') shouldBlurThis = blurNsfl; else if (mode === 'sfw') shouldBlurThis = blurSfw; - else if (mode === 'null' || !mode) shouldBlurThis = blurUntagged; + else if (mode === 'null' || mode === 'untagged' || !mode) shouldBlurThis = blurUntagged; if (shouldBlurThis && !thumb.classList.contains('revealed')) { return; @@ -10700,6 +10720,8 @@ document.addEventListener('DOMContentLoaded', () => { if (thumb !== activeThumb) return; activeThumb.classList.add('previewing'); + const card = activeThumb.closest('.sidebar-video-card'); + if (card) card.classList.add('previewing'); const video = document.createElement('video'); video.src = `/b/${file}`; @@ -10716,11 +10738,11 @@ document.addEventListener('DOMContentLoaded', () => { video.classList.add('playing'); }; - thumb.appendChild(video); + const container = thumb.classList.contains('sidebar-video-thumb-wrap') + ? thumb + : (thumb.querySelector('.sidebar-video-thumb-wrap') || thumb); + container.appendChild(video); activeVideo = video; - - // Note: Hover prefetching of the first 512 KB has been removed to prevent - // Chromium cache locks and validation loop stalls on subsequent playback. }; if (delay === 0) { @@ -10732,7 +10754,14 @@ document.addEventListener('DOMContentLoaded', () => { window.startHoverPreview = startPreview; const handleEnter = (e) => { - const thumb = e.target.closest('.thumb'); + let thumb = e.target.closest('.thumb'); + if (!thumb) { + // The playback can ONLY start when exactly hovering class="sidebar-video-thumb" + const imgThumb = e.target.closest('.sidebar-video-thumb'); + if (imgThumb) { + thumb = imgThumb.closest('.sidebar-video-thumb-wrap'); + } + } if (thumb && thumb !== activeThumb) { startPreview(thumb, 150); } @@ -10741,7 +10770,7 @@ document.addEventListener('DOMContentLoaded', () => { document.addEventListener('focusin', handleEnter); const handleLeave = (e) => { - const thumb = e.target.closest('.thumb'); + const thumb = e.target.closest('.thumb, .sidebar-video-thumb-wrap'); if (thumb) { if (e.type === 'mouseout' && e.relatedTarget && thumb.contains(e.relatedTarget)) return; clearPreview(); @@ -10757,7 +10786,13 @@ document.addEventListener('DOMContentLoaded', () => { let touchBlockClick = false; document.addEventListener('touchstart', (e) => { - const thumb = e.target.closest('.thumb'); + let thumb = e.target.closest('.thumb'); + if (!thumb) { + const imgThumb = e.target.closest('.sidebar-video-thumb'); + if (imgThumb) { + thumb = imgThumb.closest('.sidebar-video-thumb-wrap'); + } + } if (thumb) { // Only apply logic for items we want to preview @@ -10782,7 +10817,7 @@ document.addEventListener('DOMContentLoaded', () => { // Capture phase click listener to stop navigation if we just activated document.addEventListener('click', (e) => { if (touchBlockClick) { - const thumb = e.target.closest('.thumb'); + const thumb = e.target.closest('.thumb, .sidebar-video-thumb-wrap'); if (thumb && thumb === activeThumb) { e.preventDefault(); e.stopImmediatePropagation(); @@ -12768,6 +12803,40 @@ document.addEventListener('click', (e) => { return; } + // Title text click to edit + const titleText = e.target.closest('.item_title_text'); + if (titleText && !document.body.classList.contains('preview-as-user')) { + const container = titleText.closest('.item_title'); + if (container) { + const editWrap = container.querySelector('.info-title-edit-wrap'); + const input = container.querySelector('#info-title-input'); + if (editWrap && input) { + e.preventDefault(); + titleText.style.display = 'none'; + editWrap.style.display = 'flex'; + input.dataset.origVal = input.value; + input.focus(); + if (input.value) { + input.select(); + } + return; + } + } + } + + // Close title editor when clicking outside .item_title + const openTitleWrap = document.querySelector('.item_title .info-title-edit-wrap'); + if (openTitleWrap && openTitleWrap.style.display !== 'none' && !e.target.closest('.item_title')) { + const container = openTitleWrap.closest('.item_title'); + const textEl = container?.querySelector('.item_title_text'); + const input = container?.querySelector('#info-title-input'); + openTitleWrap.style.display = 'none'; + if (textEl) textEl.style.display = ''; + if (input && input.dataset.origVal !== undefined) { + input.value = input.dataset.origVal; + } + } + // Title save button const saveBtn = e.target.closest('#info-title-save'); if (saveBtn) { @@ -12798,13 +12867,26 @@ document.addEventListener('click', (e) => { saveBtn.disabled = false; saveBtn.innerHTML = origIcon; if (data.success) { - // Keep input form intact and update its value - input.value = data.title || ''; + const savedTitle = (data.title || '').trim(); + input.value = savedTitle; + input.dataset.origVal = savedTitle; // Update any plain-text title display element const textEl = container.querySelector('.item_title_text') || document.querySelector('.item_title_text'); if (textEl) { - textEl.textContent = data.title || ''; + if (savedTitle) { + textEl.textContent = savedTitle; + textEl.classList.remove('no-title'); + } else { + textEl.innerHTML = 'Add a title'; + textEl.classList.add('no-title'); + } + textEl.style.display = ''; + } + + const editWrap = container.querySelector('.info-title-edit-wrap'); + if (editWrap) { + editWrap.style.display = 'none'; } // Invalidate cache so navigating next/prev fetches fresh HTML from server @@ -12977,13 +13059,26 @@ document.addEventListener('click', (e) => { } }); - // Handle Enter key on title input + // Handle Enter and Escape key on title input document.addEventListener('keydown', (e) => { - if (e.key === 'Enter' && e.target && e.target.id === 'info-title-input') { - e.preventDefault(); - const container = e.target.closest('.item_title') || document; - const saveBtn = container.querySelector('#info-title-save') || document.getElementById('info-title-save'); - if (saveBtn) saveBtn.click(); + if (e.target && e.target.id === 'info-title-input') { + if (e.key === 'Enter') { + e.preventDefault(); + const container = e.target.closest('.item_title') || document; + const saveBtn = container.querySelector('#info-title-save') || document.getElementById('info-title-save'); + if (saveBtn) saveBtn.click(); + } else if (e.key === 'Escape') { + e.preventDefault(); + const container = e.target.closest('.item_title') || document; + const editWrap = container.querySelector('.info-title-edit-wrap'); + const textEl = container.querySelector('.item_title_text'); + const input = e.target; + if (editWrap) editWrap.style.display = 'none'; + if (textEl) textEl.style.display = ''; + if (input && input.dataset.origVal !== undefined) { + input.value = input.dataset.origVal; + } + } } }); diff --git a/public/s/js/sidebar-activity.js b/public/s/js/sidebar-activity.js index 187c936..9708737 100644 --- a/public/s/js/sidebar-activity.js +++ b/public/s/js/sidebar-activity.js @@ -1030,26 +1030,53 @@ let lastBoundMode = typeof window.activeMode !== 'undefined' ? window.activeMode : null; + const getCurrentMimeFilter = () => { + const urlParams = new URLSearchParams(window.location.search); + const qMime = urlParams.get('mime'); + if (qMime !== null) return qMime.trim(); + const cookieMime = document.cookie.split('; ').find(row => row.startsWith('mime=')); + if (cookieMime) { + const val = cookieMime.split('=')[1]; + if (typeof val === 'string') return decodeURIComponent(val).trim(); + } + return ''; + }; + + let lastBoundMime = getCurrentMimeFilter(); + // Handle AJAX item loads document.addEventListener('f0ck:contentLoaded', () => { const currentMode = typeof window.activeMode !== 'undefined' ? window.activeMode : null; const modeChanged = lastBoundMode !== null && lastBoundMode !== currentMode; lastBoundMode = currentMode; - window.f0ckDebug("Sidebar Activity: Page transition detected", modeChanged ? "(Mode changed)" : ""); + const currentMime = getCurrentMimeFilter(); + const mimeChanged = lastBoundMime !== null && lastBoundMime !== currentMime; + lastBoundMime = currentMime; - if (modeChanged) { - window._sidebarActivityCache = []; - lastRenderedIds = ''; - currentPage = 1; - hasMore = true; - loadActivity(false); // Force reload with loading state + window.f0ckDebug("Sidebar Activity: Page transition detected", modeChanged ? "(Mode changed)" : "", mimeChanged ? "(Mime changed)" : ""); + + if (modeChanged || mimeChanged) { + if (modeChanged) { + window._sidebarActivityCache = []; + lastRenderedIds = ''; + currentPage = 1; + hasMore = true; + loadActivity(false); // Force reload with loading state + } recommendationsLoaded = false; + tagFeedLoaded = false; + tagFeedNeedsReload = true; + const activeTabEl = document.querySelector('.sidebar-tab.active')?.dataset.tab; let savedTab = 'comments'; try { savedTab = localStorage.getItem('sidebar_active_tab'); } catch (_) {} - if (savedTab === 'videos') { - loadVideoRecommendations(false); + const currentTabName = activeTabEl || savedTab; + + if (currentTabName === 'videos' || currentTabName === 'recommendations') { + loadRecommendations(false); + } else if (currentTabName === 'tag' && currentTag) { + loadTagFeed(true); } } else { // Immediately render from cache to avoid flicker @@ -1059,6 +1086,27 @@ } }); + document.addEventListener('f0ck:mimeChanged', (e) => { + const newMime = (e.detail && typeof e.detail.mime !== 'undefined') ? e.detail.mime : getCurrentMimeFilter(); + window.f0ckDebug("Sidebar Activity: MIME filter changed", newMime); + lastBoundMime = newMime; + + recommendationsLoaded = false; + tagFeedLoaded = false; + tagFeedNeedsReload = true; + + const activeTabEl = document.querySelector('.sidebar-tab.active')?.dataset.tab; + let savedTab = 'comments'; + try { savedTab = localStorage.getItem('sidebar_active_tab'); } catch (_) {} + const currentTabName = activeTabEl || savedTab; + + if (currentTabName === 'videos' || currentTabName === 'recommendations') { + loadRecommendations(false); + } else if (currentTabName === 'tag' && currentTag) { + loadTagFeed(true); + } + }); + // Sync sidebar and comments-list layout on initial page load (Legacy View Only) if (typeof syncSidebarAndComments === 'function') { syncSidebarAndComments(); @@ -1074,7 +1122,7 @@ let recIoSentinel = null; let recObserver = null; - const renderVideoCard = (video) => { + const renderVideoCard = (video, options = {}) => { const videoKey = (window.f0ckSession?.enable_item_slugs && video.slug) ? video.slug : video.id; const rClass = video.rating_class || 'untagged'; const blurNsfw = localStorage.getItem('blurNsfw') === 'true'; @@ -1140,7 +1188,7 @@ `; } else { thumbContentHtml = ` - ${escapeHtml(displayTitle)} + ${escapeHtml(displayTitle)} @@ -1151,12 +1199,18 @@ ? ` For You` : ''; + const isTagFeed = options.isTagFeed || false; + const tagContext = options.tag || null; + const targetHref = (isTagFeed && tagContext) + ? `/tag/${encodeURIComponent(tagContext).replace(/%2C/g, ',').replace(/%20/g, ' ')}/${videoKey}` + : `/${videoKey}`; + const activeClass = options.isActive ? ' active-tag-item' : ''; + return ` -