mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-21 09:03:02 +02:00
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:
+10
-1
@@ -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
@@ -1,4 +1,4 @@
|
||||
const CACHE_NAME = 'mc-webui-v8';
|
||||
const CACHE_NAME = 'mc-webui-v9';
|
||||
const ASSETS_TO_CACHE = [
|
||||
'/',
|
||||
'/static/css/style.css',
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user