/** * High-Res Image Booster
* Swaps Squarespace thumbnails for 840px versions for better visual quality
*/
(function() {
function boostImageQuality() {
const images = document.querySelectorAll('img[src*="295x166"], .grid-item-image');
images.forEach(img => {
const currentSrc = img.getAttribute('data-src') || img.getAttribute('src');
if (currentSrc && currentSrc.includes('295x166')) {
const highRes = currentSrc.replace('295x166', '840');
// Update both src and data-src to bypass Squarespace lazy-loading limits
img.setAttribute('src', highRes);
img.setAttribute('data-src', highRes);
img.classList.add('loaded');
}
});
}
// Run on load and every time the user scrolls/filters
window.addEventListener('load', boostImageQuality);
const qualityObserver = new MutationObserver(boostImageQuality);
qualityObserver.observe(document.body, { childList: true, subtree: true });
})();