// 문서 검색 기능 function searchDocuments() { const searchTerm = document.getElementById('searchInput').value.toLowerCase(); if (searchTerm.trim() === '') { alert('검색어를 입력해주세요.'); return; } // 간단한 검색 구현 (실제로는 서버 검색 또는 더 복잡한 로직 필요) window.location.href = `search.html?q=${encodeURIComponent(searchTerm)}`; } // 문서 필터링 기능 (문서 목록 페이지용) function filterDocuments(searchTerm) { const documents = document.querySelectorAll('.document-item'); const term = searchTerm.toLowerCase(); documents.forEach(doc => { const keywords = doc.getAttribute('data-keywords').toLowerCase(); const title = doc.querySelector('h3').textContent.toLowerCase(); const description = doc.querySelector('p').textContent.toLowerCase(); if (keywords.includes(term) || title.includes(term) || description.includes(term)) { doc.style.display = 'flex'; } else { doc.style.display = 'none'; } }); } // QR 코드 생성 (선택사항) function generateQR() { const url = 'http://192.168.0.3:10080'; const qrAPI = `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(url)}`; const qrModal = document.createElement('div'); qrModal.innerHTML = `

QR 코드로 접속

QR Code

${url}

`; document.body.appendChild(qrModal); } // Enter 키 검색 document.addEventListener('DOMContentLoaded', function() { const searchInput = document.getElementById('searchInput'); if (searchInput) { searchInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { searchDocuments(); } }); } });