openvibers/openvibe.actor Commits
Home folds say how much they hold (#254)
Changes
@@@ -51,6 +51,7 @@.fold-h > h2 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.02em; flex: 1 1 auto; }.fold-h:focus-within { outline: 2px solid var(--accent, #3b82f6); outline-offset: 2px; }.fold-mark { flex: none; }++.fold-n { flex: none; font-size: .82rem; font-weight: 600; color: var(--text-muted, #7386a3); font-variant-numeric: tabular-nums; }.fold-mark::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--text-muted, #7386a3); }.fold-toggle:checked ~ .fold-h .fold-mark::after { content: "\2212"; }.fold-body { display: none; }@@@ -66,7 +67,7 @@.fold { margin-top: 56px; }.fold-toggle { display: none; }.fold-h { min-height: 0; margin-bottom: 10px; cursor: default; }-- .fold-mark { display: none; }++ .fold-mark, .fold-n { display: none; }.fold-body { display: block; }.fold-bare > .fold-h { display: none; }.fold-bare { margin-top: 0; }@@@ -24,11 +24,24 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s** foldBlock({ id, head, html, bare })*/++/**++ * What a fold holds, counted, for its line ("7 questions", "latest 5", "3 items"): a folded part still says how much++ * is behind it (the owner's rule, 2026-10-31: folds show their count). The 11-01 pass missed this checkbox fold.++ */++function foldMeta(body, cls = '') {++ const s = typeof body === 'string' ? body : String((body && (body.s || body.html || body.value)) || body || '');++ const n = (re) => (s.match(re) || []).length;++ const shipped = /data-ov-shipped="list"[^>]*?data-limit="(\d+)"|data-limit="(\d+)"[^>]*?data-ov-shipped="list"/.exec(s);++ const q = n(/<details[\s>]/g), li = n(/<li[\s>]/g), a = n(/<a\s/g);++ const text = shipped ? `latest ${shipped[1] || shipped[2]}` : q > 1 ? `${q} questions` : li > 1 ? `${li} items` : a > 1 ? `${a} links` : '';++ return text ? `<span${cls ? ` class="${cls}"` : ''}>${text}</span>` : '';++}++function foldBlock({ id, head, html, bare = false }) {const key = `fold-${esc(id)}`;return `<div class="fold${bare ? ' fold-bare' : ''}" id="${key}">`+ `<input class="fold-toggle" type="checkbox" id="${key}-open">`-- + `<label class="fold-h" for="${key}-open">${str(head)}<span class="fold-mark" aria-hidden="true"></span></label>`++ + `<label class="fold-h" for="${key}-open">${str(head)}${foldMeta(str(html), 'fold-n')}<span class="fold-mark" aria-hidden="true"></span></label>`+ `<div class="fold-body">${str(html)}</div></div>`;}
@@ -51,6 +51,7 @@
@@ -51,6 +51,7 @@
.fold-h > h2 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.02em; flex: 1 1 auto; }
.fold-h > h2 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.02em; flex: 1 1 auto; }
.fold-h:focus-within { outline: 2px solid var(--accent, #3b82f6); outline-offset: 2px; }
.fold-h:focus-within { outline: 2px solid var(--accent, #3b82f6); outline-offset: 2px; }
.fold-mark { flex: none; }
.fold-mark { flex: none; }
+.fold-n { flex: none; font-size: .82rem; font-weight: 600; color: var(--text-muted, #7386a3); font-variant-numeric: tabular-nums; }
.fold-mark::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--text-muted, #7386a3); }
.fold-mark::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--text-muted, #7386a3); }
.fold-toggle:checked ~ .fold-h .fold-mark::after { content: "\2212"; }
.fold-toggle:checked ~ .fold-h .fold-mark::after { content: "\2212"; }
.fold-body { display: none; }
.fold-body { display: none; }
@@ -66,7 +67,7 @@
@@ -66,7 +67,7 @@
.fold { margin-top: 56px; }
.fold { margin-top: 56px; }
.fold-toggle { display: none; }
.fold-toggle { display: none; }
.fold-h { min-height: 0; margin-bottom: 10px; cursor: default; }
.fold-h { min-height: 0; margin-bottom: 10px; cursor: default; }
- .fold-mark { display: none; }
+ .fold-mark, .fold-n { display: none; }
.fold-body { display: block; }
.fold-body { display: block; }
.fold-bare > .fold-h { display: none; }
.fold-bare > .fold-h { display: none; }
.fold-bare { margin-top: 0; }
.fold-bare { margin-top: 0; }
@@ -24,11 +24,24 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s
@@ -24,11 +24,24 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s
*
*
* foldBlock({ id, head, html, bare })
* foldBlock({ id, head, html, bare })
*/
*/
+/**
+ * What a fold holds, counted, for its line ("7 questions", "latest 5", "3 items"): a folded part still says how much
+ * is behind it (the owner's rule, 2026-10-31: folds show their count). The 11-01 pass missed this checkbox fold.
+ */
+function foldMeta(body, cls = '') {
+ const s = typeof body === 'string' ? body : String((body && (body.s || body.html || body.value)) || body || '');
+ const n = (re) => (s.match(re) || []).length;
+ const shipped = /data-ov-shipped="list"[^>]*?data-limit="(\d+)"|data-limit="(\d+)"[^>]*?data-ov-shipped="list"/.exec(s);
+ const q = n(/<details[\s>]/g), li = n(/<li[\s>]/g), a = n(/<a\s/g);
+ const text = shipped ? `latest ${shipped[1] || shipped[2]}` : q > 1 ? `${q} questions` : li > 1 ? `${li} items` : a > 1 ? `${a} links` : '';
+ return text ? `<span${cls ? ` class="${cls}"` : ''}>${text}</span>` : '';
+}
+
function foldBlock({ id, head, html, bare = false }) {
function foldBlock({ id, head, html, bare = false }) {
const key = `fold-${esc(id)}`;
const key = `fold-${esc(id)}`;
return `<div class="fold${bare ? ' fold-bare' : ''}" id="${key}">`
return `<div class="fold${bare ? ' fold-bare' : ''}" id="${key}">`
+ `<input class="fold-toggle" type="checkbox" id="${key}-open">`
+ `<input class="fold-toggle" type="checkbox" id="${key}-open">`
- + `<label class="fold-h" for="${key}-open">${str(head)}<span class="fold-mark" aria-hidden="true"></span></label>`
+ + `<label class="fold-h" for="${key}-open">${str(head)}${foldMeta(str(html), 'fold-n')}<span class="fold-mark" aria-hidden="true"></span></label>`
+ `<div class="fold-body">${str(html)}</div></div>`;
+ `<div class="fold-body">${str(html)}</div></div>`;
}
}