1document.addEventListener('DOMContentLoaded', function () { 2 const grid = document.getElementById('gif-gallery'); 3 if (!grid) return; 4 function setDimensions() { 5 const width = window.innerWidth; 6 const columns = width >= 2000 ? 7 : width >= 1500 ? 6 : width >= 1250 ? 5 : 7 width >= 840 ? 4 : width >= 750 ? 3 : width >= 350 ? 2 : 1; 8 const itemWidth = Math.max(1, (grid.clientWidth - 15 * (columns - 1)) / columns); 9 grid.querySelectorAll('.gif-grid-item').forEach(function (item) { 10 const img = item.querySelector('img'); 11 item.style.width = itemWidth + 'px'; 12 item.style.height = (Number(img.dataset.height) / Number(img.dataset.width) * itemWidth) + 'px'; 13 }); 14 } 15 setDimensions(); 16 const masonry = new Masonry(grid, { 17 itemSelector: '.gif-grid-item', columnWidth: '.gif-grid-item', gutter: 15 18 }); 19 grid.style.opacity = '1'; 20 grid.style.maxHeight = 'none'; 21 grid.addEventListener('feed:appended', function (event) { 22 setDimensions(); 23 masonry.appended(event.detail.items.filter(item => item.matches('.gif-grid-item'))); 24 masonry.layout(); 25 }); 26 let resizeTimer; 27 window.addEventListener('resize', function () { 28 clearTimeout(resizeTimer); 29 resizeTimer = setTimeout(function () { 30 setDimensions(); 31 masonry.layout(); 32 }, 150); 33 }); 34});
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.