diff --git a/changes/site-sample-wall.md b/changes/site-sample-wall.md new file mode 100644 index 00000000..bbb2d6e7 --- /dev/null +++ b/changes/site-sample-wall.md @@ -0,0 +1,5 @@ +**官网:每支样片、每种风格都带一句"照这个做一支";快速开始列出四个入口** +- Why: 新来的人第一步卡在"该说什么"。官网上的样片和风格只能看,不能直接拿来开片。 +- 作品区:每张片子的左上角(播放键对面)有一个"照这个做一支 · 复制这句话":鼠标移上去或用键盘 Tab 到它时出现,触屏上一直显示。复制的是一句同类片子、换一个新题目的快出需求;发布短片那句留了一个要你填的空([在这里贴上它的链接])。页面底部说一声复制了什么,点开风格大图时这行字自己收起。点它不会播片。 +- 风格墙:点开一种风格,样片下面是一句可复制的话:用这种风格快出一版 20 秒的短片,只用画面和文字、不配旁白(避开第一次的配音下载),横屏或竖屏按这种风格支持的画幅;`bin/vh new … --style` 那行命令留在下面。`tools/readme.py check` 核对哪些风格算竖屏。 +- 快速开始第二步改成四个入口,每个入口带自己的命令,和 README 一样的顺序:Studio(`bin/vh studio`)、终端(`codex`、`claude`)、Claude Code 或 Codex 的桌面 App、别的文件夹(只装 skill:`npx skills add …`)。`tools/readme.py check` 新查一条:页面上每一条可复制的命令,同一个提交的 README 里都要有,页面就不会先于仓库给出还没有的命令。 diff --git a/docs/site/index.html b/docs/site/index.html index 02696c6e..1c0eb0d2 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -438,6 +438,16 @@ .film figcaption b { display: block; font-size: clamp(15px, 1.15vw, 18px); font-weight: 600; } .film figcaption q { display: block; font-family: var(--display); font-weight: 500; font-size: clamp(15px, 1.2vw, 19px); line-height: 1.25; color: var(--text-2); margin-top: 2px; letter-spacing: -.01em; } .film figcaption small { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; } +.say-mini { position: absolute; top: 12px; left: 12px; right: 62px; z-index: 2; opacity: 0; pointer-events: none; transition: opacity .25s; } +.film:hover .say-mini, .film:focus-within .say-mini { opacity: 1; pointer-events: auto; } +@media (hover: none) { .say-mini { opacity: 1; pointer-events: auto; } } /* a phone: always there, over the film's top-left, opposite its play button */ +.say-mini [data-copy-text] { display: none; } +.say-mini .copy.say-btn { position: static; transform: none; white-space: nowrap; font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--cyan); background: rgba(8,10,20,.6); } +.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); max-width: min(720px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; background: rgba(12,14,26,.95); border: 1px solid var(--line); color: var(--text); font-size: 14px; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; } +.toast.show { opacity: 1; transform: translate(-50%, 0); } +.films.sees .say-mini { display: none; } +.lb-say { flex-basis: 100%; margin-top: 2px; font-size: clamp(15px, 1.15vw, 18px); } +.lb-cap code.lb-code { display: block; margin-top: 8px; font-size: 12.5px; color: var(--muted); } .film .pbtn { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; z-index: 1; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); @@ -521,6 +531,14 @@ .cmd code { font: inherit; } .cmd.say { white-space: normal; font-family: var(--display); font-weight: 500; font-size: clamp(17px, 1.35vw, 22px); line-height: 1.35; letter-spacing: -.01em; background: var(--glass); } .start-cli { margin-top: 8px; } +.ways { list-style: none; display: grid; gap: 6px; margin: 0 0 10px; font-size: 14.5px; line-height: 1.45; color: var(--text-2); } +.steps .ways li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; } +.steps .ways li::before { content: none; } +.ways b { color: var(--text); font-weight: 600; } +.ways code { font-family: var(--mono); font-size: .92em; color: var(--cyan); } +.ways .cmd code { color: var(--text); font-size: 1em; } +.ways-cmds { grid-column: 2; display: grid; gap: 6px; margin-top: 2px; } +@media (max-width: 640px) { .steps .ways li { grid-template-columns: minmax(0, 1fr); gap: 0; } .ways-cmds { grid-column: 1; margin-top: 6px; } } .start-cli summary { color: var(--cyan); cursor: pointer; font-size: 14px; } .start-cli .cmd { margin-top: 6px; } .steps h3 + .fine, .steps .fine + .cmd { margin-bottom: 6px; } @@ -744,6 +762,7 @@ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } .js [data-r], .js .split .w > span, .js .hero h1, .js .wall, .js .sw { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; } + .say-mini, .toast { transition: none; } } @@ -853,14 +872,13 @@

Compare the revision同一段改完
  1. Install on macOS or Linux在 macOS 或 Linux 安装

    curl -fsSL https://raw.githubusercontent.com/ZLHad/OpenVideoHarness/main/install.sh | bash
  2. -
  3. Open OVH Studio打开 OVH Studio

    -

    Open the app, choose your signed-in Claude Code or Codex in the agent column, and click Set it up if prompted. You can also launch Studio from the default install folder.打开应用,在右栏选择已登录的 Claude Code 或 Codex。看到适配器提示时点装上。也可以从默认安装目录启动 Studio。

    -
    cd ~/OpenVideoHarness && bin/vh studio
    -
    - Use the terminal用终端开片 -
    cd ~/OpenVideoHarness && codex
    -
    cd ~/OpenVideoHarness && claude
    -
    +
  4. Pick a way in选一个入口

    +
      +
    • StudioStudioOpen OVH Studio from your applications (or run bin/vh studio in the install folder), choose your signed-in Claude Code or Codex in the agent column, and click Set it up if prompted.从应用程序打开 OVH Studio(或在安装目录运行 bin/vh studio),在右栏选已登录的 Claude Code 或 Codex,看到适配器提示时点装上。
      cd ~/OpenVideoHarness && bin/vh studio
    • +
    • Terminal终端In the install folder, start Codex or Claude Code, then send your request.在安装目录里启动 Codex 或 Claude Code,再发送需求。
      cd ~/OpenVideoHarness && codex
      cd ~/OpenVideoHarness && claude
    • +
    • Desktop app桌面 AppIn the Claude Code or Codex app, open the install folder (~/OpenVideoHarness) as the project.在 Claude Code 或 Codex 的桌面 App 里,把安装目录(~/OpenVideoHarness)当作项目打开。
    • +
    • Any folder别的文件夹The installer registers a skill for both agents, so “make a video …” finds the workbench from any project. Only the skill:安装时给两个 agent 都注册了 skill,在任何项目里说“做一支视频……”都能找到工作台。只装 skill:
      npx skills add https://github.com/ZLHad/OpenVideoHarness --skill open-video-harness
    • +
  5. Send a first request发送第一条需求

    Quick draft: make a silent 15-second vertical explainer showing why doubling a square’s side length quadruples its area. Use a grid and on-screen text.快速出一版 15 秒的竖屏无声科普,用方格和画面文字讲清楚为什么正方形边长翻倍,面积变成四倍。
    @@ -1104,7 +1122,7 @@

    04Check & deliver查与交 Contact sheet of the science short contact sheet联系表 -
    Vertical science short竖屏科普Why does a low-orbit satellite's signal change pitch?为什么低轨卫星的信号会"变调"?HyperFrames · 24.8 s · 1080×1920 · Chinese voice, two-language subtitlesHyperFrames · 24.8 秒 · 1080×1920 · 中文配音,双语字幕
    +
    Vertical science short竖屏科普Why does a low-orbit satellite's signal change pitch?为什么低轨卫星的信号会"变调"?HyperFrames · 24.8 s · 1080×1920 · Chinese voice, two-language subtitlesHyperFrames · 24.8 秒 · 1080×1920 · 中文配音,双语字幕
    Quick draft: a 25-second vertical science short on why the sky is blue.快速出一版 25 秒的竖屏科普,讲为什么天空是蓝的。
    Every film ships with its paper trail每支片子都附带完整的制作记录 @@ -1364,6 +1382,14 @@

    Star it on GitHub在 GitHub 上点 St ['walk-in-world', 'Walk-in World', '走进去的世界'], ['watercolor-pastoral', 'Watercolor Pastoral', '水彩田园'], ['whiteboard', 'Whiteboard Sketch', '白板速写'], ['y2k-chrome', 'Y2K Chrome', 'Y2K 铬面'], ]; +// the styles that also come vertical (tokens.json tags.aspect "both"): their "make one like this" sentence asks for a vertical +// short, the others' for a landscape one (tools/readme.py check holds this list to the styles) +const STYLE_VERTICAL = new Set(["bouncy-flat-2d", "brutalist-meme", "chalkboard", "deep-space-explainer", "editorial-data", "era-media-relay", "gold-line-dark", "guochao-festive", "halftone-comic", "isotype", "map-explainer", "paper-desk-dossier", "pastel-ui", "product-keynote", "risograph", "swiss-grid-type", "visual-investigation", "whiteboard", "y2k-chrome"]); +const styleSay = (slug, en, zh) => STYLE_VERTICAL.has(slug) + ? { en: `Quick draft: a 20-second vertical short in the ${en} style (styles/${slug}), pictures and on-screen text, no narration, about why the sky is blue.`, + zh: `快速出一版 20 秒的竖屏短片,用「${zh}」风格(styles/${slug}),只用画面和文字、不配旁白,讲为什么天空是蓝的。` } + : { en: `Quick draft: a 20-second landscape short in the ${en} style (styles/${slug}), pictures and on-screen text, no narration, about why the sky is blue.`, + zh: `快速出一版 20 秒的横屏短片,用「${zh}」风格(styles/${slug}),只用画面和文字、不配旁白,讲为什么天空是蓝的。` }; const stylePath = (slug, f) => `../../styles/${slug}/media/${f}`; // the 5 s sample (swatch.mp4) of a spec-1 style // A spec-2 style (tokens.json "swatch": {"spec": 2}) keeps only its 2 s preview.mp4 in git; its full sample is a release // asset (tools/media.txt, release styles-media), named here. Its tile plays the preview; the lightbox plays the release @@ -1763,7 +1789,7 @@

    Star it on GitHub在 GitHub 上点 St const t = { b, v, slug, en, zh }; v.addEventListener('ended', () => b.classList.remove('on')); b.addEventListener('mouseenter', () => playTile(t)); - b.addEventListener('click', () => { stopWall(); openLightbox({ video: fullClip(slug), cap: lang === 'zh' ? zh : en, code: `bin/vh new promo my-film --style ${slug}` }); }); + b.addEventListener('click', () => { stopWall(); openLightbox({ video: fullClip(slug), cap: lang === 'zh' ? zh : en, say: styleSay(slug, en, zh), code: `bin/vh new promo my-film --style ${slug}` }); }); return t; }); const yours = document.createElement('div'); yours.className = 'sw info'; @@ -1812,8 +1838,9 @@

    Star it on GitHub在 GitHub 上点 St /* ---------- lightbox ---------- */ const lb = $('#lightbox'), lbMedia = $('#lbMedia'), lbCap = $('#lbCap'); -function openLightbox({ video, img, cap, code }) { +function openLightbox({ video, img, cap, code, say }) { pauseAll(); + const tt = $('#toast'); if (tt) { clearTimeout(toastTimer); tt.classList.remove('show'); } // a copy's line would sit over the lightbox's own lbMedia.innerHTML = ''; if (video) { // a path, or { src, type, loop }: a release file goes through (WebKit refuses it as a bare src) const c = typeof video === 'string' ? { src: video } : video; @@ -1825,7 +1852,13 @@

    Star it on GitHub在 GitHub 上点 St if (img) { const i = new Image(); i.src = img; i.alt = cap; lbMedia.appendChild(i); } lbCap.innerHTML = ''; const c = document.createElement('span'); c.textContent = cap; lbCap.appendChild(c); - if (code) { const k = document.createElement('code'); k.textContent = code; lbCap.appendChild(k); } + if (say) { // a sentence to paste into Studio or an agent: "make one like this" + const d = document.createElement('div'); d.className = 'cmd say lb-say'; + for (const l of ['en', 'zh']) { const t = document.createElement('span'); t.lang = l; t.dataset.copyText = ''; t.textContent = say[l]; d.appendChild(t); } + const b = document.createElement('button'); b.type = 'button'; b.className = 'copy'; b.textContent = tr().copy; bindCopy(b); d.appendChild(b); + lbCap.appendChild(d); + } + if (code) { const k = document.createElement('code'); k.textContent = code; if (say) k.className = 'lb-code'; lbCap.appendChild(k); } lb.classList.add('show'); } function closeLightbox() { lb.classList.remove('show'); lbMedia.innerHTML = ''; if (sections[current].id === 'styles') startWall(); } @@ -1834,17 +1867,30 @@

    Star it on GitHub在 GitHub 上点 St document.addEventListener('keydown', e => { if (e.key === 'Escape' && lb.classList.contains('show')) closeLightbox(); }); /* ---------- copy buttons ---------- */ -$$('.copy').forEach(b => b.addEventListener('click', async () => { +function bindCopy(b) { b.addEventListener('click', async e => { + e.stopPropagation(); // a film card plays on a click: the copy button inside it must not const value = $(`[data-copy-text]:not([lang]), [data-copy-text][lang="${lang}"]`, b.parentElement); - try { await navigator.clipboard.writeText(value.textContent); b.textContent = tr().copied; } - catch { + const label = b.innerHTML; // a button with its own words (a film card's) gets them back, the others their "Copy" + try { + await navigator.clipboard.writeText(value.textContent); + if (b.hasAttribute('data-toast')) toast(`${tr().copied}: ${value.textContent}`); else b.textContent = tr().copied; + } + catch { // no clipboard (a page over http, a refusal): the sentence is shown to copy by hand + if (b.hasAttribute('data-toast')) { toast(value.textContent); return; } const selection = window.getSelection(), range = document.createRange(); range.selectNodeContents(value); selection.removeAllRanges(); selection.addRange(range); b.textContent = tr().select; } - setTimeout(() => { b.textContent = tr().copy; }, 1600); -})); + setTimeout(() => { if (b.hasAttribute('data-toast')) b.innerHTML = label; else b.textContent = tr().copy; }, 1600); +}); } +let toastTimer = null; +function toast(text) { + let t = $('#toast'); + if (!t) { t = document.createElement('div'); t.id = 'toast'; t.className = 'toast'; t.setAttribute('role', 'status'); document.body.appendChild(t); } + t.textContent = text; t.classList.add('show'); clearTimeout(toastTimer); toastTimer = setTimeout(() => t.classList.remove('show'), 3200); +} +$$('.copy').forEach(bindCopy); /* ---------- buttons lean toward the cursor ---------- */ if (fine && !reduced) $$('.btn, .gh').forEach(b => { @@ -1860,7 +1906,7 @@

    Star it on GitHub在 GitHub 上点 St document.title = tr().title; railLabels(); $$('[data-aria-en]').forEach(el => el.setAttribute('aria-label', el.dataset[l === 'zh' ? 'ariaZh' : 'ariaEn'])); - $$('.copy').forEach(b => { b.textContent = tr().copy; }); + $$('.copy:not([data-toast])').forEach(b => { b.textContent = tr().copy; }); // a card's button keeps its two-language words tiles.forEach(t => t.b.setAttribute('aria-label', tr().tile(l === 'zh' ? t.zh : t.en))); yours.innerHTML = tr().yours; ftSetPlaying(ft.playing); ftDraw(); ftShowCheck(); diff --git a/tools/readme.py b/tools/readme.py index aeff8db3..b84ff43e 100644 --- a/tools/readme.py +++ b/tools/readme.py @@ -26,6 +26,7 @@ application/octet-stream, which WebKit (Safari) refuses unless the says the type. Links to the web are not fetched (CI runs offline). Exit status: 0 all good, 1 a problem (each said), 2 usage. """ +import html as html_lib import ast, json, os, re, sys, unicodedata from pathlib import Path @@ -368,6 +369,14 @@ def site_problems(have): for f in (base / "img" / "styles" / f"{slug}.jpg", ROOT / "styles" / slug / "media" / "swatch.mp4"): if not f.is_file() and str(f.relative_to(ROOT)) not in fetched: bad.append(f"{SITE}: the style {slug} has no {f.relative_to(ROOT)}") + # the "make one like this" sentence asks for a vertical short in the styles that come vertical too (tags.aspect "both") + vert = re.search(r"const STYLE_VERTICAL = new Set\((\[.*?\])\);", html, re.S) + want_v = sorted(q.parent.name for q in (ROOT / "styles").glob("*/tokens.json") + if (json.loads(q.read_text(encoding="utf-8")).get("tags") or {}).get("aspect") == "both") + if not vert: + bad.append(f"{SITE}: no STYLE_VERTICAL list (the styles whose tokens.json says aspect both)") + elif sorted(json.loads(vert.group(1))) != want_v: + bad.append(f"{SITE}: STYLE_VERTICAL is not the styles whose tokens.json says aspect both: {want_v}") # a spec-2 style's tile plays its preview.mp4 (in git) and its lightbox the release asset: RELEASE_SAMPLES names them rel = re.search(r"const RELEASE_SAMPLES = \{(.*?)\};", html, re.S) named = dict(re.findall(r"'([a-z0-9-]+)': '([^']+)'", rel.group(1))) if rel else {} @@ -390,6 +399,20 @@ def site_problems(have): bad.append(f"{SITE}: RELEASE_SAMPLES gives {slug} {named.get(slug)!r}, tools/media.txt {assets.get(slug)!r}: write '{slug}': '{assets.get(slug)}'") elif slug in named: bad.append(f"{SITE}: RELEASE_SAMPLES names {slug}, a spec-1 style whose sample is in git") + # every command the page gives to copy is one a README gives on the same commit (whole, or after "cd ~/OpenVideoHarness + # && "), so the page cannot offer a command the repo does not have yet + readmes = "\n".join((ROOT / f).read_text(encoding="utf-8") for f in ("README.md", "README.zh-CN.md")) + for c in re.findall(r"(.*?)", html, re.S): + c = html_lib.unescape(re.sub(r"<[^>]+>", "", c)).strip() + if not any(f"`{x}`" in readmes or f"\n{x}\n" in readmes for x in (c, c.removeprefix("cd ~/OpenVideoHarness && "))): + bad.append(f"{SITE}: offers the command {c!r}, which no README gives (write it there first)") + # every command the page gives to copy is one a README gives on the same commit (whole, or after "cd ~/OpenVideoHarness + # && "), so the page cannot offer a command the repo does not have yet + readmes = "\n".join((ROOT / f).read_text(encoding="utf-8") for f in ("README.md", "README.zh-CN.md")) + for c in re.findall(r"(.*?)", html, re.S): + c = html_lib.unescape(re.sub(r"<[^>]+>", "", c)).strip() + if not any(f"`{x}`" in readmes or f"\n{x}\n" in readmes for x in (c, c.removeprefix("cd ~/OpenVideoHarness && "))): + bad.append(f"{SITE}: offers the command {c!r}, which no README gives (write it there first)") body = html[html.find("]*\blang=\"(en|zh)\"", body) en, zh = (sum(1 for tag, lang in tags if lang == want and tag != "small") for want in ("en", "zh"))