Update index.html
Browse files- index.html +48 -0
index.html
CHANGED
|
@@ -207,6 +207,54 @@ window.DEFAULT_AUTOMOD = {
|
|
| 207 |
};
|
| 208 |
</script>
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
<script src="app.js"></script>
|
| 211 |
</body>
|
| 212 |
</html>
|
|
|
|
| 207 |
};
|
| 208 |
</script>
|
| 209 |
|
| 210 |
+
<!-- Search & Pins modals -->
|
| 211 |
+
<script>
|
| 212 |
+
async function openSearchModal() {
|
| 213 |
+
showModal(`
|
| 214 |
+
<div class="modal-title">馃攳 Nachrichten durchsuchen</div>
|
| 215 |
+
<div class="modal-field">
|
| 216 |
+
<label>Suchbegriff</label>
|
| 217 |
+
<input type="text" id="search-q" placeholder="Suche im aktuellen Channel..." oninput="liveSearch(this.value)">
|
| 218 |
+
</div>
|
| 219 |
+
<div id="search-results" style="max-height:300px;overflow-y:auto;margin-top:10px"></div>
|
| 220 |
+
<div class="modal-btns">
|
| 221 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schlie脽en</button>
|
| 222 |
+
</div>`);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
async function liveSearch(query) {
|
| 226 |
+
const results = document.getElementById('search-results');
|
| 227 |
+
if (!query || query.length < 2) { results.innerHTML = ''; return; }
|
| 228 |
+
const msgs = (await DB.get('msgs_' + currentChannel)) || [];
|
| 229 |
+
const found = msgs.filter(m => !m.system && m.text && m.text.toLowerCase().includes(query.toLowerCase()));
|
| 230 |
+
if (!found.length) { results.innerHTML = '<div style="color:var(--muted);text-align:center;padding:12px;font-size:.85rem">Keine Ergebnisse</div>'; return; }
|
| 231 |
+
results.innerHTML = found.slice(-20).map(m => `
|
| 232 |
+
<div style="padding:8px 0;border-bottom:1px solid var(--border)">
|
| 233 |
+
<div style="font-size:.72rem;color:var(--muted);font-family:Orbitron,monospace">${m.author} 路 ${new Date(m.ts).toLocaleDateString('de-DE')}</div>
|
| 234 |
+
<div style="font-size:.9rem;color:var(--text)">${escHtml(m.text).replace(new RegExp(escHtml(query),'gi'), s => `<mark style="background:rgba(0,212,255,0.2);color:var(--accent)">${s}</mark>`)}</div>
|
| 235 |
+
</div>`).join('');
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
async function openPinsModal() {
|
| 239 |
+
const pins = (await DB.get('pins')) || [];
|
| 240 |
+
const relevant = pins.filter(p => p.channel === currentChannel);
|
| 241 |
+
showModal(`
|
| 242 |
+
<div class="modal-title">馃搶 Angepinnte Nachrichten</div>
|
| 243 |
+
<div style="max-height:350px;overflow-y:auto">
|
| 244 |
+
${!relevant.length ? '<div style="color:var(--muted);text-align:center;padding:20px;font-size:.85rem">Keine angepinnten Nachrichten</div>' :
|
| 245 |
+
relevant.map(p => `
|
| 246 |
+
<div style="padding:10px 0;border-bottom:1px solid var(--border)">
|
| 247 |
+
<div style="font-size:.7rem;color:var(--muted);font-family:Orbitron,monospace">馃搶 ${p.author} 路 angeheftet von ${p.by}</div>
|
| 248 |
+
<div style="font-size:.9rem;color:var(--text);margin-top:4px">${escHtml(p.text)}</div>
|
| 249 |
+
</div>`).join('')}
|
| 250 |
+
</div>
|
| 251 |
+
<div class="modal-btns">
|
| 252 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schlie脽en</button>
|
| 253 |
+
</div>`);
|
| 254 |
+
}
|
| 255 |
+
</script>
|
| 256 |
+
|
| 257 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/1.5.4/peerjs.min.js"></script>
|
| 258 |
<script src="app.js"></script>
|
| 259 |
</body>
|
| 260 |
</html>
|