1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6 7 8(() => { 9 'use strict'; 10 11 12 13 document.body.onload = async () => { 14 // Init Status Message Modals 15 // Initialize and toggle modal if it exists 16 17 const modalElement = document.getElementById('messageModal'); 18 if (modalElement) { 19 //console.log(modalElement); 20 const myModal = new mdb.Modal(modalElement, {}); 21 myModal.toggle(); 22 } 23 }; 24 document.addEventListener("DOMContentLoaded", () => { 25 // Initialize Masonry layout 26 const grid = document.querySelector(".grid"); 27 if(grid) { 28 const masonry = new Masonry(grid, { 29 itemSelector: ".masonry-grid-item", // Ensure these match your HTML class 30 columnWidth: ".masonry-grid-item", // Use a consistent column width 31 percentPosition: true, // Makes Masonry responsive 32 }); 33 // Ensure layout updates after each image loads 34 const images = grid.querySelectorAll("img"); 35 let loadedImages = 0; 36 37 images.forEach((image) => { 38 image.addEventListener("load", () => { 39 loadedImages++; 40 if (loadedImages === images.length) { 41 masonry.layout(); // Layout Masonry after all images are loaded 42 } 43 }); 44 45 // Handle cached images (for browsers that may not fire 'load' events for cached images) 46 if (image.complete) { 47 image.dispatchEvent(new Event("load")); 48 } 49 }); 50 } 51 }); 52 53 54 // Handle window scroll event 55 window.onscroll = () => { 56 const scroll = window.scrollY || document.documentElement.scrollTop; 57 58 // Add or remove the "scrolled" class from the body based on scroll position 59 if (scroll >= 100) { 60 document.body.classList.add('scrolled'); 61 document.querySelector('.navbar').classList.add('top-nav-collapse'); 62 } else { 63 document.body.classList.remove('scrolled'); 64 document.querySelector('.navbar').classList.remove('top-nav-collapse'); 65 } 66 67 // Handle opacity of footer buttons based on scroll position 68 const footerButtons = document.querySelector('.footer-buttons'); 69 if (footerButtons) { 70 if (scroll > 300) { 71 footerButtons.style.opacity = '1'; 72 } else { 73 footerButtons.style.opacity = '0'; 74 } 75 } 76 }; 77})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.