From a9871187abcce858b98d51b62c447c2a40063239 Mon Sep 17 00:00:00 2001 From: x Date: Sat, 24 Jan 2026 01:35:30 +0100 Subject: [PATCH] numeric tag entry point fix potential --- public/s/js/f0ck.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/s/js/f0ck.js b/public/s/js/f0ck.js index f6bc01d..42c9157 100644 --- a/public/s/js/f0ck.js +++ b/public/s/js/f0ck.js @@ -203,20 +203,22 @@ window.requestAnimFrame = (function () { const navbar = document.querySelector("nav.navbar"); if (navbar) navbar.classList.add("pbwork"); - // Extract item ID from URL. Regex now handles query params, hashes, and trailing slashes. - const match = url.match(/\/(\d+)(?:\/|#|\?|$)/); + // Extract item ID from URL. Use the last numeric segment to avoid matching context IDs (like tag/1/...) + // Split path, filter numeric, pop last. + const pathSegments = new URL(url, window.location.origin).pathname.split('/'); + const numericSegments = pathSegments.filter(s => /^\d+$/.test(s)); // Hide navbar pagination for Item View (matches SSR) const navPag = document.querySelector('.pagination-container-fluid'); if (navPag) navPag.style.display = 'none'; - if (!match) { + if (numericSegments.length === 0) { console.warn("loadItemAjax: No ID match found in URL", url); // fallback for weird/external links window.location.href = url; return; } - const itemid = match[1]; + const itemid = numericSegments.pop(); // // Extract context from Target URL first