Maybe working divider

This commit is contained in:
tyler
2026-05-19 00:02:29 -04:00
parent 541d98f7f1
commit e46c752aec
+18 -8
View File
@@ -877,17 +877,27 @@ FRONTEND_JS_TEMPLATE = r"""
const box = document.getElementById('sxng-stream-box'); const box = document.getElementById('sxng-stream-box');
const data = document.getElementById('sxng-stream-data'); const data = document.getElementById('sxng-stream-data');
// Hide native SearXNG answer entries that are siblings of our box
setTimeout(() => { setTimeout(() => {
const parent = box ? box.parentElement : null; const ourWrapper = box ? box.closest('.answer') : null;
if (parent) { const answersDiv = document.getElementById('answers');
Array.from(parent.children).forEach(el => { if (!ourWrapper || !answersDiv) return;
if (el !== box && el.classList.contains('answer')) {
el.style.display = 'none'; let hasVisibleAbove = false;
let found = false;
Array.from(answersDiv.children).forEach(el => {
if (el === ourWrapper) { found = true; return; }
if (!found && el.classList.contains('answer')) {
// This is a native answer sibling above us
hasVisibleAbove = true;
} }
}); });
if (hasVisibleAbove) {
box.style.borderTop = '1px solid var(--color-result-border, #4c566a)';
box.style.paddingTop = '1rem';
box.style.marginTop = '0.75rem';
} }
}, 0); }, 50);
let restored = false; let restored = false;
let isStreaming = false; let isStreaming = false;
@@ -2040,7 +2050,7 @@ class SXNGPlugin(Plugin):
.replace("__JS_Q__", js_q) .replace("__JS_Q__", js_q)
html_payload = f''' html_payload = f'''
<article id="sxng-stream-box" class="answer" style="display:none; margin-top: 1rem; margin-bottom: 0; border-top: 1px solid var(--color-result-border, #4c566a); padding-top: 1rem;"> <article id="sxng-stream-box" class="answer" style="display:none; margin-top: 0; margin-bottom: 0;">
<style> <style>
@keyframes sxng-fade-pulse {{ @keyframes sxng-fade-pulse {{
0%, 100% {{ opacity: 0.1; }} 0%, 100% {{ opacity: 0.1; }}