document.addEventListener('DOMContentLoaded', function () { function killThemeLoader() { document.querySelectorAll('#preloader, .css3-spinner, .page-loader, .preloader') .forEach(function (el) { el.style.opacity = '0'; el.style.pointerEvents = 'none'; el.style.display = 'none'; }); } killThemeLoader(); document.body.removeAttribute('data-animation-in'); document.body.removeAttribute('data-animation-out'); document.body.removeAttribute('data-speed-in'); document.body.removeAttribute('data-speed-out'); document.body.removeAttribute('data-loader'); const overlay = document.getElementById('progressOverlay'); if (overlay) overlay.style.display = 'none'; const header = document.getElementById('header'); const headerHeight = header.offsetHeight; window.addEventListener('popstate', function () { var openModal = document.querySelector('.modal.show'); if (openModal) { bootstrap.Modal.getInstance(openModal).hide(); } }); document.querySelectorAll('.modal').forEach(function (modal) { modal.querySelectorAll('img').forEach(function (img) { if (img.closest('.portfolio-item')) return; const src = img.getAttribute('src'); if (src && src !== '') { img.setAttribute('data-src', src); img.removeAttribute('src'); } }); modal.addEventListener('show.bs.modal', function () { history.pushState({ modal: true }, ''); modal.querySelectorAll('img[data-src]').forEach(function (img) { img.setAttribute('src', img.getAttribute('data-src')); img.removeAttribute('data-src'); }); this.querySelector('.modal-dialog').style.marginTop = headerHeight + 'px'; }); }); const menuTrigger = document.getElementById('primary-menu-trigger'); if (menuTrigger) { menuTrigger.addEventListener('click', function () { header.classList.add('dark'); header.style.backgroundColor = '#000'; const primaryMenu = document.querySelector('.primary-menu'); if (primaryMenu) { primaryMenu.style.backgroundColor = '#000'; } }); } });