Revert to static JS site (Svelte built, but no CSR); Optimize images
@@ -11,3 +11,108 @@ if (saved) {
|
||||
root.setAttribute('data-theme', 'light');
|
||||
}
|
||||
}
|
||||
|
||||
// Theme toggle
|
||||
const themeToggle = document.getElementById('theme-toggle');
|
||||
if (themeToggle) {
|
||||
themeToggle.addEventListener('click', () => {
|
||||
const current = root.getAttribute('data-theme') || 'light';
|
||||
const next = current === 'light' ? 'dark' : 'light';
|
||||
root.setAttribute('data-theme', next);
|
||||
try {
|
||||
localStorage.setItem('theme', next);
|
||||
} catch (_) {}
|
||||
});
|
||||
}
|
||||
|
||||
// Lightbox (structure from Lightbox.svelte; we fill content and handle open/close)
|
||||
const dialog = document.querySelector('dialog.lightbox');
|
||||
const lbContent = dialog?.querySelector('.lb-content');
|
||||
const lbCaption = dialog?.querySelector('#lb-caption, .lb-caption');
|
||||
|
||||
function openLightbox(name, type, caption) {
|
||||
if (!dialog || !lbContent || !lbCaption) return;
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
if (type === 'video') {
|
||||
lbContent.innerHTML = `<video src="/assets/media/videos/${name}.mp4" controls autoplay><track kind="captions" src="/assets/media/videos/${name}-captions.vtt" default></video>`;
|
||||
} else {
|
||||
const srcset = (bp) =>
|
||||
type === 'image'
|
||||
? `/assets/media/${bp}/${name}@1x.webp 1x, /assets/media/${bp}/${name}.webp 2x`
|
||||
: `/assets/media/${bp}/${name}_still@1x.webp 1x, /assets/media/${bp}/${name}_still.webp 2x`;
|
||||
lbContent.innerHTML = `<picture>
|
||||
<source media="(min-width:1024px)" srcset="${srcset('desktop')}">
|
||||
<source media="(min-width:768px)" srcset="${srcset('tablet')}">
|
||||
<source media="(min-width:0px)" srcset="${srcset('mobile')}">
|
||||
<img src="/assets/media/thumbnail/${name}.webp" alt="">
|
||||
</picture>`;
|
||||
}
|
||||
lbCaption.textContent = caption || '';
|
||||
dialog.setAttribute('aria-hidden', 'false');
|
||||
dialog.showModal();
|
||||
}
|
||||
|
||||
function closeLightbox() {
|
||||
if (!dialog) return;
|
||||
document.body.style.overflow = '';
|
||||
if (lbContent) lbContent.innerHTML = '';
|
||||
if (lbCaption) lbCaption.textContent = '';
|
||||
dialog.setAttribute('aria-hidden', 'true');
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
if (dialog) {
|
||||
// Add event handlers
|
||||
dialog.querySelector('.lb-close').addEventListener('click', closeLightbox);
|
||||
dialog.querySelector('.lb-close').addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
closeLightbox();
|
||||
}
|
||||
});
|
||||
dialog.addEventListener('close', closeLightbox);
|
||||
dialog.addEventListener('cancel', closeLightbox);
|
||||
dialog.addEventListener('click', () => {
|
||||
if (e.target === dialog) dialog.close();
|
||||
});
|
||||
}
|
||||
|
||||
// Gallery items
|
||||
document.querySelectorAll('.gallery-item[data-name]').forEach((el) => {
|
||||
el.addEventListener('click', () => {
|
||||
const name = el.getAttribute('data-name');
|
||||
const type = el.getAttribute('data-type') || 'image';
|
||||
const caption = el.getAttribute('data-caption') || '';
|
||||
if (name) openLightbox(name, type, caption);
|
||||
});
|
||||
el.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
const name = el.getAttribute('data-name');
|
||||
const type = el.getAttribute('data-type') || 'image';
|
||||
const caption = el.getAttribute('data-caption') || '';
|
||||
if (name) openLightbox(name, type, caption);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Show video button (open lightbox with tour)
|
||||
const showVideoBtn = document.getElementById('show_video');
|
||||
if (showVideoBtn) {
|
||||
const openTour = () => {
|
||||
const name = showVideoBtn.getAttribute('data-name') || 'tour';
|
||||
const type = showVideoBtn.getAttribute('data-type') || 'video';
|
||||
const caption =
|
||||
showVideoBtn.getAttribute('data-caption') ||
|
||||
"Take the scenic route—explore your the home's highlights with a virtual walkthrough.";
|
||||
openLightbox(name, type, caption);
|
||||
};
|
||||
showVideoBtn.addEventListener('click', openTour);
|
||||
showVideoBtn.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
openTour();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 812 KiB |
|
Before Width: | Height: | Size: 347 KiB After Width: | Height: | Size: 217 KiB |
|
Before Width: | Height: | Size: 826 KiB After Width: | Height: | Size: 452 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 903 KiB After Width: | Height: | Size: 474 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 637 KiB After Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 630 KiB After Width: | Height: | Size: 372 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 494 KiB After Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 618 KiB After Width: | Height: | Size: 362 KiB |
|
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 294 KiB After Width: | Height: | Size: 188 KiB |
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 315 KiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 373 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 1005 KiB After Width: | Height: | Size: 581 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 538 KiB After Width: | Height: | Size: 261 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 748 KiB After Width: | Height: | Size: 423 KiB |
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 800 KiB After Width: | Height: | Size: 424 KiB |
|
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 770 KiB After Width: | Height: | Size: 362 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 826 KiB After Width: | Height: | Size: 442 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 688 KiB After Width: | Height: | Size: 344 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 423 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 21 KiB |