Update web/templates/search.html

This commit is contained in:
Joshua Laymon 2025-09-07 17:55:59 +00:00
parent 1ab4cae0bf
commit df900903e1

View File

@ -9,34 +9,6 @@
<div class="search-row"> <div class="search-row">
<input type="text" name="q" value="{{ q }}" placeholder="Type to search…" class="search-input" autofocus> <input type="text" name="q" value="{{ q }}" placeholder="Type to search…" class="search-input" autofocus>
<button class="btn btn-primary">Search</button> <button class="btn btn-primary">Search</button>
<!-- Help button -->
<button
class="btn btn-secondary help-toggle"
type="button"
data-target="#search-help-panel"
>
Help
</button>
</div>
<!-- Help panel -->
<div id="search-help-panel" class="help-panel">
<h3>How to Use Search Operators</h3>
<ul>
<li><strong>Simple keyword</strong> — type any word to find entries that contain it.<br>
<em>Example:</em> <code>faith</code></li>
<li><strong>Phrase search</strong> — put quotes around a phrase to match it exactly.<br>
<em>Example:</em> <code>"Jehovah is my shepherd"</code></li>
<li><strong>OR search</strong> — use <code>OR</code> (uppercase).<br>
<em>Example:</em> <code>love OR kindness</code></li>
<li><strong>Exclude terms</strong> — use <code>-</code> to remove.<br>
<em>Example:</em> <code>hope -future</code></li>
<li><strong>Wildcard search</strong> — use <code>*</code>.<br>
<em>Example:</em> <code>lov*</code></li>
<li><strong>Scripture search</strong> — type a Bible book.<br>
<em>Example:</em> <code>John 3:16</code></li>
</ul>
</div> </div>
<div class="filter-row"> <div class="filter-row">
@ -225,22 +197,6 @@
}); });
}); });
// Help panel toggle (unchanged)
document.addEventListener('click', function(e){
const btn = e.target.closest('.help-toggle');
if (btn) {
const panel = document.querySelector(btn.dataset.target || '#search-help-panel');
if (panel) panel.classList.toggle('open');
return;
}
const panel = document.querySelector('#search-help-panel');
if (!panel) return;
if (panel.classList.contains('open')) {
const clickedInside = panel.contains(e.target) || e.target.closest('.help-toggle');
if (!clickedInside) panel.classList.remove('open');
}
});
// =============================== // ===============================
// No-results: show a random funny illustration // No-results: show a random funny illustration
// =============================== // ===============================
@ -254,7 +210,7 @@
`Its like looking for a matching sock. You find five that are “close enough,” but never the one you actually need.`, `Its like looking for a matching sock. You find five that are “close enough,” but never the one you actually need.`,
`Its like running into the store for peanut butter. You leave with bread, bananas, cereal, and gum—somehow no peanut butter.`, `Its like running into the store for peanut butter. You leave with bread, bananas, cereal, and gum—somehow no peanut butter.`,
`It feels like searching for your car keys when youre late. You check the counter, pockets, and finally… the fridge. Next to the milk.`, `It feels like searching for your car keys when youre late. You check the counter, pockets, and finally… the fridge. Next to the milk.`,
`Its like walking around the house holding your phone in the air, trying to catch a WiFi signal that appears and vanishes at random.`, `Its like walking around the house holding your phone in the air, trying to catch a Wi-Fi signal that appears and vanishes at random.`,
`Imagine a giant library where youre sure the book is “right here.” You scan up, down, left, right—then realize youre in the wrong aisle.`, `Imagine a giant library where youre sure the book is “right here.” You scan up, down, left, right—then realize youre in the wrong aisle.`,
`Its like following GPS: “Turn left now!” You miss it, circle the block, and the voice keeps politely “recalculating.”`, `Its like following GPS: “Turn left now!” You miss it, circle the block, and the voice keeps politely “recalculating.”`,
`Its like trying to find an umbrella on a sunny day—no luck. The moment it pours, suddenly you own five.`, `Its like trying to find an umbrella on a sunny day—no luck. The moment it pours, suddenly you own five.`,
@ -284,7 +240,7 @@
const today = new Date(); const today = new Date();
const ymd = today.getFullYear()*10000 + (today.getMonth()+1)*100 + today.getDate(); const ymd = today.getFullYear()*10000 + (today.getMonth()+1)*100 + today.getDate();
// 32bit xorshift PRNG for a good daily seed // 32-bit xorshift PRNG for a good daily seed
function xorshift32(seed){ function xorshift32(seed){
let x = seed | 0; let x = seed | 0;
x ^= x << 13; x ^= x >>> 17; x ^= x << 5; x ^= x << 13; x ^= x >>> 17; x ^= x << 5;
@ -362,19 +318,6 @@
</script> </script>
<style> <style>
/* Help panel */
.help-panel{
display:none;
margin-top:10px;
background:#fff;
border:1px solid var(--border);
border-radius:12px;
padding:14px;
box-shadow:0 4px 16px rgba(0,0,0,.06);
font-size:14px;
}
.help-panel.open{ display:block; }
/* Dropdown panel */ /* Dropdown panel */
.dropdown-panel { display:none; padding:12px; } .dropdown-panel { display:none; padding:12px; }
.dropdown-panel.open { display:block; } .dropdown-panel.open { display:block; }
@ -412,14 +355,12 @@
const fd = new FormData(form); const fd = new FormData(form);
const fields = []; const fields = [];
for (const [k, v] of fd.entries()) { for (const [k, v] of fd.entries()) {
// sel[field]=on → capture "field"
if (k.startsWith('sel[') && k.endsWith(']') && (v === 'on' || v === 'true' || v === '1')) { if (k.startsWith('sel[') && k.endsWith(']') && (v === 'on' || v === 'true' || v === '1')) {
fields.push(k.slice(4, -1)); fields.push(k.slice(4, -1));
} }
} }
const q = (qInput && qInput.value || '').trim(); const q = (qInput && qInput.value || '').trim();
// Store exactly what the user selected — NO default to ["subject"]
try { try {
localStorage.setItem('lastSearchQ', q); localStorage.setItem('lastSearchQ', q);
localStorage.setItem('lastSearchFields', JSON.stringify(fields)); localStorage.setItem('lastSearchFields', JSON.stringify(fields));
@ -428,7 +369,5 @@
})(); })();
</script> </script>
{% include "partials/announcement_modal.html" %} {% include "partials/announcement_modal.html" %}
{% endblock %} {% endblock %}