From df8797b92a279c724792ba9d31027a2837841fa1 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Mon, 25 May 2026 15:24:47 +0200 Subject: [PATCH] empty title still reserves the same space as set title for layout consistency --- public/s/css/f0ckm.css | 4 ++++ public/s/js/f0ckm.js | 28 +++++++++++----------------- views/item-partial-legacy.html | 4 ++-- views/item-partial-modern.html | 4 ++-- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css index 4a3da36..3382938 100644 --- a/public/s/css/f0ckm.css +++ b/public/s/css/f0ckm.css @@ -4281,6 +4281,10 @@ span.placeholder { position: relative; } +.item_title:empty::before { + content: '\00a0'; +} + .location { padding-left: 5px; } diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index e0195ab..3f1175c 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -9200,24 +9200,18 @@ if (navigator.vibrate) { saveBtn.innerHTML = origIcon; if (data.success) { // Update the live .item_title bar below the ID bar - let titleBar = document.querySelector('.item_title'); - if (data.title) { - if (titleBar) { - titleBar.textContent = data.title; - titleBar.style.display = ''; - } else { - // Create it if it doesn't exist yet - const idBar = document.querySelector('.item-main-content > ._204863'); - if (idBar) { - titleBar = document.createElement('div'); - titleBar.className = 'item_title'; - titleBar.textContent = data.title; - idBar.insertAdjacentElement('afterend', titleBar); - } + const titleBar = document.querySelector('.item_title'); + if (titleBar) { + titleBar.textContent = data.title || ''; + } else if (data.title) { + // Fallback: create it if somehow missing (e.g. enable_item_title was toggled) + const idBar = document.querySelector('.item-main-content > ._204863'); + if (idBar) { + const newBar = document.createElement('div'); + newBar.className = 'item_title'; + newBar.textContent = data.title; + idBar.insertAdjacentElement('afterend', newBar); } - } else { - // Title cleared - if (titleBar) titleBar.remove(); } if (status) { status.textContent = '✓ Saved'; diff --git a/views/item-partial-legacy.html b/views/item-partial-legacy.html index 389c734..1fff846 100644 --- a/views/item-partial-legacy.html +++ b/views/item-partial-legacy.html @@ -9,8 +9,8 @@
{{ link.main }}{{ item.id }}{{ link.suffix }}
- @if(enable_item_title && item.title) -
{!! item.title !!}
+ @if(enable_item_title) +
{!! item.title || '' !!}
@endif
diff --git a/views/item-partial-modern.html b/views/item-partial-modern.html index 3f3ab2a..463d65f 100644 --- a/views/item-partial-modern.html +++ b/views/item-partial-modern.html @@ -60,8 +60,8 @@
{{ link.main }}{{ item.id }}{{ link.suffix }}
- @if(enable_item_title && item.title) -
{!! item.title !!}
+ @if(enable_item_title) +
{!! item.title || '' !!}
@endif