/* ** OID: [Property field="id"] ** Publish date: [Property field="publishdate"] ** Last modified: [Property field="lastmodifieddate"] */ var bcp_mostrar_modal_jsnativo = (IdSelectorModal) => { if (IdSelectorModal != null) { IdSelectorModal.removeAttribute('style'); setTimeout(function () { const modalCuerpo = IdSelectorModal.querySelector('.bcp_modal_cuerpo'); modalCuerpo.classList.add('bcp_modal_animacion_open'); modalCuerpo.setAttribute('ultimo-modal-visible', 'true'); document.querySelector('body').classList.add('bcp_overflow'); var posicion = document.querySelectorAll('.bcp_modal_cuerpo.bcp_modal_animacion_open').length; modalCuerpo.setAttribute('posicion-modal', posicion); modalCuerpo.focus(); }, 100); } else { console.error('no existe el elemento modal', IdSelectorModal); } }; var cerrar_modal_jsnativo = (modal_cuerpo) => { if (modal_cuerpo != null) { modal_cuerpo.classList.add('bcp_modal_animacion_close'); setTimeout(function () { var contenedor = fnGetParent(modal_cuerpo, '.bco_modal_contenedor'); contenedor.style.display = 'none'; modal_cuerpo.classList.remove('bcp_modal_animacion_close'); modal_cuerpo.classList.remove('bcp_modal_animacion_open'); modal_cuerpo.classList.remove('posicion-modal'); if (document.querySelector('.bcp_modal_cuerpo') != null) { document.querySelector('body').classList.remove('bcp_overflow'); } if (modal_cuerpo.querySelector('iframe') != null) { let descripcionFrame = modal_cuerpo.querySelector('.bcp_modal_descripcion iframe'); if (descripcionFrame) { descripcionFrame.removeAttribute('src'); } } }, 400); } }; document.addEventListener("DOMContentLoaded", () => { document.querySelectorAll('.bcp_modal_close').forEach(btn_close => { btn_close.addEventListener("click", (event) => { var modal_cuepo = fnGetParent(event.currentTarget, '.bcp_modal_cuerpo'); cerrar_modal_jsnativo(modal_cuepo); }); }); document.querySelectorAll('.bco_modal_contenedor').forEach(modal_contenedor => { modal_contenedor.addEventListener("click", (event) => { var modals = document.querySelectorAll('.bcp_modal_cuerpo.bcp_modal_animacion_open'); var modal = modals[modals.length - 1]; try { if (event.target.className.match('bco_modal_contenedor')) { cerrar_modal_jsnativo(modal); } } catch (error) { } }); }); document.addEventListener("keyup", (event) => { const ESC_KEY = "Escape"; if (event.key == ESC_KEY) { var modals = document.querySelectorAll('.bcp_modal_cuerpo.bcp_modal_animacion_open'); var modal = modals[modals.length - 1]; cerrar_modal_jsnativo(modal); } }); })