Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Website: hero slideshow of ten real screenshots in the laptop, with pause/play, slide dots, pause on hover/focus/hidden tab and reduced-motion support

Federico Pereirad5be65d62b01
diff --git a/web/build.mjs b/web/build.mjs
index 3f03e36..4923130 100644
--- a/web/build.mjs
+++ b/web/build.mjs
@@ -455,11 +455,36 @@ ${featureList[i] ? `<a class="more" href="${pageUrl(l, 'features/' + featureList
write(path.join(pageUrl(l, 'home'), 'index.html'), render(tpl.home, {
...common('home'), features, showcase, teaser: teaser(t),
heroImg: (() => {
- // the desktop inside a laptop drawn in CSS; light and dark screenshots follow the theme
- const L = r('docs/screenshots/desktop-overview-light.png'), D = r('docs/screenshots/desktop-overview-dark.png');
- const im = (f, cls, eager) => { const s1 = webp(f, 720), s2 = webp(f, 1600); return `<img class="${cls}" src="${s2.url}" srcset="${s1.url} ${s1.w}w, ${s2.url} ${s2.w}w" sizes="(max-width: 1040px) 92vw, 920px" width="${s2.w}" height="${s2.h}" alt="${esc(t.pages.hero.alt)}"${eager ? ' fetchpriority="high"' : ' loading="lazy"'} decoding="async">`; };
- const pills = t.pages.hero.pills.map((p, k) => `<span class="pill p${k + 1}">${esc(p)}</span>`).join('');
- return `<div class="laptop"><div class="lp-screen"><span class="lp-cam" aria-hidden="true"></span><div class="lp-display">${im(L, 'lp-l', true)}${im(D, 'lp-d', false)}</div></div><div class="lp-base" aria-hidden="true"><span class="lp-notch"></span></div><p class="pills">${pills}</p></div>`;
+ // the desktop inside a laptop drawn in CSS, as a slideshow of real screenshots (site.js runs it;
+ // without JS only the first slide shows). Slide 1 has light and dark variants that follow the theme.
+ const cap = (f) => { const g = shots.find((x) => x.file === r(f)); return (g && g.caption && (g.caption[l] || g.caption.en)) || t.pages.hero.alt; };
+ const SLIDES = [
+ ['docs/screenshots/desktop-overview-light.png', 'docs/screenshots/desktop-overview-dark.png'],
+ ['docs/screenshots/files.png'], ['docs/screenshots/mail.png'], ['docs/screenshots/calendar.png'], ['docs/screenshots/photos.png'],
+ ['docs/screenshots/player.png'], ['docs/screenshots/settings-general.png'], ['docs/screenshots/monitor-network-map.png'],
+ ['docs/screenshots/store.png'], ['docs/screenshots/terminal.png'],
+ ].filter((v) => v.every((f) => fs.existsSync(r(f))));
+ const H = t.pages.hero;
+ const im = (f, cls, mode, alt) => {
+ const s1 = webp(r(f), 720), s2 = webp(r(f), 1600);
+ const set = `${s1.url} ${s1.w}w, ${s2.url} ${s2.w}w`;
+ const common = `${cls ? `class="${cls}" ` : ''}sizes="(max-width: 1040px) 92vw, 920px" width="${s2.w}" height="${s2.h}" alt="${esc(alt)}" decoding="async"`;
+ if (mode === 'eager') return `<img ${common} src="${s2.url}" srcset="${set}" fetchpriority="high">`;
+ if (mode === 'lazy') return `<img ${common} src="${s2.url}" srcset="${set}" loading="lazy">`;
+ return `<img ${common} data-src="${s2.url}" data-srcset="${set}">`; // loaded by site.js just before it shows
+ };
+ const n = SLIDES.length;
+ const slides = SLIDES.map((v, i) => {
+ const alt = i === 0 ? H.alt : cap(v[0]);
+ const imgs = v.length === 2 ? im(v[0], 'lp-l', 'eager', alt) + im(v[1], 'lp-d', 'lazy', alt) : im(v[0], '', 'deferred', alt);
+ return `<figure class="slide${i === 0 ? ' on' : ''}" role="group" aria-roledescription="slide" aria-label="${i + 1} ${esc(H.of)} ${n}"${i ? ' aria-hidden="true"' : ''}>${imgs}</figure>`;
+ }).join('');
+ const pause = '<svg class="i-pause" width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg>';
+ const play = '<svg class="i-play" width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M7 4.5v15a1 1 0 001.5.86l12-7.5a1 1 0 000-1.72l-12-7.5A1 1 0 007 4.5z"/></svg>';
+ const dots = SLIDES.map((v, i) => `<button type="button" aria-label="${esc(`${H.show} ${i + 1} ${H.of} ${n}: ${i === 0 ? H.alt : cap(v[0])}`)}"${i === 0 ? ' aria-current="true"' : ''}></button>`).join('');
+ const ctl = n > 1 ? `<div class="hero-ctl"><button type="button" class="hc-play" data-state="playing" data-pause="${esc(H.pause)}" data-play="${esc(H.play)}" aria-label="${esc(H.pause)}">${pause}${play}</button><div class="hc-dots" role="group" aria-label="${esc(H.choose)}">${dots}</div></div>` : '';
+ const pills = H.pills.map((p, k) => `<span class="pill p${k + 1}">${esc(p)}</span>`).join('');
+ return `<div class="laptop" id="hero-show" role="region" aria-roledescription="carousel" aria-label="${esc(H.carousel)}"><div class="lp-screen"><span class="lp-cam" aria-hidden="true"></span><div class="lp-display" aria-live="off">${slides}</div></div><div class="lp-base" aria-hidden="true"><span class="lp-notch"></span></div><p class="pills">${pills}</p>${ctl}</div>`;
})(),
fingerprint: FINGERPRINT, banner: l === 'en' ? banner() : '',
}, t));
diff --git a/web/i18n/pages.json b/web/i18n/pages.json
index dd786e8..9e91feb 100644
--- a/web/i18n/pages.json
+++ b/web/i18n/pages.json
@@ -103,7 +103,13 @@
"Boots in 16 s",
"Signed releases · Ed25519"
],
- "alt": "The LordOS desktop with Calendar, Files, Photos and Player open"
+ "alt": "The LordOS desktop with Calendar, Files, Photos and Player open",
+ "carousel": "Screens of LordOS",
+ "pause": "Pause the slideshow",
+ "play": "Play the slideshow",
+ "choose": "Choose a screen",
+ "show": "Show",
+ "of": "of"
}
},
"es": {
@@ -210,7 +216,13 @@
"Arranca en 16 s",
"Versiones firmadas · Ed25519"
],
- "alt": "El escritorio de LordOS con Calendario, Archivos, Fotos y Reproductor abiertos"
+ "alt": "El escritorio de LordOS con Calendario, Archivos, Fotos y Reproductor abiertos",
+ "carousel": "Pantallas de LordOS",
+ "pause": "Pausar las imágenes",
+ "play": "Reanudar las imágenes",
+ "choose": "Elegí una pantalla",
+ "show": "Mostrar",
+ "of": "de"
}
},
"pt": {
@@ -317,7 +329,13 @@
"Inicia em 16 s",
"Versões assinadas · Ed25519"
],
- "alt": "O desktop do LordOS com Calendário, Arquivos, Fotos e Player abertos"
+ "alt": "O desktop do LordOS com Calendário, Arquivos, Fotos e Player abertos",
+ "carousel": "Telas do LordOS",
+ "pause": "Pausar a apresentação",
+ "play": "Retomar a apresentação",
+ "choose": "Escolha uma tela",
+ "show": "Mostrar",
+ "of": "de"
}
}
}
\ No newline at end of file
diff --git a/web/src/site.css b/web/src/site.css
index 51bd3ee..f20d6f1 100644
--- a/web/src/site.css
+++ b/web/src/site.css
@@ -148,7 +148,20 @@ h1,h2,h3{text-wrap:balance}
.lp-screen{position:relative;background:#0D0D16;border-radius:22px 22px 8px 8px;padding:2.6% 2.6% 3.2%;box-shadow:0 0 0 1px #2B2A40,inset 0 0 0 2px #1C1B2C,0 40px 90px var(--shadow),0 6px 18px var(--shadow-2)}
.lp-cam{position:absolute;top:1.1%;left:50%;width:7px;height:7px;margin-left:-3.5px;border-radius:50%;background:#2A2940;box-shadow:inset 0 0 0 2px #1A1A28}
.lp-display{position:relative;overflow:hidden;border-radius:6px;background:var(--shot-bg);aspect-ratio:16/10}
-.lp-display img{display:block;width:100%;height:auto}
+.lp-display img{display:block;width:100%;height:100%;object-fit:cover}
+.slide{position:absolute;inset:0;margin:0;opacity:0;visibility:hidden;transition:opacity .6s ease,visibility 0s linear .6s}
+.slide.on{opacity:1;visibility:visible;transition:opacity .6s ease}
+.hero-ctl{display:none;align-items:center;justify-content:center;gap:10px;margin:14px 0 0}
+.jt .hero-ctl{display:flex}
+.hc-play{width:36px;height:36px;border-radius:50%;border:1.5px solid var(--chip-line);background:var(--surface);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
+.hc-play:hover{color:var(--brand)}
+.hc-play svg{display:none}
+.hc-play[data-state=playing] .i-pause,.hc-play[data-state=paused] .i-play{display:block}
+.hc-dots{display:flex;gap:2px}
+.hc-dots button{width:24px;height:24px;padding:0;border:0;background:transparent;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
+.hc-dots button::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--chip-line);transition:width .2s,background .2s}
+.hc-dots button[aria-current=true]::before{width:18px;border-radius:4px;background:var(--accent)}
+@media (prefers-reduced-motion:reduce){.jt .hero-ctl{display:none}.slide{transition:none}}
.lp-d{display:none!important}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .lp-l{display:none!important}:root:not([data-theme=light]) .lp-d{display:block!important}}
:root[data-theme=dark] .lp-l{display:none!important}
diff --git a/web/src/site.js b/web/src/site.js
index 0944bdb..0ed13e2 100644
--- a/web/src/site.js
+++ b/web/src/site.js
@@ -97,6 +97,51 @@
label();
}
+ // Home hero slideshow: crossfade every 3 s; pauses on hover, focus, hidden tab or the Pause button;
+ // off with prefers-reduced-motion (only the first screen shows). Loads each image just before it shows.
+ var show = $('#hero-show');
+ var reduce = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
+ if (show && !reduce) {
+ var slides = $$('.slide', show), dots = $$('.hc-dots button', show), pb = $('.hc-play', show), live = $('.lp-display', show);
+ var cur = 0, timer = null, user = false, hover = false, focus = false;
+ var load = function (i) {
+ $$('img[data-src]', slides[i]).forEach(function (im) {
+ im.srcset = im.getAttribute('data-srcset'); im.src = im.getAttribute('data-src');
+ im.removeAttribute('data-src'); im.removeAttribute('data-srcset');
+ });
+ };
+ var go = function (i) {
+ var n = slides.length;
+ i = (i + n) % n;
+ load(i); load((i + 1) % n);
+ slides.forEach(function (sl, k) { sl.classList.toggle('on', k === i); if (k === i) sl.removeAttribute('aria-hidden'); else sl.setAttribute('aria-hidden', 'true'); });
+ dots.forEach(function (dt, k) { if (k === i) dt.setAttribute('aria-current', 'true'); else dt.removeAttribute('aria-current'); });
+ cur = i;
+ };
+ var running = function () { return !user && !hover && !focus && !d.hidden; };
+ var sync = function () {
+ clearInterval(timer); timer = null;
+ if (running()) timer = setInterval(function () { go(cur + 1); }, 3000);
+ live.setAttribute('aria-live', running() ? 'off' : 'polite');
+ };
+ if (slides.length > 1) {
+ load(1);
+ show.addEventListener('mouseenter', function () { hover = true; sync(); });
+ show.addEventListener('mouseleave', function () { hover = false; sync(); });
+ show.addEventListener('focusin', function (e) { focus = e.target !== pb; sync(); });
+ show.addEventListener('focusout', function (e) { if (!show.contains(e.relatedTarget)) { focus = false; sync(); } });
+ d.addEventListener('visibilitychange', sync);
+ if (pb) pb.addEventListener('click', function () {
+ user = !user;
+ pb.setAttribute('data-state', user ? 'paused' : 'playing');
+ pb.setAttribute('aria-label', pb.getAttribute(user ? 'data-play' : 'data-pause'));
+ sync();
+ });
+ dots.forEach(function (dt, k) { dt.addEventListener('click', function () { go(k); sync(); }); });
+ sync();
+ }
+ }
+
// Paper: highlight the section being read in the table of contents
var tocLinks = $$('.toc a');
if (tocLinks.length && 'IntersectionObserver' in window) {