openvibers/openvibe.tools Commits
Tools: the fold rules use their own class, not the site's own fold (#154)
Changes
@@@ -108,7 +108,7 @@ details{border-bottom:1px solid var(--border,rgba(255,255,255,.08));padding:12px.fold-toggle:checked~.fold-h .fold-mark::after{content:'\\2212'}.fold-body{display:none}.fold-toggle:checked~.fold-body{display:block}--.fold:not(.fold-bare) .fold-body .ov-shipped-home h3{display:none}++.fold-block:not(.fold-bare) .fold-body .ov-shipped-home h3{display:none}@media (min-width:641px){.fold-block{margin-top:40px}.fold-toggle{display:none}@@@ -26,7 +26,9 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s*/function foldBlock({ id, head, html, bare = false }) {const key = `fold-${esc(id)}`;-- return `<div class="fold${bare ? ' fold-bare' : ''}" id="${key}">`++ // The class is `fold-block`, not `fold`: this site already has a `fold` of its own (the <details> fold in the++ // developer block), and the two must not share their rules.++ return `<div class="fold-block${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>`+ `<div class="fold-body">${str(html)}</div></div>`;@@@ -18,7 +18,7 @@ const site = require('../server/pages/site');const home = await (await fetch(`${base}/`)).text();// The folds that are on the home: the parts a reader rarely needs.for (const [id, title] of [['shipped', 'Recently shipped on OpenVibe.Tools'], ['faq', 'Questions'], ['net', 'The rest of OpenVibe']]) {-- const re = new RegExp(`<div class="fold" id="fold-${id}"><input class="fold-toggle" type="checkbox" id="fold-${id}-open">`++ const re = new RegExp(`<div class="fold-block" id="fold-${id}"><input class="fold-toggle" type="checkbox" id="fold-${id}-open">`+ `<label class="fold-h" for="fold-${id}-open"><h2[^>]*>[^<]*${title}[^<]*</h2>.*?<div class="fold-body">`);assert.ok(re.test(home), `the ${title} fold is on the home`);}
@@ -108,7 +108,7 @@ details{border-bottom:1px solid var(--border,rgba(255,255,255,.08));padding:12px
@@ -108,7 +108,7 @@ details{border-bottom:1px solid var(--border,rgba(255,255,255,.08));padding:12px
.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}
.fold-toggle:checked~.fold-body{display:block}
.fold-toggle:checked~.fold-body{display:block}
-.fold:not(.fold-bare) .fold-body .ov-shipped-home h3{display:none}
+.fold-block:not(.fold-bare) .fold-body .ov-shipped-home h3{display:none}
@media (min-width:641px){
@media (min-width:641px){
.fold-block{margin-top:40px}
.fold-block{margin-top:40px}
.fold-toggle{display:none}
.fold-toggle{display:none}
@@ -26,7 +26,9 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s
@@ -26,7 +26,9 @@ const str = (v) => (v && typeof v === 'object' && typeof v.s === 'string') ? v.s
*/
*/
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}">`
+ // The class is `fold-block`, not `fold`: this site already has a `fold` of its own (the <details> fold in the
+ // developer block), and the two must not share their rules.
+ return `<div class="fold-block${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)}<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>`;
@@ -18,7 +18,7 @@ const site = require('../server/pages/site');
@@ -18,7 +18,7 @@ const site = require('../server/pages/site');
const home = await (await fetch(`${base}/`)).text();
const home = await (await fetch(`${base}/`)).text();
// The folds that are on the home: the parts a reader rarely needs.
// The folds that are on the home: the parts a reader rarely needs.
for (const [id, title] of [['shipped', 'Recently shipped on OpenVibe.Tools'], ['faq', 'Questions'], ['net', 'The rest of OpenVibe']]) {
for (const [id, title] of [['shipped', 'Recently shipped on OpenVibe.Tools'], ['faq', 'Questions'], ['net', 'The rest of OpenVibe']]) {
- const re = new RegExp(`<div class="fold" id="fold-${id}"><input class="fold-toggle" type="checkbox" id="fold-${id}-open">`
+ const re = new RegExp(`<div class="fold-block" id="fold-${id}"><input class="fold-toggle" type="checkbox" id="fold-${id}-open">`
+ `<label class="fold-h" for="fold-${id}-open"><h2[^>]*>[^<]*${title}[^<]*</h2>.*?<div class="fold-body">`);
+ `<label class="fold-h" for="fold-${id}-open"><h2[^>]*>[^<]*${title}[^<]*</h2>.*?<div class="fold-body">`);
assert.ok(re.test(home), `the ${title} fold is on the home`);
assert.ok(re.test(home), `the ${title} fold is on the home`);
}
}