// static/programmer/js/recall.js const ImageModal = { modalId: 'imageModal', imageId: 'modalImage', titleId: 'modalTitle', open(imageUrl, title) { const modal = document.getElementById(this.modalId); const img = document.getElementById(this.imageId); const titleEl = document.getElementById(this.titleId); if (modal && img && titleEl) { img.src = imageUrl; img.alt = title || 'Просмотр изображения'; titleEl.textContent = title || 'Просмотр изображения'; modal.style.display = 'block'; } }, close() { const modal = document.getElementById(this.modalId); if (modal) { modal.style.display = 'none'; const img = document.getElementById(this.imageId); if (img) img.src = ''; } } }; // Обработчики для модального окна изображений document.addEventListener('DOMContentLoaded', () => { const modal = document.getElementById(ImageModal.modalId); if (modal) { modal.addEventListener('click', (event) => { if (event.target === modal) ImageModal.close(); }); } document.addEventListener('keydown', (event) => { if (event.key === 'Escape') ImageModal.close(); }); });