diff --git a/docs_v1.0/doc_wasm/index.html b/docs_v1.0/doc_wasm/index.html index 94fbe16..ff380d5 100644 --- a/docs_v1.0/doc_wasm/index.html +++ b/docs_v1.0/doc_wasm/index.html @@ -39,6 +39,7 @@ html, body { height: 100%; }
Searching...
'; var results = []; for (var i = 0; i < MODULES.length; i++) { var m = MODULES[i]; @@ -171,18 +171,30 @@ async function fulltextSearch(q) { } } catch(e) {} } + var target = document.getElementById('search-results'); + if (!target) return; if (results.length === 0) { - el.innerHTML = 'No results for ' + escapeHtml(q) + '
'; + target.innerHTML = 'No results for ' + escapeHtml(q) + '
'; + el.innerHTML = 'No search results
'; return; } - var html = '' + results.length + ' result(s)
'; + var html = '' + results.length + ' result(s) for ' + escapeHtml(q) + '
'; for (var r of results) { - html += ''
- + r.module + ' ' + escapeHtml(r.title) + ' line ' + r.line + '
'
- + '
' + results.length + ' result(s) — click a result in the sidebar to open
'; +} + +function showSearchResult(module) { + document.getElementById('search').value = ''; + document.getElementById('search-results').style.display = 'none'; + document.getElementById('module-list').style.display = ''; + loadDoc(module); } async function loginUser(user, pass) { @@ -233,14 +245,25 @@ async function initApp() { // Search — full text across all modules var searchTimer = null; var searchEl = document.getElementById('search'); + var searchResultsEl = document.getElementById('search-results'); + var moduleListEl = document.getElementById('module-list'); if (searchEl) { searchEl.oninput = function() { var q = this.value.toLowerCase().trim(); - document.querySelectorAll('#module-list a').forEach(function(a) { - a.style.display = a.textContent.toLowerCase().indexOf(q) >= 0 ? '' : 'none'; - }); + if (q.length < 2) { + moduleListEl.style.display = ''; + searchResultsEl.style.display = 'none'; + document.querySelectorAll('#module-list a').forEach(function(a) { + a.style.display = a.textContent.toLowerCase().indexOf(q) >= 0 ? '' : 'none'; + }); + if (searchTimer) clearTimeout(searchTimer); + if (!q) loadDoc(location.hash.slice(1) || '01_auth'); + return; + } + moduleListEl.style.display = 'none'; + searchResultsEl.style.display = 'block'; + searchResultsEl.innerHTML = 'Searching...
'; if (searchTimer) clearTimeout(searchTimer); - if (q.length < 2) { loadDoc(location.hash.slice(1) || '01_auth'); return; } searchTimer = setTimeout(function() { fulltextSearch(q); }, 300); }; }