| <!DOCTYPE html> |
| <html lang="ar" dir="rtl"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>AnesNT Search | محرك بحث الخصوصية</title> |
| <style> |
| :root { |
| --bg-color: #0a0a0a; |
| --surface-color: #171717; |
| --primary-color: #3b82f6; |
| --text-color: #ededed; |
| --text-muted: #a3a3a3; |
| --link-color: #60a5fa; |
| --border-color: #262626; |
| } |
| |
| body { |
| background-color: var(--bg-color); |
| color: var(--text-color); |
| font-family: 'Segoe UI', system-ui, sans-serif; |
| margin: 0; |
| padding: 0; |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| min-height: 100vh; |
| } |
| |
| .header-container { |
| width: 100%; |
| max-width: 800px; |
| padding: 50px 20px 20px; |
| text-align: center; |
| position: sticky; |
| top: 0; |
| background-color: rgba(10, 10, 10, 0.9); |
| backdrop-filter: blur(10px); |
| z-index: 1000; |
| } |
| |
| .brand-title { |
| font-size: 2.8rem; |
| font-weight: 900; |
| margin-bottom: 25px; |
| color: var(--text-color); |
| } |
| |
| .brand-title span { |
| color: var(--primary-color); |
| } |
| |
| .search-form { |
| display: flex; |
| gap: 12px; |
| max-width: 600px; |
| margin: 0 auto; |
| } |
| |
| .search-input { |
| flex: 1; |
| padding: 16px 24px; |
| border-radius: 50px; |
| border: 1px solid var(--border-color); |
| background-color: var(--surface-color); |
| color: var(--text-color); |
| font-size: 1.1rem; |
| transition: all 0.3s ease; |
| } |
| |
| .search-input:focus { |
| outline: none; |
| border-color: var(--primary-color); |
| box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); |
| } |
| |
| .search-button { |
| padding: 0 30px; |
| border-radius: 50px; |
| border: none; |
| background-color: var(--primary-color); |
| color: white; |
| font-size: 1.1rem; |
| font-weight: bold; |
| cursor: pointer; |
| transition: transform 0.2s, background-color 0.2s; |
| } |
| |
| .search-button:hover { |
| background-color: #2563eb; |
| transform: scale(1.02); |
| } |
| |
| .results-container { |
| width: 100%; |
| max-width: 800px; |
| padding: 20px; |
| box-sizing: border-box; |
| } |
| |
| .result-card { |
| background-color: var(--surface-color); |
| border: 1px solid var(--border-color); |
| padding: 20px; |
| border-radius: 12px; |
| margin-bottom: 16px; |
| transition: transform 0.2s; |
| } |
| |
| .result-card:hover { |
| transform: translateY(-2px); |
| border-color: #404040; |
| } |
| |
| .result-title { |
| font-size: 1.3rem; |
| margin: 0 0 8px 0; |
| } |
| |
| .result-title a { |
| color: var(--link-color); |
| text-decoration: none; |
| } |
| |
| .result-title a:hover { |
| text-decoration: underline; |
| } |
| |
| .result-url { |
| color: #34d399; |
| font-size: 0.9rem; |
| margin-bottom: 10px; |
| direction: ltr; |
| text-align: right; |
| white-space: nowrap; |
| overflow: hidden; |
| text-overflow: ellipsis; |
| } |
| |
| .result-content { |
| color: var(--text-muted); |
| line-height: 1.6; |
| font-size: 0.95rem; |
| margin: 0; |
| } |
| |
| .loading-spinner { |
| display: none; |
| width: 40px; |
| height: 40px; |
| margin: 40px auto; |
| border: 4px solid var(--border-color); |
| border-top: 4px solid var(--primary-color); |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| } |
| |
| .error-message { |
| color: #ef4444; |
| text-align: center; |
| padding: 20px; |
| background-color: rgba(239, 68, 68, 0.1); |
| border-radius: 8px; |
| margin-top: 20px; |
| } |
| |
| @keyframes spin { |
| 0% { transform: rotate(0deg); } |
| 100% { transform: rotate(360deg); } |
| } |
| </style> |
| </head> |
| <body> |
|
|
| <div class="header-container"> |
| <div class="brand-title">AnesNT <span>Search</span></div> |
| <div class="search-form"> |
| <input type="text" id="searchInput" class="search-input" placeholder="اكتب ما تبحث عنه هنا..." onkeypress="if(event.key === 'Enter') executeSearch()"> |
| <button class="search-button" onclick="executeSearch()">بحث</button> |
| </div> |
| <div id="spinner" class="loading-spinner"></div> |
| </div> |
|
|
| <div id="resultsArea" class="results-container"> |
| </div> |
|
|
| <script> |
| async function executeSearch() { |
| const queryInput = document.getElementById('searchInput').value.trim(); |
| const resultsArea = document.getElementById('resultsArea'); |
| const spinner = document.getElementById('spinner'); |
| |
| if (!queryInput) return; |
| |
| |
| resultsArea.innerHTML = ''; |
| spinner.style.display = 'block'; |
| |
| |
| |
| const API_ENDPOINT = `https://aneskam-xxklo.hf.space/search?q=${encodeURIComponent(queryInput)}&format=json`; |
| |
| |
| try { |
| const response = await fetch(API_ENDPOINT); |
| |
| if (!response.ok) { |
| throw new Error(`HTTP error! status: ${response.status}`); |
| } |
| |
| const data = await response.json(); |
| spinner.style.display = 'none'; |
| |
| if (data.results && data.results.length > 0) { |
| let resultsHTML = ''; |
| data.results.forEach(item => { |
| resultsHTML += ` |
| <div class="result-card"> |
| <h2 class="result-title"> |
| <a href="${item.url}" target="_blank" rel="noopener noreferrer">${item.title}</a> |
| </h2> |
| <div class="result-url">${item.url}</div> |
| <p class="result-content">${item.content || 'لا يتوفر وصف نصي لهذه النتيجة.'}</p> |
| </div> |
| `; |
| }); |
| resultsArea.innerHTML = resultsHTML; |
| } else { |
| resultsArea.innerHTML = '<div class="error-message" style="color: var(--text-muted); background: transparent;">لم يتم العثور على نتائج. جرب كلمات مفتاحية مختلفة.</div>'; |
| } |
| } catch (error) { |
| spinner.style.display = 'none'; |
| resultsArea.innerHTML = ` |
| <div class="error-message"> |
| <strong>تعذر الاتصال بمحرك البحث.</strong><br> |
| يرجى التأكد من تشغيل الخادم (Docker) وأن الرابط المدخل في الكود صحيح. |
| <br><small style="opacity:0.7;">تفاصيل الخطأ: ${error.message}</small> |
| </div> |
| `; |
| console.error("AnesNT Search API Error:", error); |
| } |
| } |
| </script> |
| </body> |
| </html> |