This commit is contained in:
2026-09-12 07:28:24 +02:00
parent b319a5aec2
commit 217f1be72d
7 changed files with 93 additions and 22 deletions
+1
View File
@@ -6486,6 +6486,7 @@ window.cancelAnimFrame = (function () {
if (window.f0ckSession) window.f0ckSession.strict_mode = strict.checked;
window.updateStrictLinks(strict.checked);
document.dispatchEvent(new CustomEvent('f0ck:strictChanged', { detail: { strict: strict.checked } }));
// Sync with server
fetch('/strict/' + (strict.checked ? 1 : 0));
+41 -5
View File
@@ -1044,6 +1044,12 @@
let lastBoundMime = getCurrentMimeFilter();
const isStrictMode = () => {
return !!(window.f0ckSession?.strict_mode || (localStorage.getItem('search_strict') === 'true') || window.location.search.includes('strict=1'));
};
let lastBoundStrict = isStrictMode();
// Handle AJAX item loads
document.addEventListener('f0ck:contentLoaded', () => {
const currentMode = typeof window.activeMode !== 'undefined' ? window.activeMode : null;
@@ -1054,9 +1060,13 @@
const mimeChanged = lastBoundMime !== null && lastBoundMime !== currentMime;
lastBoundMime = currentMime;
window.f0ckDebug("Sidebar Activity: Page transition detected", modeChanged ? "(Mode changed)" : "", mimeChanged ? "(Mime changed)" : "");
const currentStrict = isStrictMode();
const strictChanged = lastBoundStrict !== null && lastBoundStrict !== currentStrict;
lastBoundStrict = currentStrict;
if (modeChanged || mimeChanged) {
window.f0ckDebug("Sidebar Activity: Page transition detected", modeChanged ? "(Mode changed)" : "", mimeChanged ? "(Mime changed)" : "", strictChanged ? "(Strict changed)" : "");
if (modeChanged || mimeChanged || strictChanged) {
if (modeChanged) {
window._sidebarActivityCache = [];
lastRenderedIds = '';
@@ -1214,8 +1224,10 @@
const isTagFeed = options.isTagFeed || false;
const tagContext = options.tag || null;
const isStrict = isStrictMode();
const strictSuffix = (isTagFeed && isStrict) ? '?strict=1' : '';
const targetHref = (isTagFeed && tagContext)
? `/tag/${encodeURIComponent(tagContext).replace(/%2C/g, ',').replace(/%20/g, ' ')}/${videoKey}`
? `/tag/${encodeURIComponent(tagContext).replace(/%2C/g, ',').replace(/%20/g, ' ')}/${videoKey}${strictSuffix}`
: `/${videoKey}`;
const activeClass = options.isActive ? ' active-tag-item' : '';
@@ -1224,8 +1236,10 @@
<a href="${targetHref}" class="sidebar-video-link" data-mode="${rClass}" data-inherit-context="false">
<div class="sidebar-video-thumb-wrap" data-file="${escapeHtml(video.dest || '')}" data-mime="${escapeHtml(video.mime || '')}" data-ext="${escapeHtml(ext ? ext.toLowerCase() : '')}" data-mode="${rClass}">
${thumbContentHtml}
${formatBadge}
<span class="sidebar-video-badge rating-${rClass}">${rClass.toUpperCase()}</span>
<div class="sidebar-video-badges">
${formatBadge}
<span class="sidebar-video-badge rating-${rClass}">${rClass.toUpperCase()}</span>
</div>
</div>
<div class="sidebar-video-details">
<div class="sidebar-video-info">
@@ -1594,7 +1608,11 @@
try {
const mode = typeof window.activeMode !== 'undefined' ? window.activeMode : '';
const mime = getCurrentMimeFilter();
const isStrict = isStrictMode();
let url = `/api/v2/tag-feed?tag=${encodeURIComponent(currentTag)}&order=${tagOrder}&offset=${tagOffset}&limit=20&mode=${mode}`;
if (isStrict) {
url += `&strict=1`;
}
if (mime) {
url += `&mime=${encodeURIComponent(mime)}`;
}
@@ -1958,6 +1976,24 @@
}
});
// Handle strict mode toggle
document.addEventListener('f0ck:strictChanged', (e) => {
const currentStrict = (e.detail && typeof e.detail.strict !== 'undefined') ? !!e.detail.strict : isStrictMode();
window.f0ckDebug("Sidebar Activity: Strict mode change detected", currentStrict);
lastBoundStrict = currentStrict;
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 === 'tag' && currentTag) {
loadTagFeed(true);
}
});
// When the current user posts a comment, silently refresh sidebar to show it
document.addEventListener('f0ck:commentPosted', () => {
window.f0ckDebug("Sidebar Activity: Own comment posted, refreshing...");