Update web/templates/search.html
This commit is contained in:
parent
1ab4cae0bf
commit
df900903e1
@ -9,34 +9,6 @@
|
||||
<div class="search-row">
|
||||
<input type="text" name="q" value="{{ q }}" placeholder="Type to search…" class="search-input" autofocus>
|
||||
<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 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
|
||||
// ===============================
|
||||
@ -254,7 +210,7 @@
|
||||
`It’s like looking for a matching sock. You find five that are “close enough,” but never the one you actually need.`,
|
||||
`It’s 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 you’re late. You check the counter, pockets, and finally… the fridge. Next to the milk.`,
|
||||
`It’s like walking around the house holding your phone in the air, trying to catch a Wi‑Fi signal that appears and vanishes at random.`,
|
||||
`It’s 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 you’re sure the book is “right here.” You scan up, down, left, right—then realize you’re in the wrong aisle.`,
|
||||
`It’s like following GPS: “Turn left now!” You miss it, circle the block, and the voice keeps politely “recalculating.”`,
|
||||
`It’s 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 ymd = today.getFullYear()*10000 + (today.getMonth()+1)*100 + today.getDate();
|
||||
|
||||
// 32‑bit xorshift PRNG for a good daily seed
|
||||
// 32-bit xorshift PRNG for a good daily seed
|
||||
function xorshift32(seed){
|
||||
let x = seed | 0;
|
||||
x ^= x << 13; x ^= x >>> 17; x ^= x << 5;
|
||||
@ -362,19 +318,6 @@
|
||||
</script>
|
||||
|
||||
<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 { display:none; padding:12px; }
|
||||
.dropdown-panel.open { display:block; }
|
||||
@ -412,14 +355,12 @@
|
||||
const fd = new FormData(form);
|
||||
const fields = [];
|
||||
for (const [k, v] of fd.entries()) {
|
||||
// sel[field]=on → capture "field"
|
||||
if (k.startsWith('sel[') && k.endsWith(']') && (v === 'on' || v === 'true' || v === '1')) {
|
||||
fields.push(k.slice(4, -1));
|
||||
}
|
||||
}
|
||||
const q = (qInput && qInput.value || '').trim();
|
||||
|
||||
// Store exactly what the user selected — NO default to ["subject"]
|
||||
try {
|
||||
localStorage.setItem('lastSearchQ', q);
|
||||
localStorage.setItem('lastSearchFields', JSON.stringify(fields));
|
||||
@ -428,7 +369,5 @@
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{% include "partials/announcement_modal.html" %}
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user