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.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Website: back-to-top button on every page (shown after one screen while scrolling, auto-hides on phones, hidden with the menu or lightbox open); JS minified at build
Federico Pereirac35aa6482bf0
diff --git a/web/build.mjs b/web/build.mjsindex 21cdd79..0c1ff60 100644--- a/web/build.mjs+++ b/web/build.mjs@@ -119,9 +119,10 @@ const PH_RE = /\[\[([A-Z][A-Z0-9_]*)\]\]/g;const notePh = (text, where) => { for (const m of String(text).matchAll(PH_RE)) placeholders.set(`${where}: [[${m[1]}]]`, true); return text; };const phIn = (text, where) => notePh(text, where).replace(PH_RE, '\u0001$1\u0001');const phOut = (html) => html.replace(/\u0001([A-Z0-9_]+)\u0001/g, '<mark class="ph">[[$1]]</mark>');-const jsSrc = src('site.js');+const minJs = (j) => j.split('\n').map((x) => x.trim()).filter((x) => x && !x.startsWith('//')).join('\n');+const jsSrc = minJs(src('site.js'));const jsUrl = hashed(Buffer.from(jsSrc), 'site', 'js');-const themeSrc = src('theme.js');+const themeSrc = minJs(src('theme.js'));const themeUrl = hashed(Buffer.from(themeSrc), 'theme', 'js');// ---------- images ----------@@ -393,6 +394,7 @@ const MOON = '<svg class="ts-moon" width="14" height="14" viewBox="0 0 24 24" fifunction themeSwitch(t) {return `<button type="button" class="theme-sw" role="switch" aria-checked="false"><span class="vh">${esc(t.pages.darkMode)}</span><span class="ts-ball" aria-hidden="true">${SUN}${MOON}</span></button>`;}+const toTop = (t) => `<button type="button" class="totop" hidden aria-label="${esc(t.pages.toTop)}"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 4h12M12 20V9M7 13l5-5 5 5"/></svg></button>`;function footer(t, page = 'home') {const l = t.lang;if (!footerJson) {@@ -407,7 +409,7 @@ function footer(t, page = 'home') {</div><p>${esc(t.footer)}</p></div>-</footer>`;+</footer>${toTop(t)}`;}const cols = (footerJson.columns || []).map((c, i) => `<nav class="fcol" aria-labelledby="fcol-${i}"><h2 id="fcol-${i}">${esc(loc(c.title, l))}</h2>@@ -432,7 +434,7 @@ ${langMenu(t, page, true)}</div></div></div>-</footer>`;+</footer>${toTop(t)}`;}const ICONS = ['M4 17l6-6-6-6M12 19h8', 'M12 3l8 4v5c0 5-3.5 8-8 9-4.5-1-8-4-8-9V7z', 'M3 12h18M12 3a14 14 0 010 18M12 3a14 14 0 000 18M12 3a9 9 0 110 18 9 9 0 010-18', 'M7 11V8a5 5 0 0110 0v3M5 11h14v10H5z', 'M4 6h16v12H4zM4 7l8 6 8-6', 'M4 5h16v14H4zM4 9h16M8 5v4'];@@ -788,7 +790,7 @@ ${(c.items || []).map((it) => {// 404 (English, noindex)write('404.html', render(tpl.notFound, {- img,+ img, js: jsUrl, toTop: toTop(dict.en),head: `<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Page not found · LordOS</title>diff --git a/web/i18n/pages.json b/web/i18n/pages.jsonindex 61e24df..1fcbbed 100644--- a/web/i18n/pages.json+++ b/web/i18n/pages.json@@ -118,7 +118,8 @@"mitLine": "LordOS is free software under the MIT license","menu": "Menu","closeMenu": "Close menu",- "contact": "Contact"+ "contact": "Contact",+ "toTop": "Back to top"},"es": {"navPaper": "Paper",@@ -239,7 +240,8 @@"mitLine": "LordOS es software libre con licencia MIT","menu": "Menú","closeMenu": "Cerrar menú",- "contact": "Contacto"+ "contact": "Contacto",+ "toTop": "Volver arriba"},"pt": {"navPaper": "Paper",@@ -360,6 +362,7 @@"mitLine": "LordOS é software livre sob a licença MIT","menu": "Menu","closeMenu": "Fechar menu",- "contact": "Contato"+ "contact": "Contato",+ "toTop": "Voltar ao topo"}}\ No newline at end of filediff --git a/web/src/404.html b/web/src/404.htmlindex 8face17..2dad893 100644--- a/web/src/404.html+++ b/web/src/404.html@@ -14,5 +14,7 @@<a class="btn btn-ghost" href="/pt/" hreflang="pt" lang="pt">LordOS em português</a></div></main>+{{{toTop}}}+<script src="{{{js}}}" defer></script></body></html>diff --git a/web/src/site.css b/web/src/site.cssindex 84ccf92..e93be2f 100644--- a/web/src/site.css+++ b/web/src/site.css@@ -135,6 +135,15 @@ body:has(.nav-cb:checked){overflow:hidden}@media (min-width:901px){.drawer,.nav-cb{display:none}}@media (prefers-reduced-motion:reduce){.dpanel,.scrim,.drawer{transition:none}}+/* back to top (shown by site.js) */+.totop{position:fixed;right:24px;bottom:24px;z-index:40;width:48px;height:48px;border:0;border-radius:12px;background:#6E4BFF;color:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 24px rgba(40,20,120,.35);cursor:pointer;opacity:0;transform:translateY(12px);pointer-events:none;transition:opacity .25s,transform .25s}+.totop[hidden]{display:none}+.totop.on{opacity:.85;transform:none;pointer-events:auto}+.totop:hover,.totop:focus-visible{opacity:1}+body:has(.nav-cb:checked) .totop,body:has(.lb[open]) .totop{display:none}+@media (max-width:640px){.totop{width:44px;height:44px;right:16px;bottom:16px}}+@media (prefers-reduced-motion:reduce){.totop{transition:none}}+/* buttons */.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 22px;border-radius:12px;font:700 16px/1.2 var(--ff);text-decoration:none;border:0;cursor:pointer;text-align:center}.btn-primary{background:var(--accent);color:#fff}.btn-primary:hover{background:var(--accent-hover);color:#fff}diff --git a/web/src/site.js b/web/src/site.jsindex 5ac9d6f..934374a 100644--- a/web/src/site.js+++ b/web/src/site.js@@ -132,6 +132,26 @@navState();}+ // back to top: shown after one screen while scrolling; on phones it hides again after 2.5 s idle+ var tt = $('.totop');+ if (tt) {+ tt.hidden = false;+ var ttBusy = false, ttIdle = null;+ var ttUpd = function () {+ ttBusy = false;+ var on = scrollY > innerHeight;+ tt.classList.toggle('on', on);+ clearTimeout(ttIdle);+ if (on && innerWidth <= 640) ttIdle = setTimeout(function () { tt.classList.remove('on'); }, 2500);+ };+ addEventListener('scroll', function () { if (!ttBusy) { ttBusy = true; requestAnimationFrame(ttUpd); } }, { passive: true });+ tt.addEventListener('click', function () {+ scrollTo({ top: 0, behavior: reduce ? 'auto' : 'smooth' });+ var h = $('main h1') || $('#main');+ if (h) { h.tabIndex = -1; h.focus({ preventScroll: true }); }+ });+ }+// language dropdowns: close on Escape or a click outsidevar dds = $$('.lang-dd');d.addEventListener('click', function (e) { dds.forEach(function (dd) { if (dd.open && !dd.contains(e.target)) dd.open = false; }); });