From 0e04e9f49f4b908c6c2b3a232660bf6864d3ba02 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sat, 23 May 2026 12:19:51 +0200 Subject: [PATCH] add file info button --- public/s/css/f0ckm.css | 52 ++++++++++++++++++++++++++++++++++ public/s/js/f0ckm.js | 37 +++++++++++++++++++++++- src/inc/locales/de.json | 17 +++++++++++ src/inc/locales/en.json | 17 +++++++++++ src/inc/locales/nl.json | 17 +++++++++++ src/inc/locales/zange.json | 17 +++++++++++ src/inc/routeinc/f0cklib.mjs | 1 + views/item-partial-legacy.html | 51 +++++++++++++++++++++++++++++---- views/item-partial-modern.html | 50 +++++++++++++++++++++++++++++--- 9 files changed, 249 insertions(+), 10 deletions(-) diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css index d2ab8f5..5a00502 100644 --- a/public/s/css/f0ckm.css +++ b/public/s/css/f0ckm.css @@ -14508,4 +14508,56 @@ body.scroller-active #gchat-reopen-bubble { to { text-shadow: 0 0 6px #f1c40f, 0 0 10px #f1c40f; } +} + +/* ============================================= + POST & FILE INFO MODAL STYLES + ============================================= */ +.info-table { + width: 100%; + border-collapse: collapse; + margin-top: 10px; +} + +.info-table th { + text-align: left; + padding: 8px 10px 8px 0; + font-weight: bold; + color: #fff; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + font-size: 0.9em; + width: 35%; +} + +.info-table td { + text-align: left; + padding: 8px 0; + color: #ccc; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + font-size: 0.9em; +} + +.info-table td a { + color: var(--accent, #9f0); + text-decoration: none; + font-weight: 600; +} + +.info-table td a:hover { + text-decoration: underline; +} + +.info-table td code { + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.1); + padding: 2px 6px; + border-radius: 4px; + font-family: monospace; + font-size: 0.85em; + color: #eee; +} + +.info-table tr:last-child th, +.info-table tr:last-child td { + border-bottom: none; } \ No newline at end of file diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index 6eb0e5d..ddc043b 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -529,7 +529,7 @@ window.cancelAnimFrame = (function () { 'login-modal', 'register-modal', 'forgot-modal', 'reset-modal', 'report-modal', 'halls-modal', 'metadata-modal', 'warning-modal', 'shortcuts-modal', 'upload-drag-modal', 'excluded-tags-overlay', - 'content-warning-modal', 'gchat-img-modal', 'image-modal' + 'content-warning-modal', 'gchat-img-modal', 'image-modal', 'info-modal' ]; modalIds.forEach(id => { const el = document.getElementById(id); @@ -910,6 +910,8 @@ window.cancelAnimFrame = (function () { closeModal(loginModal); closeModal(registerModal); closeModal(shortcutsModal); + const infoModal = document.getElementById('info-modal'); + if (infoModal) closeModal(infoModal); } }); @@ -8695,6 +8697,39 @@ if (navigator.vibrate) { } } }); + + // Post & File Info Modal Logic + document.addEventListener('click', (e) => { + const infoBtn = e.target.closest('#a_info'); + if (infoBtn) { + e.preventDefault(); + const modal = document.getElementById('info-modal'); + if (modal) { + modal.style.display = 'flex'; + document.body.classList.add('modal-open'); + } + return; + } + + const closeBtn = e.target.closest('#info-modal-close'); + if (closeBtn) { + e.preventDefault(); + const modal = document.getElementById('info-modal'); + if (modal) { + modal.style.display = 'none'; + document.body.classList.remove('modal-open'); + } + return; + } + + // Close when clicking outside modal content + const infoModal = document.getElementById('info-modal'); + if (infoModal && e.target === infoModal) { + infoModal.style.display = 'none'; + document.body.classList.remove('modal-open'); + } + }); + // Ensure any navigation event restores the scroll state window.addEventListener('pjax:start', () => { if (window.resetGlobalScrollState) window.resetGlobalScrollState(); diff --git a/src/inc/locales/de.json b/src/inc/locales/de.json index ce29325..0635ab4 100644 --- a/src/inc/locales/de.json +++ b/src/inc/locales/de.json @@ -518,6 +518,23 @@ "found": "Gefundene Metadaten:", "no_results": "Keine weiteren Metadaten in dieser Datei gefunden." }, + "info_modal": { + "title": "Post- & Datei-Informationen", + "button_title": "Post- & Datei-Informationen", + "id": "Post-ID", + "source": "Quelle", + "uploader": "Hochgeladen von", + "uploaded_at": "Hochgeladen am", + "file_size": "Dateigröße", + "mime_type": "MIME-Typ", + "rating": "Bewertung", + "oc": "Originaler Inhalt (OC)", + "no": "Nein", + "direct_url": "Direkt-Link", + "view_file": "Datei anzeigen", + "metadata": "Metadaten", + "sha256": "SHA-256-Hash" + }, "meme": { "add_text_layer": "Textebene hinzufügen", "tags_label": "Tags (kommagetrennt)", diff --git a/src/inc/locales/en.json b/src/inc/locales/en.json index 36315c7..5a8f456 100644 --- a/src/inc/locales/en.json +++ b/src/inc/locales/en.json @@ -522,6 +522,23 @@ "found": "Found in metadata:", "no_results": "No additional metadata fields found in this file." }, + "info_modal": { + "title": "Post & File Information", + "button_title": "Post & File Info", + "id": "Post ID", + "source": "Source", + "uploader": "Uploader", + "uploaded_at": "Uploaded At", + "file_size": "File Size", + "mime_type": "MIME Type", + "rating": "Rating", + "oc": "Original Content (OC)", + "no": "No", + "direct_url": "Direct URL", + "view_file": "View File", + "metadata": "Metadata", + "sha256": "SHA-256 Hash" + }, "meme": { "add_text_layer": "Add Text Layer", "tags_label": "Tags (comma separated)", diff --git a/src/inc/locales/nl.json b/src/inc/locales/nl.json index 236ac00..bd0c682 100644 --- a/src/inc/locales/nl.json +++ b/src/inc/locales/nl.json @@ -518,6 +518,23 @@ "found": "Gevonden in metadata:", "no_results": "Geen extra metadata-velden gevonden in dit bestand." }, + "info_modal": { + "title": "Post- & Bestandsinformatie", + "button_title": "Post- & Bestandsinformatie", + "id": "Post-ID", + "source": "Bron", + "uploader": "Uploader", + "uploaded_at": "Geüpload op", + "file_size": "Bestandsgrootte", + "mime_type": "MIME-type", + "rating": "Beoordeling", + "oc": "Originele Content (OC)", + "no": "Nee", + "direct_url": "Directe URL", + "view_file": "Bestand bekijken", + "metadata": "Metadata", + "sha256": "SHA-256 Hash" + }, "meme": { "add_text_layer": "Tekstlaag Toevoegen", "tags_label": "Tags (gescheiden door komma's)", diff --git a/src/inc/locales/zange.json b/src/inc/locales/zange.json index c2f5f46..6c0ac3d 100644 --- a/src/inc/locales/zange.json +++ b/src/inc/locales/zange.json @@ -521,6 +521,23 @@ "found": "In den Metadaten gefunden:", "no_results": "Keine weiteren Metadatenfelder in dieser Datei gefunden." }, + "info_modal": { + "title": "Pfosten- & Datei-Informationen", + "button_title": "Pfosten- & Datei-Informationen", + "id": "Pfosten-ID", + "source": "Quelle", + "uploader": "Hochgeladen von", + "uploaded_at": "Hochgeladen am", + "file_size": "Dateigröße", + "mime_type": "MIME-Typ", + "rating": "Bewertung", + "oc": "Originaler Inhalt (OC)", + "no": "Nein", + "direct_url": "Direkte Weltnetzadresse", + "view_file": "Datei betrachten", + "metadata": "Metadaten", + "sha256": "SHA-256-Streuwert" + }, "meme": { "add_text_layer": "Textebene hinzufügen", "tags_label": "Etiketten (kommagetrennt)", diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs index 7a2ba77..c020e05 100644 --- a/src/inc/routeinc/f0cklib.mjs +++ b/src/inc/routeinc/f0cklib.mjs @@ -636,6 +636,7 @@ export default { dest: actitem.mime === 'video/youtube' ? actitem.dest : `${cfg.websrv.paths.images}/${actitem.dest}`, mime: actitem.mime, size: lib.formatSize(actitem.size), + checksum: actitem.checksum, timestamp: { timeago: lib.timeAgo(new Date(actitem.stamp * 1e3).toISOString(), lang), timefull: new Date(actitem.stamp * 1e3).toISOString() diff --git a/views/item-partial-legacy.html b/views/item-partial-legacy.html index 7d5541a..a7af923 100644 --- a/views/item-partial-legacy.html +++ b/views/item-partial-legacy.html @@ -95,9 +95,8 @@ {{ item.id }} - @if(item.src.short)@if(!user_alternative_infobox) — @endif{{ item.src.short }}@endif @if(session && !user_alternative_infobox) — [{!! item.author_display_name || item.username || 'unknown' !!}] @endif - @if(item.is_oc)@if(!user_alternative_infobox || item.src.short) — @endifOC@endif + @if(item.is_oc)@if(!user_alternative_infobox) — @endifOC@endif @if(!user_alternative_infobox) — — @endif @if(halls_enabled && item.primaryHall) @@ -107,14 +106,14 @@ @endif - @if(session) -
+ @if(session) @if(user_has_favorited) @else @endif + @if(halls_enabled) @@ -133,8 +132,10 @@ @endif + @else + + @endif
- @endif @if(typeof item.tags !== "undefined") @@ -192,3 +193,43 @@ {{-- RIGHT SIDEBAR: recent activity (fixed to viewport) --}} + + diff --git a/views/item-partial-modern.html b/views/item-partial-modern.html index b3e71d3..2f2c883 100644 --- a/views/item-partial-modern.html +++ b/views/item-partial-modern.html @@ -107,7 +107,7 @@
- {{ item.id }}@if(item.src.short) — {{ item.src.short }}@endif @if(session) — [{!! item.author_display_name || item.username || 'unknown' !!}] @endif @if(item.is_oc) — OC@endif + {{ item.id }}@if(session) — [{!! item.author_display_name || item.username || 'unknown' !!}] @endif @if(item.is_oc) — OC@endif — @if(halls_enabled && item.primaryHall) @@ -115,13 +115,14 @@ — @endif - @if(session)
+ @if(session) @if(user_has_favorited) @else @endif + @if(can_manage_item) @@ -138,9 +139,10 @@ @endif - + @else + + @endif
- @endif @each(item.favorites as fav) @@ -162,4 +164,44 @@ {{-- RIGHT SIDEBAR: recent activity --}} +
+ + \ No newline at end of file