Velkomin í stafræna safn lífsögunnar minnar. Hér getur þú lesið lífssöguna á mismunandi háttum.
Velkomin í stafræna safn lífsögunnar minnar. Hér getur þú lesið lífssöguna á mismunandi háttum.
Spurðu mig um lífssögurnar
'); } // Keyboard shortcuts document.addEventListener('keydown', function(e) { // Cmd+K / Ctrl+K to open if ((e.metaKey || e.ctrlKey) && e.key === 'k') { e.preventDefault(); openGlobalSearch(); return; } const modal = document.getElementById('globalSearchModal'); if (!modal.classList.contains('active')) return; // ESC to close if (e.key === 'Escape') { e.preventDefault(); closeGlobalSearch(); return; } // Arrow key navigation const items = document.querySelectorAll('.gs-item'); if (items.length === 0) return; if (e.key === 'ArrowDown') { e.preventDefault(); selectedIndex = Math.min(selectedIndex + 1, items.length - 1); updateSelection(items); } else if (e.key === 'ArrowUp') { e.preventDefault(); selectedIndex = Math.max(selectedIndex - 1, -1); updateSelection(items); } else if (e.key === 'Enter' && selectedIndex >= 0) { e.preventDefault(); items[selectedIndex].click(); } }); // Update selection highlight function updateSelection(items) { items.forEach((item, index) => { if (index === selectedIndex) { item.classList.add('selected'); item.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); } else { item.classList.remove('selected'); } }); } // Search input handler with debouncing const searchInput = document.getElementById('globalSearchInput'); if (searchInput) { searchInput.addEventListener('input', function(e) { const query = e.target.value.trim(); // Clear previous timeout if (searchTimeout) { clearTimeout(searchTimeout); } // Debounce search (300ms) searchTimeout = setTimeout(() => { performSearch(query); }, 300); }); } // Expose functions to global scope window.clearRecentSearches = clearRecentSearches; })();