Sami
Reorganized project structure and moved files from PROPUESTA_HOSPITALES_AI
17fcaeb
raw
history blame
1.76 kB
// Initialize Mermaid diagrams
document.addEventListener('DOMContentLoaded', () => {
if (window.mermaid) {
mermaid.initialize({
startOnLoad: true,
theme: 'neutral',
themeVariables: {
fontSize: '16px'
}
});
}
});
// Lazy loading for images
document.addEventListener('DOMContentLoaded', () => {
const images = document.querySelectorAll('img[loading="lazy"]');
if ('loading' in HTMLImageElement.prototype) {
images.forEach(img => {
img.src = img.dataset.src;
});
} else {
// Fallback for browsers that don't support lazy loading
const script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/lazysizes.min.js';
document.body.appendChild(script);
}
});
// Print optimization
const optimizePrint = () => {
const style = document.createElement('style');
style.textContent = `
@media print {
.no-print { display: none !important; }
a[href]:after { content: " (" attr(href) ")"; }
img { max-width: 500px !important; }
}
`;
document.head.appendChild(style);
};
// Initialize all components
const initComponents = () => {
// Initialize Lottie animations if present
if (window.lottie) {
document.querySelectorAll('.lottie-player').forEach(player => {
if (!player.hasAttribute('data-initialized')) {
player.setAttribute('data-initialized', 'true');
// Add any specific Lottie initialization here
}
});
}
};
// Export utilities
window.hospitalAI = {
optimizePrint,
initComponents
};