diff --git a/carino-lang.js b/carino-lang.js index f40ddf7..f639ef3 100644 --- a/carino-lang.js +++ b/carino-lang.js @@ -221,9 +221,11 @@ /* ---- UI ---- */ - // The shield link to carino.systems/legal.html (#cnLegal) sits in every - // header, shared or bespoke. Its tooltip is translated here, the one script - // all of those headers load, rather than in each site's own dictionary. + // The shield (#cnLegal) sits in every header, shared or bespoke. Its + // tooltip is translated here, the one script all of those headers load, + // rather than in each site's own dictionary. In the shared navbar it is a + // button, About, that opens the about popup and names itself; a bespoke header's shield is + // still a plain link to carino.systems/legal.html. var LEGAL = { en: 'Legal notice & privacy', es: 'Aviso legal y privacidad', 'pt-BR': 'Aviso legal e privacidade', ja: '法的通知とプライバシー', ru: 'Правовая информация и конфиденциальность' }; @@ -250,7 +252,8 @@ btn.setAttribute('aria-label', btn.title); } var legal = document.getElementById('cnLegal'); - if (legal) { legal.title = LEGAL[current] || LEGAL.en; legal.setAttribute('aria-label', legal.title); } + // the shared navbar's About button names itself; only a plain link is ours + if (legal && legal.tagName === 'A') { legal.title = LEGAL[current] || LEGAL.en; legal.setAttribute('aria-label', legal.title); } } function renderRows() { diff --git a/carino-navbar.js b/carino-navbar.js index 8decc07..5a9099a 100644 --- a/carino-navbar.js +++ b/carino-navbar.js @@ -41,11 +41,20 @@ 1 the app's own controls (.cn-actions) 2 status (carino-diag.js, or an app's own toggle) 3 language (carino-lang.js) - 4 legal + GitHub + LinkedIn — always last + 4 About + GitHub + LinkedIn — always last - The shield in that last group opens carino.systems/legal.html, the one - legal notice, privacy and cookie page for every site. carino-lang.js - translates its tooltip (it finds the link by its id, #cnLegal). + The labelled About button that leads that last group opens the about + popup (after the hub's help pane). Sites + carry no footer: whatever a page must say (a data credit, a "not + advice" line, a trademark notice, which outside services it calls, its + licence and version, a changelog or manual link) goes in a + ' + '
' + + '' + '
' - + '' + '' + '' + '
' @@ -280,6 +395,17 @@ if (TAG) label(nav.querySelector('.app-tag'), tr('{app} — reload', { app: TAG })); label(nav.querySelector('#cnGitHub'), REPO ? tr('{repo} on GitHub', { repo: REPO }) : 'GitHub', true); label(nav.querySelector('#cnLinkedIn'), tr('LinkedIn profile'), true); + label(nav.querySelector('#cnLegal'), tr('About'), true); + var ht = nav.querySelector('#cnHelpTitle'); + if (ht) ht.textContent = PRODUCT; + var lc = nav.querySelector('#cnLicence small'); + if (lc) lc.textContent = tr('{licence}: read the full terms.', { licence: LICENCE }); + var hl = nav.querySelector('#cnHelpLine'); + if (hl) hl.textContent = pageLine(); + var ab = nav; + if (ab) { + Array.prototype.forEach.call(ab.querySelectorAll('[data-cn-t]'), function (el) { el.textContent = tr(el.getAttribute('data-cn-t')); }); + } var more = nav.querySelector('.cn-more'); if (more) label(more, tr('More'), true); } @@ -326,6 +452,80 @@ if (strip && strip !== actions && strip.parentNode) strip.remove(); } + // ---- about ----------------------------------------------------------- + // The About button's popup, after the hub's help pane: the product's name + // and description (in the visitor's language), what this page must say + // ([data-carino-about]), then the licence, contact, the GitHub project and + // the legal page, and under them where to open an issue. A child of the + // bar, not of the "⋯" menu. + // The site's one short line (sites.json "line", written into the head + // block as carino:line and translated in #carino-head-i18n); the long + // description is the fallback for a page the generator has not reached. + function pageLine() { + var lang = langNow(), d = ''; + try { + var j = JSON.parse((document.getElementById('carino-head-i18n') || {}).textContent || '{}'); + if (lang !== 'en' && j[lang]) d = j[lang].line || j[lang].desc || ''; + } catch (e) { /* no translations */ } + if (!d) { + var m = document.querySelector('meta[name="carino:line"]') || document.querySelector('meta[name="description"]'); + d = m ? m.content : ''; + } + return d; + } + // The product's name: "Carino" and the app tag, unless the tag has it. + var PRODUCT = /^carino\b/i.test(TAG) ? TAG : 'Carino' + (TAG ? ' ' + TAG : ' Systems'); + function about(nav) { + var btn = nav.querySelector('#cnLegal'); + if (!btn) return; + var svg = function (body) { return ''; }; + var WAYS = [ + LICENCE && [LICENCE_HOME, svg(DOC), 'Licence', '', 'cnLicence'], + ['https://www.linkedin.com/in/miguelcarino94/', svg(''), 'Contact', 'Write to me on LinkedIn.'], + [GH_URL, svg(''), 'GitHub project', 'The source code and its history.'], + [LEGAL_URL, svg(''), 'Legal notice & privacy', 'Who runs this, what is stored, and cookies.'] + ].filter(Boolean); + var ISSUES = 'https://github.com/MiguelCarino/' + (REPO || 'Carino-Systems') + '/issues'; + var pop = document.createElement('div'); + pop.className = 'cn-help'; + pop.id = 'cnAbout'; + pop.hidden = true; + pop.innerHTML = ''; + var own = document.querySelector('[data-carino-about]'); + if (own) { + own.hidden = false; + own.classList.add('cn-ab-page'); + pop.querySelector('.cn-help-txt').appendChild(own); + } + nav.appendChild(pop); + var back = pop.querySelector('.cn-pill'); + function open(on) { + pop.hidden = !on; + btn.setAttribute('aria-expanded', on ? 'true' : 'false'); + if (on) { + var menu = nav.querySelector('.cn-more-menu'); if (menu) menu.hidden = true; + back.focus({ preventScroll: true }); + } + } + btn.addEventListener('click', function (e) { e.stopPropagation(); open(pop.hidden); }); + back.addEventListener('click', function () { open(false); btn.focus(); }); + // the scrim, not the card, closes it + pop.addEventListener('click', function (e) { if (e.target === pop) open(false); }); + document.addEventListener('keydown', function (e) { + if (e.key === 'Escape' && !pop.hidden) { open(false); btn.focus(); } + }); + } + // ---- fitting ---------------------------------------------------------- // Stage 0: everything in the bar. Stage 1: the socials row folds into the // menu. Stage 2: the clock steps aside. Stage 3: the app's controls fold @@ -567,6 +767,7 @@ var legal = nav.querySelector('#cnLegal'); if (legal) legal.remove(); } + about(nav); relabel(); relocateActions(nav); watchFit(nav); diff --git a/carino-theme.css b/carino-theme.css index 45b638f..e34ce5d 100644 --- a/carino-theme.css +++ b/carino-theme.css @@ -282,6 +282,14 @@ :root[data-carino-theme="color"] #carinoNav .clock-tz { color: var(--ct-on-accent); } :root[data-carino-theme="color"] #carinoNav .icon-btn:hover { color: var(--ct-on-accent); box-shadow: var(--ct-shadow-1); } :root[data-carino-theme="color"] #carinoNav .cn-more-menu { background: var(--bg-card); border-color: var(--border); box-shadow: var(--ct-shadow-3); } +:root[data-carino-theme="color"] #carinoNav .cn-help { background: var(--ct-scrim); } +:root[data-carino-theme="color"] #carinoNav .cn-help-card { background: var(--bg-card); border-color: var(--border); box-shadow: var(--ct-shadow-3); } +:root[data-carino-theme="color"] #carinoNav .cn-way { background: var(--bg-elev); } +:root[data-carino-theme="color"] #carinoNav .cn-ab-page { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); } +:root[data-carino-theme="color"] #carinoNav .cn-way:hover, +:root[data-carino-theme="color"] #carinoNav .cn-way:focus-visible, +:root[data-carino-theme="color"] #carinoNav .cn-pill:hover, +:root[data-carino-theme="color"] #carinoNav .cn-pill:focus-visible { background: var(--accent-faint); } :root[data-carino-theme="color"] #cnLangBtn { border-color: var(--border); color: var(--text-muted); } :root[data-carino-theme="color"] #cnLangBtn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-faint); } :root[data-carino-theme="color"] #cnLangBox { background: var(--bg-card); border-color: var(--border); box-shadow: var(--ct-shadow-3); } diff --git a/carino-ui.css b/carino-ui.css index a46bef3..447bc23 100644 --- a/carino-ui.css +++ b/carino-ui.css @@ -763,14 +763,10 @@ .progress-pill { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: var(--fs-label); color: var(--text-sec); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-variant-numeric: tabular-nums; } .progress-pill .progress { width: 90px; height: 5px; } - /* ============ footer ============ - Hub, Reference, Learning and Product pages end in one. Links are - short and mono; the line below names licence and source honestly. */ - .site-foot { border-top: 1px solid var(--border); padding: 18px 0 28px; display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: var(--fs-label); color: var(--text-muted); } - .sf-links { display: flex; flex-wrap: wrap; gap: 6px 16px; } - .sf-links a { color: var(--text-sec); text-decoration: none; } - .sf-links a:hover { color: var(--accent); } - .sf-line { line-height: 1.6; } + /* ============ no footer ============ + Pages end where their content ends. What a footer used to say lives + in the page's [data-carino-about] block, which carino-navbar.js moves + into the shield's About & legal panel. */ /* ============ play stage ============ Games and ambient pieces: the body is a column, the navbar on top and diff --git a/index.html b/index.html index b402721..63867e8 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ +