fix(search): remove double hash in channel names, add FTS5 syntax help

Channel names from device already include # prefix — removed hardcoded #
from search results badge. Added (?) help button with search syntax
examples and link to FTS5 docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-13 07:38:37 +01:00
parent d74a1572bb
commit 9a0d05ae93
3 changed files with 26 additions and 2 deletions
+10 -1
View File
@@ -3777,6 +3777,15 @@ function initializeSearch() {
const btn = document.getElementById('searchBtn');
if (!input || !btn) return;
// Toggle search help
const helpBtn = document.getElementById('searchHelpBtn');
const helpPanel = document.getElementById('searchHelp');
if (helpBtn && helpPanel) {
helpBtn.addEventListener('click', () => {
helpPanel.style.display = helpPanel.style.display === 'none' ? '' : 'none';
});
}
// Search on Enter or button click
btn.addEventListener('click', () => performSearch(input.value));
input.addEventListener('keydown', (e) => {
@@ -3842,7 +3851,7 @@ async function performSearch(query) {
item.innerHTML = `
<div class="d-flex justify-content-between align-items-start">
<div>
<span class="badge bg-primary me-1">#${escapeHtml(r.channel_name || '')}</span>
<span class="badge bg-primary me-1">${escapeHtml(r.channel_name || '')}</span>
<strong class="small">${r.is_own ? 'You' : escapeHtml(r.sender || '')}</strong>
</div>
<small class="text-muted">${time}</small>
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = 'mc-webui-v8';
const CACHE_NAME = 'mc-webui-v9';
const ASSETS_TO_CACHE = [
'/',
'/static/css/style.css',
+15
View File
@@ -417,6 +417,21 @@
<button class="btn btn-primary" type="button" id="searchBtn">
<i class="bi bi-search"></i>
</button>
<button class="btn btn-outline-secondary" type="button" id="searchHelpBtn" title="Search syntax help">
<i class="bi bi-question-circle"></i>
</button>
</div>
<div id="searchHelp" class="alert alert-light small mb-3" style="display:none;">
<strong>Search tips:</strong>
<ul class="mb-1 ps-3">
<li><code>hello world</code> — messages containing both words</li>
<li><code>"hello world"</code> — exact phrase</li>
<li><code>hello OR world</code> — either word</li>
<li><code>hello NOT world</code> — hello but not world</li>
<li><code>hell*</code> — prefix match (hello,hellas...)</li>
</ul>
<div class="text-muted">Special characters (<code>. , - :</code>) should be wrapped in quotes.<br>
<a href="https://www.sqlite.org/fts5.html#full_text_query_syntax" target="_blank" rel="noopener">Full FTS5 syntax reference <i class="bi bi-box-arrow-up-right"></i></a></div>
</div>
<div id="searchResults">
<div class="text-center text-muted py-4">