directory: disable search autocomplete

This commit is contained in:
Evgeny Poberezkin
2025-09-21 19:15:10 +01:00
parent c09665b920
commit bfd9d79412
2 changed files with 5 additions and 5 deletions

View File

@@ -259,7 +259,7 @@ templateEngineOverride: njk
<p>SimpleX Directory is also available as a <a href="https://smp4.simplex.im/a#lXUjJW5vHYQzoLYgmi8GbxkGP41_kjefFvBrdwg-0Ok" target="_blank">SimpleX chat bot</a>.</p>
<p>Read about <a href="/docs/directory.html">how to add</a> your community</a>.</p>
<div class="search-container">
<input id="search">
<input id="search" autocomplete="off">
<div id="top-pagination" class="pagination">
<button class="text-btn live">Active</button>
<button class="text-btn new">New</button>

View File

@@ -22,11 +22,11 @@ async function initDirectory() {
allEntries = listing.entries
renderEntries('top', bySortPriority, topBtn)
searchInput.addEventListener('input', (e) => renderEntries('top', bySortPriority, topBtn, e.target.value.trim()));
liveBtn.addEventListener('click', () => renderEntries('live', byActiveAtDesc, liveBtn, ''));
newBtn.addEventListener('click', () => renderEntries('new', byCreatedAtDesc, newBtn, ''));
topBtn.addEventListener('click', () => renderEntries('top', bySortPriority, topBtn, ''));
liveBtn.addEventListener('click', () => renderEntries('live', byActiveAtDesc, liveBtn));
newBtn.addEventListener('click', () => renderEntries('new', byCreatedAtDesc, newBtn));
topBtn.addEventListener('click', () => renderEntries('top', bySortPriority, topBtn));
function renderEntries(mode, comparator, btn, search) {
function renderEntries(mode, comparator, btn, search = '') {
if (currentSortMode === mode && search == currentSearch) return;
currentSortMode = mode;
if (location.hash) location.hash = '';