Text to vertical video in 100+ styles: AI codes each scene (HTML/SVG/WebGL), renders a 9:16 MP4 with music and English/Vietnamese voice. MCP, CLI and REST for AI agents.
Màn kết quả Edit video kiểu trình edit: player | bảng chỉnh có tab, phụ đề dạng transcript
Lumtek4e86ec8830fe
diff --git a/server/public/edit-panel.css b/server/public/edit-panel.cssindex af7fc29..d9f0a2e 100644--- a/server/public/edit-panel.css+++ b/server/public/edit-panel.css@@ -64,125 +64,214 @@.ed-check input { width: 18px; height: 18px; accent-color: var(--accent); }.edit-wrap textarea { min-height: 84px; }-.ed-main { display: grid; gap: 16px; align-content: start; }+.ed-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }.ed-empty { color: var(--ink-3); text-align: center; padding: 48px 24px; border: 1px dashed var(--line); border-radius: 18px; background: var(--panel); }-.ed-view { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }-.ed-media { aspect-ratio: 9 / 16; background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; text-align: center; padding: 0; }-.ed-media video, .ed-media img { width: 100%; height: 100%; object-fit: contain; display: block; }-.ed-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }-.ed-head .tt { font-weight: 700; word-break: break-all; }-.ed-head .jid { font: 500 13px var(--mono); color: var(--ink-3); }--.steps { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; }-.steps li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-3); min-height: 26px; }-.steps li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); justify-self: center; }-.steps li.done { color: var(--ink-2); } .steps li.done::before { background: var(--ok); border-color: var(--ok); }-.steps li.now { color: var(--ink); font-weight: 600; } .steps li.now::before { background: var(--accent); border-color: var(--accent); animation: pulse 1s ease-in-out infinite; }-.steps li .pc { font: 500 12px var(--mono); color: var(--ink-3); }-.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin: 6px 0 2px; }-.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s ease-out; }--.fixes { margin-top: 12px; }-.fixes h4, .ed-revise h4, .ed-hist h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); font-weight: 600; }-.fixes ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }-.fixes li { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }-.fixes li s { color: var(--ink-3); }-.fixes li b { color: var(--warn); font-weight: 600; }-.ed-revise { margin-top: 14px; }-.ed-revise .ed-row { align-items: stretch; }-.ed-revise input { flex: 1; }-.ed-revise button { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; white-space: nowrap; }-.ed-revise button:disabled { background: var(--panel-2); color: var(--ink-3); cursor: not-allowed; }-.ed-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }-.ed-presets button { min-height: 44px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); font-size: 13px; cursor: pointer; }-.ed-presets button:hover { color: var(--ink); }-.ed-hist ol { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }-.ed-checks { font-size: 13px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }-.ed-checks .ok { color: var(--ok); } .ed-checks .bad { color: var(--bad); }.ed-list { display: grid; gap: 8px; }.ed-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; text-align: left; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }.ed-item.sel { border-color: var(--accent); }.ed-item .t { font-weight: 600; font-size: 14px; word-break: break-all; }.ed-item .s { font: 500 12px var(--mono); color: var(--ink-3); }+.sty:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }+.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin: 6px 0 2px; }+.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s ease-out; }-@media (max-width: 900px) {- .tabs { padding: 4px 16px 0; }- .edit-wrap { grid-template-columns: 1fr; padding: 12px 16px 120px; }- .ed-view { grid-template-columns: 1fr; }- .ed-media { max-width: 320px; width: 100%; justify-self: center; }-}+/* ===== màn kết quả: kiểu trình edit (CapCut / Descript) =====+ 1 dòng đầu · trái player dọc + thanh thời gian (dính khi cuộn) · phải bảng chỉnh có tab · thanh Áp dụng dính đáy */+.ed-res { padding: 14px 16px 16px; }+.ed-res [hidden] { display: none !important; }-.ed-danger { margin-top: 14px; }-.ed-danger button { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); min-height: 44px; }-.ed-danger button:hover { border-color: var(--bad); }-.sty:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }+/* dòng đầu: tên · thời lượng | Cần xem lại · Tải MP4 · ⋯ */+.ed-rhead { position: relative; display: flex; align-items: center; gap: 8px 12px; min-height: 44px; }+.ed-rtitle { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }+.ed-rtitle .tt { min-width: 0; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.ed-dur { flex: none; font: 500 13px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }+.ed-rtitle .st { flex: none; }+.ed-ract { flex: none; display: flex; align-items: center; gap: 8px; }+.ed-review, .ed-dl, .ed-moreb { min-height: 40px; display: inline-flex; white-space: nowrap; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; cursor: pointer; transition: filter .15s, border-color .15s, background .15s, transform .1s; }+.ed-review { padding: 0 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); color: var(--warn); font: 600 14px/1 var(--sans); }+.ed-review[aria-expanded="true"], .ed-review:hover { background: color-mix(in srgb, var(--warn) 15%, var(--panel)); }+.ed-dl { padding: 0 16px; border: 0; background: var(--accent); color: var(--accent-ink); font: 700 15px/1 var(--sans); text-decoration: none; }+.ed-dl:hover { filter: brightness(1.08); }+.ed-moreb { width: 44px; padding: 0; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); }+.ed-moreb:hover, .ed-moreb[aria-expanded="true"] { color: var(--ink); border-color: var(--ink-3); }+.ed-review svg, .ed-dl svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }+.ed-moreb svg { width: 20px; height: 20px; fill: currentColor; }+.ed-review:active, .ed-dl:active, .ed-moreb:active { transform: scale(.97); }++/* menu bật lên */+.ed-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: min(380px, 100%); max-height: min(60vh, 480px); overflow-y: auto; overscroll-behavior: contain;+ padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); box-shadow: 0 18px 40px -16px rgba(0,0,0,.75); animation: edpop .16s ease-out; }+@keyframes edpop { from { opacity: 0; transform: translateY(-4px); } }+.ed-pop h4 { margin: 10px 8px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }+.ed-popmeta { padding: 4px 8px; font: 500 12px var(--mono); color: var(--ink-3); word-break: break-all; }+.ed-poplinks { display: grid; gap: 2px; margin-top: 4px; }+.ed-poplinks a, .ed-delb { width: 100%; min-height: 40px; display: flex; align-items: center; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-decoration: none; font-size: 14px; text-align: left; cursor: pointer; }+.ed-poplinks a:hover, .ed-delb:hover:not(:disabled) { background: var(--panel); }+.ed-checks { padding: 0 8px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }+.ed-checks .ok { color: var(--ok); } .ed-checks .bad { color: var(--bad); }+.ed-pop .log { margin: 8px 8px 0; }+.ed-pop .log summary { min-height: 36px; display: flex; align-items: center; font-size: 14px; color: var(--ink-2); cursor: pointer; }+.ed-pop .log pre { max-height: 200px; overflow: auto; margin: 4px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-all; }+.ed-delb { margin-top: 6px; color: var(--bad); }+.ed-delb:disabled { opacity: .45; cursor: not-allowed; }++/* danh sách "Cần xem lại" */+.ed-rlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }+.ed-rlist .h { padding: 8px 8px 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }+.ed-rlist .h:first-child { padding-top: 2px; }+.ed-ritem { width: 100%; min-height: 40px; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: center; padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; font-size: 14px; line-height: 1.35; cursor: pointer; }+.ed-ritem:hover:not(:disabled), .ed-ritem.on { background: var(--panel); }+.ed-ritem.on { box-shadow: inset 2px 0 0 var(--accent); }+.ed-ritem:disabled { cursor: default; }+.ed-ritem .tm { font: 600 12px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }+.ed-ritem:disabled .tm { color: var(--ink-3); }+.ed-ritem s { color: var(--ink-3); }+.ed-ritem b { color: var(--warn); font-weight: 600; }++/* đang dựng: 1 thanh + tên bước */+.ed-prog { display: flex; align-items: center; gap: 12px; margin-top: 8px; }+.ed-prog .bar { flex: 1; margin: 0; }+.ed-progt { flex: 0 1 auto; max-width: 60%; font: 500 13px var(--mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.ed-res > .errmsg:empty { display: none; }-/* ---- chỉnh tay (phụ đề / nhạc & tiếng / zoom & đồ hoạ) ---- */-.ed-man { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }-.ed-man h4 { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); font-weight: 600; }-.ed-man h5 { margin: 12px 0 6px; font-size: 13px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }-.ed-mtabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }-.ed-mtabs [role="tab"] { flex: 1; min-height: 44px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: 600 14px/1.2 var(--sans); cursor: pointer; }-.ed-mtabs [role="tab"][aria-selected="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }-.ed-mtabs [role="tab"]:focus-visible, .ed-man button:focus-visible, .ed-man input:focus-visible, .ed-man select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }-.ed-mpanel { padding: 12px 0 4px; }-.ed-mpanel[hidden] { display: none; }-.ed-mrow { display: flex; gap: 10px; align-items: center; margin: 6px 0; }-.ed-mlab { flex: 0 0 auto; min-width: 96px; font-size: 14px; color: var(--ink-2); }-.ed-mrow select, .ed-mrow .ed-in { flex: 1; min-width: 0; }-.ed-mhint { margin: 2px 0 8px; font-size: 13px; }-.ed-num { width: 84px; flex: 0 0 auto; padding: 0 8px; font: 500 14px var(--mono); font-variant-numeric: tabular-nums; }-.ed-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 460px; overflow-y: auto; overscroll-behavior: contain; }-.ed-lines li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "tm text text" "tm time act"; gap: 6px 8px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); transition: border-color .15s, background .15s; }-.ed-lines li.none { display: block; color: var(--ink-3); font-size: 14px; }-.ed-lines li.now { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }-.ed-lines li.bad { border-color: var(--bad); }-.ed-lines .ed-tm { grid-area: tm; align-self: stretch; }-.ed-lines .ed-ltext { grid-area: text; min-height: 44px; font-size: 15px; }-.ed-ltime { grid-area: time; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink-3); }-.ed-ltime .ed-in { min-height: 44px; }-.ed-lact { display: flex; gap: 4px; }-.ed-lines .ed-lact { grid-area: act; }-.ed-lact button, .ed-mx { min-height: 44px; min-width: 44px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); font-size: 13px; cursor: pointer; }-.ed-lact button:hover:not(:disabled), .ed-mx:hover { color: var(--ink); border-color: var(--ink-3); }-.ed-lact button:disabled { opacity: .4; cursor: not-allowed; }-.ed-lact .del { font-size: 18px; color: var(--bad); }-.ed-lerr { grid-column: 1 / -1; font-size: 13px; color: var(--bad); }-.ed-tm { min-height: 44px; min-width: 56px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--accent); font: 600 13px var(--mono); font-variant-numeric: tabular-nums; cursor: pointer; }-.ed-tm:hover { border-color: var(--accent); }-.ed-slider { display: grid; gap: 4px; margin: 8px 0; }-.ed-slider[hidden] { display: none; }-.ed-man label[for] { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--ink-2); }-.ed-man label.ed-mlab { display: block; }-.ed-man output { font: 600 14px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }-.ed-man input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--accent); }-.ed-fxlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }-.ed-fxlist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }-.ed-fxlist li.none { display: block; color: var(--ink-3); }+/* thân: player | bảng chỉnh */+.ed-body { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 12px; }+.ed-res.solo .ed-body { grid-template-columns: minmax(220px, 300px); justify-content: center; }+.ed-stage { position: sticky; top: 12px; width: min(100%, calc((100vh - 120px) * 9 / 16)); justify-self: center; display: grid; gap: 6px; }+.ed-media { aspect-ratio: 9 / 16; background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; text-align: center; }+.ed-media video, .ed-media img { width: 100%; height: 100%; object-fit: contain; display: block; }++/* thanh thời gian mảnh dưới player */+.ed-tl { display: grid; gap: 2px; }+.ed-tltrack { position: relative; height: 22px; cursor: pointer; }+.ed-tltrack::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line); }+.ed-tltrack i { position: absolute; top: 50%; pointer-events: none; }+.ed-tltrack i.g { height: 8px; margin-top: -4px; border-radius: 3px; background: color-mix(in srgb, var(--warn) 55%, transparent); }+.ed-tltrack i.z { width: 3px; height: 14px; margin: -7px 0 0 -1.5px; border-radius: 2px; background: var(--accent); }+.ed-tltrack i.gone { opacity: .2; }+.ed-tltrack .ed-tlh { width: 2px; height: 20px; margin: -10px 0 0 -1px; border-radius: 1px; background: var(--ink); }+.ed-tlleg { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }+.ed-tlleg span::before { content: ''; display: inline-block; vertical-align: 1px; margin-right: 6px; border-radius: 2px; }+.ed-tlleg .z::before { width: 3px; height: 10px; background: var(--accent); }+.ed-tlleg .g::before { width: 12px; height: 6px; background: color-mix(in srgb, var(--warn) 55%, transparent); }++/* bảng chỉnh có tab */+.ed-side { min-width: 0; }+.ed-mtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }+.ed-mtabs::-webkit-scrollbar { display: none; }+.ed-mtabs [role="tab"] { flex: none; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--ink-3); font: 600 14px/1.2 var(--sans); white-space: nowrap; cursor: pointer; box-shadow: inset 0 -2px 0 transparent; transition: color .15s, box-shadow .15s; }+.ed-mtabs [role="tab"]:hover:not(:disabled) { color: var(--ink); }+.ed-mtabs [role="tab"][aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }+.ed-mtabs [role="tab"]:disabled { opacity: .4; cursor: not-allowed; }+.ed-mtabs [role="tab"]:focus-visible { outline-offset: -2px; }+.ed-mpanel { padding: 10px 0 4px; }+.ed-side h5 { margin: 6px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }+.ed-side h5 ~ h5 { margin-top: 14px; }+.ed-mini { flex: none; font-size: 13px; color: var(--ink-3); }+.ed-sm { min-height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }+.ed-minichk { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; color: var(--ink-2); cursor: pointer; }+.ed-minichk input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }+.ed-file { font-size: 13px; color: var(--ink-2); word-break: break-all; }+.ed-file:empty { display: none; }++/* phụ đề kiểu transcript */+.ed-captop { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding-bottom: 6px; }+.ed-captop select { min-width: 0; max-width: 220px; }+.ed-captop .ed-minichk { margin-left: auto; }+.ed-lines { position: relative; list-style: none; margin: 0; padding: 0 4px 0 0; max-height: max(280px, calc(100vh - 290px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }+.ed-lines > li.none { color: var(--ink-3); font-size: 14px; padding: 8px 0; }+.ed-ln { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; column-gap: 4px; padding: 1px 4px 1px 0; border-radius: 8px; transition: background .15s; }+.ed-ln:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }+.ed-ln.now { background: color-mix(in srgb, var(--accent) 11%, transparent); }+.ed-ln.sel { background: var(--panel-2); }+.ed-ln.bad { box-shadow: inset 2px 0 0 var(--bad); }+.ed-tm { min-height: 36px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; text-align: left; cursor: pointer; }+.ed-tm:hover, .ed-ln.now .ed-tm { color: var(--accent); }+.ed-ltext { width: 100%; min-width: 0; min-height: 36px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 15px; }+.ed-ln.now .ed-ltext { font-weight: 600; }+.ed-ltext:focus { outline: none; background: var(--bg); box-shadow: inset 0 0 0 1px var(--accent); }+.ed-ltext:disabled { color: var(--ink-2); }+.ed-lx { display: contents; }+.ed-lact { grid-column: 3; grid-row: 1; display: flex; gap: 2px; visibility: hidden; }+.ed-ln:hover .ed-lact, .ed-ln.sel .ed-lact, .ed-ln:focus-within .ed-lact { visibility: visible; }+.ed-lact button { min-height: 32px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); font-size: 13px; cursor: pointer; }+.ed-lact button:hover:not(:disabled) { color: var(--ink); background: var(--panel); }+.ed-lact button:disabled { opacity: .35; cursor: not-allowed; }+.ed-lact .del { color: var(--bad); font-size: 18px; line-height: 1; }+.ed-ltime { grid-column: 2 / -1; grid-row: 2; display: none; align-items: center; gap: 6px; padding: 2px 6px 6px; color: var(--ink-3); font-size: 13px; }+.ed-ln.sel .ed-ltime { display: flex; }+.ed-num { width: 84px; padding: 0 6px; font: 500 13px var(--mono); font-variant-numeric: tabular-nums; }+.ed-lerr { grid-column: 2 / -1; padding: 0 6px 4px; font-size: 13px; color: var(--bad); }++/* nhạc & tiếng */+.ed-arow { display: grid; grid-template-columns: 96px minmax(0, 1fr) 64px; align-items: center; gap: 10px; min-height: 40px; }+.ed-arow select { grid-column: 2 / -1; min-width: 0; }+.ed-arow .ed-num { grid-column: 2; justify-self: start; }+.ed-arow output { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }+.ed-arow input[type="range"] { width: 100%; min-height: 32px; margin: 0; accent-color: var(--accent); }+.ed-agrp { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }++/* zoom & đồ hoạ */+.ed-fxlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }+.ed-fxlist li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 2px 4px 2px 0; border-radius: 8px; font-size: 14px; }+.ed-fxlist li:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }+.ed-fxlist li.none { display: block; padding: 6px 0; color: var(--ink-3); }.ed-fxlist li.gone span { text-decoration: line-through; color: var(--ink-3); }-.ed-fxlist li.gone { border-style: dashed; }+.ed-mx { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--ink-2); font-size: 13px; cursor: pointer; }+.ed-mx:hover { color: var(--ink); border-color: var(--ink-3); }.ed-mx[aria-pressed="true"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }-.ed-mbar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 0 4px; background: var(--panel); }-.ed-mdirty { flex: 1 1 160px; font-size: 13px; color: var(--ink-3); }-.ed-mdirty.bad { color: var(--bad); }-.ed-mreset { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; }-.ed-mapply { min-height: 44px; padding: 0 20px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }-.ed-mreset:disabled, .ed-mapply:disabled { opacity: .45; cursor: not-allowed; }++/* sửa bằng lời */+.ed-revf { display: flex; gap: 8px; }+.ed-revf .ed-in { flex: 1; min-width: 0; }+.ed-revf button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; white-space: nowrap; cursor: pointer; }+.ed-revf button:disabled { background: var(--panel-2); color: var(--ink-3); cursor: not-allowed; }+.ed-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }+.ed-presets button { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink-3); font-size: 13px; cursor: pointer; }+.ed-presets button:hover { color: var(--ink); border-color: var(--ink-3); }+.ed-hist { margin-top: 16px; }+.ed-hist ol { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }+.ed-hist a { color: var(--accent); }.ed-hist li.man .tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); }.ed-hist li.orig { color: var(--ink-3); }-/* màn hẹp: nút Dựng của form nằm cố định ở đáy → thanh Áp dụng dính ngay trên nó */++/* Áp dụng / Bỏ thay đổi: chỉ hiện khi có thay đổi, dính đáy bảng phải */+.ed-mbar { position: sticky; bottom: 12px; z-index: 4; display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 8px 8px 14px; border-radius: 12px;+ border: 1px solid var(--line); background: var(--panel-2); box-shadow: 0 -12px 28px -14px rgba(0,0,0,.75); animation: edup .18s ease-out; }+@keyframes edup { from { opacity: 0; transform: translateY(8px); } }+.ed-mdirty { flex: 1 1 auto; min-width: 0; font-size: 14px; color: var(--ink-2); }+.ed-mdirty.bad { color: var(--bad); }+.ed-mreset { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); cursor: pointer; }+.ed-mreset:hover:not(:disabled) { color: var(--ink); }+.ed-mapply { min-height: 40px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }+.ed-mreset:disabled, .ed-mapply:disabled { opacity: .45; cursor: not-allowed; }+.ed-side > .errmsg:empty { display: none; }++/* màn cảm ứng: không có hover → công cụ dòng hiện khi chọn dòng, nằm hàng dưới; vùng bấm 44px */+@media (hover: none), (max-width: 767px) {+ .ed-lx { display: none; grid-column: 2 / -1; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 6px 6px; }+ .ed-ln.sel .ed-lx { display: flex; }+ .ed-lact, .ed-ltime, .ed-ln.sel .ed-ltime { display: flex; visibility: visible; padding: 0; }+ .ed-lact { margin-left: auto; }+ .ed-tm, .ed-ltext, .ed-lact button, .ed-mx, .ed-sm, .ed-presets button { min-height: 44px; }+}+/* màn hẹp: nút Dựng của form cố định ở đáy → thanh Áp dụng dính ngay trên nó */@media (max-width: 900px) {- .ed-mbar { bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 4; gap: 6px 8px; padding: 6px 0; box-shadow: 0 -10px 16px -12px rgba(0,0,0,.6); }- .ed-mdirty { flex-basis: 100%; }- .ed-mapply { flex: 1; }+ .tabs { padding: 4px 16px 0; }+ .edit-wrap { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 120px; }+ .ed-mbar { bottom: calc(84px + env(safe-area-inset-bottom)); }}-@media (max-width: 480px) {- .ed-mlab { min-width: 0; }- .ed-mrow { flex-wrap: wrap; }- .ed-mrow .ed-mlab { flex-basis: 100%; }- .ed-lines { max-height: none; }- .ed-lines li { grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "tm text" "tm time" "tm act"; }- .ed-lines .ed-lact { justify-self: start; }- .ed-num { width: 72px; }+@media (max-width: 767px) {+ .ed-res { padding: 12px; }+ .ed-rhead { flex-wrap: wrap; }+ .ed-rtitle { flex-basis: 100%; }+ .ed-ract { flex: 1 1 auto; justify-content: flex-end; }+ .ed-ract .ed-review { margin-right: auto; }+ .ed-body, .ed-res.solo .ed-body { grid-template-columns: minmax(0, 1fr); gap: 14px; }+ .ed-stage { position: static; width: min(100%, calc(56vh * 9 / 16)); }+ .ed-pop { width: 100%; }+ .ed-lines { max-height: 60vh; }+ .ed-arow { grid-template-columns: 80px minmax(0, 1fr) 56px; }+ .ed-captop select { max-width: none; flex: 1; }}-@media (prefers-reduced-motion: reduce) { .ed-lines li { transition: none; } }+@media (prefers-reduced-motion: reduce) { .ed-ln, .ed-pop, .ed-mbar { transition: none; animation: none; } }diff --git a/server/public/edit-panel.js b/server/public/edit-panel.jsindex 8284726..2f795cf 100644--- a/server/public/edit-panel.js+++ b/server/public/edit-panel.js@@ -2,7 +2,6 @@// API: GET /api/edit-options, GET/POST /api/edits, GET /api/edits/:id, POST /api/edits/:id/revise (edit/http.mjs)(() => {const $ = (s, r = document) => r.querySelector(s);- const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));const fmtMB = (b) => (b >= 1e9 ? (b / 1e9).toFixed(2) + ' GB' : Math.max(1, Math.round(b / 1e6)) + ' MB');const I = window.I18N;const t = (k, v) => I.t(k, v);@@ -144,9 +143,9 @@// danh sách nhạc (vẽ lại khi đổi ngôn ngữ, giữ lựa chọn)function renderMusic() {const sel = $('#edMusic'), keep = sel.value;- sel.innerHTML = `<option value="none">${esc(t('ed.noMusic'))}</option>`- + (state.opts?.music || []).map((m) => `<option value="${esc(m.id)}">${esc(t('ed.musicSynth', { id: m.id, desc: I.srv(m.desc) }))}</option>`).join('')- + `<option value="file">${esc(t('ed.musicFile'))}</option>`;+ sel.replaceChildren(new Option(t('ed.noMusic'), 'none'),+ ...(state.opts?.music || []).map((m) => new Option(t('ed.musicSynth', { id: m.id, desc: I.srv(m.desc) }), m.id)),+ new Option(t('ed.musicFile'), 'file'));if (keep && [...sel.options].some((o) => o.value === keep)) sel.value = keep;}// radiogroup: bấm hoặc mũi tên chọn kiểu; chỉ nút đang chọn nằm trong thứ tự Tab (roving tabindex)@@ -238,6 +237,8 @@});// ---- bản đang xem ------------------------------------------------------------------------------------------------+ // Màn kết quả kiểu trình edit: 1 dòng đầu (tên · thời lượng · Cần xem lại · Tải MP4 · ⋯), trái là player + thanh+ // thời gian, phải là bảng chỉnh có tab. Chữ từ server chỉ vào DOM qua textContent / new Option (luật P2).async function loadList() {let list = [];try { list = await fetch('/api/edits').then((r) => r.json()); } catch { return; }@@ -263,6 +264,7 @@function select(id, view) {state.current = id;document.querySelectorAll('.ed-item').forEach((b) => b.classList.toggle('sel', b.dataset.id === id));+ closePops();if (view) render(view);poll();}@@ -277,75 +279,176 @@else loadList();}+ const fmtDur = (s) => { const x = Math.max(0, Math.round(s)); return `${Math.floor(x / 60)}:${String(x % 60).padStart(2, '0')}`; };+ const fmtT = (s) => { const x = Math.max(0, Math.round(s * 10) / 10); const m = Math.floor(x / 60); return `${m}:${(x - m * 60).toFixed(1).padStart(4, '0')}`; };+ // chỉ nhận đường dẫn cùng gốc ("/edits/…"), không nhận javascript:, //host…+ const safeUrl = (u) => (typeof u === 'string' && /^\/(?!\/)/.test(u) ? u : null);+ const video = () => $('#edMedia video');+ function seek(at, play) {+ const v = video(); if (!v || !Number.isFinite(at)) return;+ v.currentTime = Math.max(0, at + 0.02);+ if (play) v.play().catch(() => {});+ }+ const narrow = () => window.matchMedia('(max-width: 767px)').matches;++ // ---- menu bật lên: "Cần xem lại" và "⋯" ----+ const POPS = ['#edReviewBtn', '#edMoreBtn'];+ function setPop(btnSel, open) {+ const b = $(btnSel); const p = $('#' + b.getAttribute('aria-controls'));+ p.hidden = !open; b.setAttribute('aria-expanded', String(open));+ }+ function closePops(except) { POPS.forEach((b) => { if (b !== except) setPop(b, false); }); }+ POPS.forEach((sel) => $(sel).addEventListener('click', () => {+ const p = $('#' + $(sel).getAttribute('aria-controls')); const open = p.hidden;+ closePops(sel); setPop(sel, open);+ if (open) p.querySelector('a[href], button:not(:disabled), summary')?.focus();+ }));+ document.addEventListener('click', (e) => { if (!e.target.closest?.('.ed-pop, #edReviewBtn, #edMoreBtn')) closePops(); });+ document.addEventListener('keydown', (e) => {+ if (e.key !== 'Escape') return;+ const open = POPS.find((s) => !$('#' + $(s).getAttribute('aria-controls')).hidden);+ if (open) { closePops(); $(open).focus(); }+ });++ // ---- "Cần xem lại": chữ AI sửa + số nghe không chắc; giờ nguồn → giờ bản ra theo đoạn giữ của EDL ----+ const EDL = { key: null, keep: null, words: null };+ async function loadEdl(v) {+ const url = safeUrl(v.links?.edl); const key = `${v.id}|${v.links?.out || ''}`;+ if (!url || EDL.key === key) return;+ EDL.key = key; EDL.keep = null; EDL.words = null;+ try {+ const e = await fetch(url, { cache: 'no-store' }).then((r) => r.json());+ if (EDL.key !== key) return;+ EDL.keep = Array.isArray(e.keep) ? e.keep.filter((k) => Number.isFinite(k.start) && Number.isFinite(k.end)) : null;+ EDL.words = new Map((e.captions?.words || []).filter((w) => Number.isFinite(w.start)).map((w) => [w.i, w.start]));+ if (state.view?.id === v.id) renderReview(state.view);+ } catch { /* không có EDL: mục vẫn hiện, chỉ không nhảy được */ }+ }+ function toOut(src) {+ if (!EDL.keep || !Number.isFinite(src)) return null;+ let acc = 0;+ for (const k of EDL.keep) {+ if (src < k.start) return acc;+ if (src <= k.end) return acc + (src - k.start);+ acc += k.end - k.start;+ }+ return null;+ }+ function reviewItems(v) {+ const fixes = (v.fixes || []).map((f) => ({ kind: 'fix', f, at: toOut(EDL.words?.get(f.word)) }));+ const figs = (v.checks?.figures || []).map((f) => ({ kind: 'fig', f, at: toOut(f.at) }));+ return { fixes, figs, n: fixes.length + figs.length };+ }+ function reviewRow(it) {+ const li = el('li');+ const b = el('button', 'ed-ritem'); b.type = 'button';+ const at = it.at;+ if (at != null) b.dataset.t = String(at); else b.disabled = true;+ const tx = el('span', 'rx');+ if (it.kind === 'fix') tx.append(el('s', null, it.f.heard), ' → ', el('b', null, it.f.text || t('ed.hidden')));+ else {+ tx.append(el('b', null, it.f.text), ' · ', el('s', null, it.f.said));+ if (it.f.why) b.title = String(it.f.why);+ }+ if (at != null) b.setAttribute('aria-label', `${fmtT(at)} · ${tx.textContent}`);+ b.append(el('span', 'tm', at != null ? fmtT(at) : '–'), tx);+ li.append(b);+ return li;+ }+ function renderReview(v) {+ const r = reviewItems(v);+ $('#edReviewBtn').hidden = !r.n;+ $('#edReviewL').textContent = t('ed.review', { n: r.n });+ if (!r.n) { setPop('#edReviewBtn', false); $('#edReviewList').replaceChildren(); return; }+ const out = [];+ if (r.fixes.length) out.push(el('li', 'h', t('ed.revFixes')), ...r.fixes.map(reviewRow));+ if (r.figs.length) out.push(el('li', 'h', t('ed.revFigs')), ...r.figs.map(reviewRow));+ $('#edReviewList').replaceChildren(...out);+ }+ $('#edReviewList').addEventListener('click', (e) => {+ const b = e.target.closest('.ed-ritem'); if (!b || b.disabled) return;+ document.querySelectorAll('.ed-ritem.on').forEach((x) => x.classList.remove('on'));+ b.classList.add('on');+ seek(Number(b.dataset.t), true);+ if (narrow()) { closePops(); video()?.scrollIntoView({ block: 'nearest' }); }+ });+let lastOut = null;function render(v) {state.view = v;$('#edEmpty').hidden = true; $('#edView').hidden = false;const busy = ['queued', 'running'].includes(v.status);- $('#edTitle').textContent = v.sourceName || v.id;+ const name = v.sourceName || v.id;+ $('#edTitle').textContent = name; $('#edTitle').title = name;+ const dur = v.checks?.edl?.outSeconds;+ $('#edDur').textContent = Number.isFinite(dur) && !busy ? fmtDur(dur) : '';$('#edId').textContent = `${viewStyleName(v)} · ${v.id}`;const st = $('#edStatus');+ st.hidden = v.status === 'done';st.className = 'st ' + (v.status === 'done' ? 'done' : v.status === 'error' ? 'error' : 'run');st.textContent = busy ? t(v.status === 'queued' ? 'ed.waitTurn' : v.action === 'revise' ? 'ed.revising' : v.action === 'manual' ? 'man.running' : 'ed.st.running') : stLabel(v.status);- // bước (sửa bằng lời bắt đầu từ "LLM lập EDL"; chỉnh tay từ "render nền" hoặc "phụ đề")+ // tiến độ: 1 thanh + tên bước đang chạy (không còn list các bước)const steps = v.steps || [];- const from = v.action === 'revise' ? 2 : v.action === 'manual' ? (v.stepFrom ?? 4) : 0;- $('#edSteps').innerHTML = steps.map((s, i) => {- let cls = '';- if (i < from) cls = 'done';- else if (v.status === 'done') cls = 'done';- else if (busy && i < v.stepIndex) cls = 'done';- else if (busy && i === v.stepIndex) cls = 'now';- return `<li class="${cls}"><span>${esc(I.srv(s))}</span><span class="pc">${cls === 'now' ? `${v.pct || 0}%` : ''}</span></li>`;- }).join('');- const doneSteps = v.status === 'done' ? steps.length : Math.max(0, v.stepIndex) + (v.pct || 0) / 100;- $('#edBar').style.width = `${Math.min(100, (doneSteps / Math.max(1, steps.length)) * 100)}%`;- $('#edBarWrap').hidden = !busy;- $('#edNote').textContent = busy ? (v.note || '') : '';- // lỗi+ $('#edProg').hidden = !busy;+ if (busy) {+ const i = Math.max(0, Math.min(steps.length - 1, v.stepIndex ?? 0));+ const done = i + (v.pct || 0) / 100;+ $('#edBar').style.width = `${Math.min(100, (done / Math.max(1, steps.length)) * 100)}%`;+ $('#edProgText').textContent = v.status === 'queued' || !steps.length ? t('ed.waitTurn')+ : t('ed.stepOf', { i: i + 1, n: steps.length, step: I.srv(steps[i]), p: v.pct || 0 });+ $('#edProgText').title = v.note || '';+ }$('#edViewErr').textContent = v.status === 'error' ? (v.error || t('ed.err')) : v.reviseError ? t('ed.reviseErr', { e: v.reviseError }) : '';// videoconst media = $('#edMedia');- if (v.links?.out && v.links.out !== lastOut) {- lastOut = v.links.out;- media.innerHTML = `<video controls playsinline preload="metadata" src="${esc(v.links.out)}"></video>`;- } else if (!v.links?.out) {+ const out = safeUrl(v.links?.out);+ if (out && out !== lastOut) {+ lastOut = out;+ const vid = document.createElement('video');+ vid.controls = true; vid.playsInline = true; vid.preload = 'metadata'; vid.src = out;+ media.replaceChildren(vid);+ } else if (!out) {lastOut = null;- media.innerHTML = v.links?.preview ? `<img src="${esc(v.links.preview)}" alt="${esc(t('ed.previewAlt'))}">` : `<span>${esc(t('ed.mediaEmpty'))}</span>`;+ const pv = safeUrl(v.links?.preview);+ if (pv) { const img = document.createElement('img'); img.src = pv; img.alt = t('ed.previewAlt'); media.replaceChildren(img); }+ else media.replaceChildren(el('span', null, t('ed.mediaEmpty')));}- $('#edLinks').innerHTML = [- v.links?.out ? `<a href="${esc(v.links.out)}" download>${esc(t('ed.mp4'))}</a>` : '',- v.links?.previewFinal ? `<a href="${esc(v.links.previewFinal)}" target="_blank" rel="noopener">${esc(t('ed.gridOut'))}</a>` : '',- v.links?.edl ? `<a href="${esc(v.links.edl)}" target="_blank" rel="noopener">EDL</a>` : '',- ].join('');- // chữ LLM sửa- const fx = v.fixes || [];- $('#edFixes').hidden = !fx.length;- $('#edFixList').innerHTML = fx.map((f) => `<li><s>${esc(f.heard)}</s> → <b>${f.text ? esc(f.text) : esc(t('ed.hidden'))}</b></li>`).join('');- // số không chắc (không in lên đồ hoạ)- const figs = v.checks?.figures || [];- $('#edFigures').hidden = !figs.length;- $('#edFigureList').innerHTML = figs.map((f) => `<li title="${esc(f.why)}"><b>${esc(f.text)}</b>${f.at != null ? ` · ${esc(t('ed.figAt', { s: f.at.toFixed(1) }))}` : ''} · <s>${esc(f.said)}</s>${f.heard ? ` → ${esc(t('ed.figHeard', { h: f.heard }))}` : ''}</li>`).join('');- // kiểm+ const dl = $('#edDl'); dl.hidden = !out; if (out) dl.href = out; else dl.removeAttribute('href');+ // menu ⋯: lưới khung, EDL, thông số+ const link = (u, label) => { const a = el('a', null, label); a.href = u; a.target = '_blank'; a.rel = 'noopener'; return a; };+ const pf = safeUrl(v.links?.previewFinal); const edl = safeUrl(v.links?.edl);+ $('#edLinks').replaceChildren(...[pf && link(pf, t('ed.gridOut')), edl && link(edl, 'EDL')].filter(Boolean));const c = v.checks || {};const bits = [];- if (c.edl) bits.push(esc(t('ed.checksEdl', { out: c.edl.outSeconds ?? '', rm: c.edl.removedSeconds, z: c.edl.zooms })));- if (c.overcut) bits.push(c.overcut.lost?.length || c.overcut.chopped?.length ? `<span class="bad">${esc(t('ed.overcut', { v: c.overcut.verdict }))}</span>` : `<span class="ok">${esc(t('ed.noOvercut'))}</span>`);- if (c.cutRepairs?.length) bits.push(esc(t('ed.cutRepairs', { n: c.cutRepairs.length })));- if (c.loudness) bits.push(`${c.loudness.lufs} LUFS`);- if (c.qc?.fails?.length) bits.push(`qc: ${esc(c.qc.fails.join('; '))}`);- $('#edChecks').innerHTML = bits.join(' · ');- // sửa bằng lời- $('#edReviseBtn').disabled = busy || v.status !== 'done';+ if (c.edl) bits.push(el('span', null, t('ed.checksEdl', { out: c.edl.outSeconds ?? '', rm: c.edl.removedSeconds, z: c.edl.zooms })));+ if (c.overcut) bits.push(c.overcut.lost?.length || c.overcut.chopped?.length ? el('span', 'bad', t('ed.overcut', { v: c.overcut.verdict })) : el('span', 'ok', t('ed.noOvercut')));+ if (c.cutRepairs?.length) bits.push(el('span', null, t('ed.cutRepairs', { n: c.cutRepairs.length })));+ if (c.loudness) bits.push(el('span', null, `${c.loudness.lufs} LUFS`));+ if (c.qc?.fails?.length) bits.push(el('span', null, `qc: ${c.qc.fails.join('; ')}`));+ $('#edChecks').replaceChildren(...bits.flatMap((b, k) => (k ? [' · ', b] : [b])));+ $('#edLog').textContent = (v.log || []).join('\n');$('#edDelete').disabled = busy;- $('#edRevise').hidden = !(v.links?.out || v.status === 'done');+ // cần xem lại+ renderReview(v);+ if (out && !busy) loadEdl(v);+ // sửa bằng lời + các lần sửa+ $('#edReviseBtn').disabled = busy || v.status !== 'done';const revs = v.revisions || [];$('#edHist').hidden = !revs.length;- const play = (u) => (u ? ` <a href="${esc(u)}" target="_blank" rel="noopener">${esc(t('man.watch'))}</a>` : '');- $('#edHistList').innerHTML = (v.originalUrl && revs.length ? `<li class="orig">${esc(t('man.original'))}${play(v.originalUrl)}</li>` : '')- + revs.map((r) => `<li${r.manual ? ' class="man"' : ''}>${r.manual ? `<span class="tag">${esc(t('man.tag'))}</span> ${esc(r.instruction)}` : `"${esc(r.instruction)}"`}${r.notes ? ` — ${esc(r.notes)}` : ''}${r.manual && r.seconds ? ` · ${esc(t('man.took', { s: Math.round(r.seconds) }))}` : ''}${play(r.url)}</li>`).join('');+ const watch = (u) => { const s = safeUrl(u); if (!s) return []; const a = el('a', null, t('man.watch')); a.href = s; a.target = '_blank'; a.rel = 'noopener'; return [' ', a]; };+ const hist = [];+ if (v.originalUrl && revs.length) { const li = el('li', 'orig', t('man.original')); li.append(...watch(v.originalUrl)); hist.push(li); }+ for (const r of revs) {+ const li = el('li', r.manual ? 'man' : null);+ if (r.manual) li.append(el('span', 'tag', t('man.tag')), ' ', r.instruction || '');+ else li.append(`"${r.instruction || ''}"`);+ if (r.notes) li.append(` — ${r.notes}`);+ if (r.manual && r.seconds) li.append(` · ${t('man.took', { s: Math.round(r.seconds) })}`);+ li.append(...watch(r.url));+ hist.push(li);+ }+ $('#edHistList').replaceChildren(...hist);Man.onView(v, busy);- $('#edLog').textContent = (v.log || []).join('\n');}async function revise(text) {@@ -362,6 +465,7 @@$('#edDelete').addEventListener('click', async () => {const id = state.current; if (!id) return;if (!confirm(t('ed.confirmDel'))) return;+ closePops();const r = await fetch(`/api/edits/${encodeURIComponent(id)}`, { method: 'DELETE' });const j = await r.json().catch(() => ({}));if (!r.ok) { $('#edViewErr').textContent = j.error || t('err.status', { s: r.status }); return; }@@ -374,14 +478,13 @@$('#edPresets').addEventListener('click', (e) => { const b = e.target.closest('button'); if (b) $('#edReviseText').value = b.textContent; $('#edReviseText').focus(); });// ---- chỉnh tay (GET/POST /api/edits/:id/manual, POST /api/edits/:id/music) ------------------------------------- // Bảng dòng phụ đề (giây bản ra), nhạc, giọng, sfx, zoom, đồ hoạ. Sửa trong trang (bản nháp cục bộ), bấm Áp dụng+ // Phụ đề dạng transcript (giây bản ra), nhạc, giọng, sfx, zoom, đồ hoạ. Sửa trong trang (bản nháp cục bộ), bấm Áp dụng// thì gửi một bản vá chỉ gồm phần đã đổi; server dựng lại lớp cần thiết ra out-r<n>.mp4.const Man = (() => {- const M = { id: null, outKey: null, orig: null, cur: null, loading: false };+ const M = { id: null, outKey: null, orig: null, cur: null, loading: false, sel: -1, now: -1 };const clone = (x) => JSON.parse(JSON.stringify(x));const sec = (x) => (Math.round(x * 100) / 100).toFixed(2);const db = (x) => `${x > 0 ? '+' : ''}${x} dB`;- const video = () => $('#edMedia video');const isBusy = () => !!state.view && ['queued', 'running'].includes(state.view.status);async function load(id) {@@ -391,28 +494,51 @@const j = await r.json().catch(() => ({}));if (!r.ok) throw new Error(j.error || 'HTTP ' + r.status);if (id !== M.id) return;- M.orig = j; M.cur = clone(j); $('#edManErr').textContent = '';+ M.orig = j; M.cur = clone(j); M.sel = -1; M.now = -1; $('#edManErr').textContent = '';paint();- } catch (e) { if (id === M.id) $('#edManErr').textContent = t('man.loadErr', { e: I.srv(e.message) }); } finally { M.loading = false; paintDirty(); }+ } catch (e) { if (id === M.id) $('#edManErr').textContent = t('man.loadErr', { e: I.srv(e.message) }); } finally { M.loading = false; paintTabs(); paintDirty(); }}// gọi mỗi lần vẽ bản edit: tải lại khi đổi bản hoặc có video ra mớifunction onView(v, busy) {const ready = v.status === 'done' && !!v.links?.out;- if (v.id !== M.id) { M.id = v.id; M.orig = M.cur = null; M.outKey = null; $('#edManErr').textContent = ''; }- $('#edMan').hidden = !M.orig && !ready;- if (M.orig) paintDirty();- if (!ready || busy) return;- const key = `${v.id}|${v.links.out}`;- if (key === M.outKey) return;- M.outKey = key; load(v.id);+ if (v.id !== M.id) { M.id = v.id; M.orig = M.cur = null; M.outKey = null; $('#edManErr').textContent = ''; $('#edLines').replaceChildren(); }+ $('#edMan').hidden = !M.orig && !ready && !v.links?.out;+ $('#edView').classList.toggle('solo', $('#edMan').hidden);+ const key = ready ? `${v.id}|${v.links.out}` : null;+ if (key && !busy && key !== M.outKey) { M.outKey = key; load(v.id); } // load() đặt M.loading ngay (trước await)+ paintTabs();+ paintDirty();+ paintTl();+ }++ // ---- tab: chưa tải được phần chỉnh tay thì chỉ còn "Sửa bằng lời" ----+ const tabsEl = [...document.querySelectorAll('.ed-mtabs [role="tab"]')];+ function pickTab(b, focus) {+ tabsEl.forEach((x) => { const on = x === b; x.setAttribute('aria-selected', String(on)); x.tabIndex = on ? 0 : -1; $('#' + x.getAttribute('aria-controls')).hidden = !on; });+ if (focus) b.focus();+ if (b.id === 'edMtCap') scrollToNow(true);+ }+ function paintTabs() {+ const has = !!M.cur;+ tabsEl.forEach((x) => { if (x.id !== 'edMtRev') x.disabled = !has; });+ const sel = tabsEl.find((x) => x.getAttribute('aria-selected') === 'true');+ if (!has && sel && sel.id !== 'edMtRev' && !M.loading) { pickTab($('#edMtRev')); M.autoRev = true; }+ else if (has && M.autoRev) { M.autoRev = false; if (sel?.id === 'edMtRev') pickTab($('#edMtCap')); }}+ tabsEl.forEach((b) => b.addEventListener('click', () => pickTab(b)));+ $('.ed-mtabs').addEventListener('keydown', (e) => {+ const on = tabsEl.filter((x) => !x.disabled);+ const i = on.indexOf(document.activeElement); if (i < 0) return;+ const step = { ArrowRight: 1, ArrowLeft: -1 }[e.key];+ if (step) { e.preventDefault(); pickTab(on[(i + step + on.length) % on.length], true); }+ });// ---- vẽ ----const musicLabel = (name) => (!name ? '' : name.startsWith('synth:') ? t('man.synth', { id: name.slice(6) }) : name);function paint() {const c = M.cur; if (!c) return;- $('#edMan').hidden = false;- $('#edManLook').innerHTML = c.captions.looks.map((l) => `<option value="${esc(l.id)}">${esc(I.lang === 'en' ? l.nameEn : l.name)}</option>`).join('');+ $('#edMan').hidden = false; $('#edView').classList.remove('solo');+ $('#edManLook').replaceChildren(...c.captions.looks.map((l) => new Option(I.lang === 'en' ? l.nameEn : l.name, l.id)));$('#edManLook').value = c.captions.look;$('#edManHi').checked = c.captions.highlights;$('#edManDraft').hidden = !c.draft;@@ -420,23 +546,37 @@paintLines();const mu = c.music;const opts = [];- if (M.orig.music.on) opts.push(`<option value="keep">${esc(t('man.musicKeep', { name: musicLabel(M.orig.music.name) }))}</option>`);- opts.push(`<option value="none">${esc(t('ed.noMusic'))}</option>`);- for (const s of mu.synth) opts.push(`<option value="synth:${esc(s)}">${esc(t('man.synth', { id: s }))}</option>`);- for (const u of mu.uploads) opts.push(`<option value="upload:${esc(u.file)}">${esc(t('man.uploaded', { name: u.name }))}</option>`);- opts.push(`<option value="file">${esc(t('ed.musicFile'))}</option>`);- $('#edManMusic').innerHTML = opts.join('');+ if (M.orig.music.on) opts.push(new Option(t('man.musicKeep', { name: musicLabel(M.orig.music.name) }), 'keep'));+ opts.push(new Option(t('ed.noMusic'), 'none'));+ for (const s of mu.synth) opts.push(new Option(t('man.synth', { id: s }), `synth:${s}`));+ for (const u of mu.uploads) opts.push(new Option(t('man.uploaded', { name: u.name }), `upload:${u.file}`));+ opts.push(new Option(t('ed.musicFile'), 'file'));+ $('#edManMusic').replaceChildren(...opts);$('#edManMusic').value = mu.source || (M.orig.music.on ? 'keep' : 'none');$('#edManGain').value = mu.gainDb; $('#edManDuck').checked = mu.duck; $('#edManFade').value = mu.fadeOut; $('#edManStart').value = mu.start;$('#edManVoice').value = c.voice.gainDb;$('#edManSfx').checked = c.sfx.on; $('#edManSfx').disabled = !c.sfx.count;$('#edManSfxL').textContent = t('man.sfx', { n: c.sfx.count });paintAudioOut();- const rm = (on, what) => `<button type="button" class="ed-mx" aria-pressed="${on}" aria-label="${esc(on ? t('man.undoN', { what }) : t('man.removeN', { what }))}">${esc(on ? t('man.undo') : t('man.remove'))}</button>`;- $('#edManZooms').innerHTML = c.zooms.length ? c.zooms.map((z) => `<li data-n="${z.n}" class="${z.gone ? 'gone' : ''}"><button type="button" class="ed-tm" data-t="${z.at}" aria-label="${esc(t('man.jump', { s: sec(z.at) }))}">${sec(z.at)}</button><span>${esc(t('man.zoomKind', { kind: z.kind, scale: z.scale.toFixed(2) }))}</span>${rm(!!z.gone, `zoom ${sec(z.at)} s`)}</li>`).join('') : `<li class="none">${esc(t('man.noZoom'))}</li>`;- $('#edManGfx').innerHTML = c.graphics.length ? c.graphics.map((g) => `<li data-id="${esc(g.id)}" class="${g.gone ? 'gone' : ''}"><button type="button" class="ed-tm" data-t="${g.at}" aria-label="${esc(t('man.jump', { s: sec(g.at) }))}">${sec(g.at)}</button><span>${esc(g.type)}${g.title ? ` · ${esc(String(g.title).slice(0, 40))}` : ''}</span>${rm(!!g.gone, `${g.type} ${sec(g.at)} s`)}</li>`).join('') : `<li class="none">${esc(t('man.noGfx'))}</li>`;+ $('#edManZooms').replaceChildren(...(c.zooms.length ? c.zooms.map((z) => fxRow(z.at, t('man.zoomKind', { kind: z.kind, scale: z.scale.toFixed(2) }), !!z.gone, `zoom ${sec(z.at)} s`, { n: String(z.n) })) : [el('li', 'none', t('man.noZoom'))]));+ $('#edManGfx').replaceChildren(...(c.graphics.length ? c.graphics.map((g) => fxRow(g.at, `${g.type}${g.title ? ` · ${String(g.title).slice(0, 40)}` : ''}`, !!g.gone, `${g.type} ${sec(g.at)} s`, { id: String(g.id) })) : [el('li', 'none', t('man.noGfx'))]));+ paintTl();paintDirty();}+ function tmBtn(at) {+ const b = el('button', 'ed-tm', fmtT(at)); b.type = 'button'; b.dataset.t = String(at);+ b.setAttribute('aria-label', t('man.jump', { s: sec(at) }));+ return b;+ }+ function fxRow(at, label, gone, what, data) {+ const li = el('li', gone ? 'gone' : null);+ Object.assign(li.dataset, data);+ const x = el('button', 'ed-mx', gone ? t('man.undo') : t('man.remove')); x.type = 'button';+ x.setAttribute('aria-pressed', String(gone));+ x.setAttribute('aria-label', gone ? t('man.undoN', { what }) : t('man.removeN', { what }));+ li.append(tmBtn(at), el('span', null, label), x);+ return li;+ }function paintAudioOut() {$('#edManGainV').textContent = db(Number($('#edManGain').value));$('#edManFadeV').textContent = `${Number($('#edManFade').value)} s`;@@ -454,26 +594,59 @@});return bad;}+ // một dòng transcript: mốc giờ nhỏ + chữ sửa tại chỗ; giờ bắt đầu/kết thúc và Tách/Gộp/Xoá chỉ hiện khi rê chuột+ // hoặc khi dòng đang chọn+ function lineRow(l, k, n, bad, draft) {+ const li = el('li', 'ed-ln'); li.dataset.k = String(k);+ if (bad.has(k)) li.classList.add('bad');+ if (k === M.sel) li.classList.add('sel');+ if (k === M.now) li.classList.add('now');+ const tx = el('input', 'ed-ltext'); tx.value = l.text; tx.maxLength = 200; tx.disabled = draft; tx.spellcheck = false;+ tx.setAttribute('aria-label', t('man.lineText', { n: k + 1 }));+ const num = (f, v) => {+ const i = el('input', 'ed-sm ed-num'); i.type = 'number'; i.step = '0.05'; i.min = '0'; i.inputMode = 'decimal';+ i.dataset.f = f; i.value = sec(v); i.disabled = draft;+ i.setAttribute('aria-label', t(f === 'start' ? 'man.lineStart' : 'man.lineEnd', { n: k + 1 }));+ return i;+ };+ const times = el('span', 'ed-ltime'); times.append(num('start', l.start), el('span', null, '→'), num('end', l.end));+ times.lastChild.previousSibling.setAttribute('aria-hidden', 'true');+ const act = el('span', 'ed-lact');+ const btn = (a, label, aria, dis, cls) => { const b = el('button', cls || null, label); b.type = 'button'; b.dataset.a = a; b.setAttribute('aria-label', aria); b.disabled = dis; return b; };+ act.append(btn('split', t('man.split'), t('man.splitN', { n: k + 1 }), draft),+ btn('merge', t('man.merge'), t('man.mergeN', { n: k + 1 }), draft || k + 1 >= n),+ btn('del', '×', t('man.delN', { n: k + 1 }), draft, 'del'));+ const x = el('div', 'ed-lx'); x.append(times, act);+ li.append(tmBtn(l.start), tx, x);+ if (bad.has(k)) li.append(el('span', 'ed-lerr', bad.get(k)));+ return li;+ }function paintLines() {const c = M.cur; const lines = c.captions.lines;const bad = lineErrors(lines);- const dis = c.draft ? ' disabled' : '';- $('#edLines').innerHTML = lines.length ? lines.map((l, k) => `<li data-k="${k}"${bad.has(k) ? ' class="bad"' : ''}>- <button type="button" class="ed-tm" data-t="${l.start}" aria-label="${esc(t('man.jump', { s: sec(l.start) }))}">${sec(l.start)}</button>- <input class="ed-in ed-ltext" value="${esc(l.text)}" maxlength="200" aria-label="${esc(t('man.lineText', { n: k + 1 }))}"${dis} />- <span class="ed-ltime">- <input class="ed-in ed-num" data-f="start" type="number" step="0.05" min="0" inputmode="decimal" value="${sec(l.start)}" aria-label="${esc(t('man.lineStart', { n: k + 1 }))}"${dis} />- <span aria-hidden="true">→</span>- <input class="ed-in ed-num" data-f="end" type="number" step="0.05" min="0" inputmode="decimal" value="${sec(l.end)}" aria-label="${esc(t('man.lineEnd', { n: k + 1 }))}"${dis} />- </span>- <span class="ed-lact">- <button type="button" data-a="split" aria-label="${esc(t('man.splitN', { n: k + 1 }))}"${dis}>${esc(t('man.split'))}</button>- <button type="button" data-a="merge" aria-label="${esc(t('man.mergeN', { n: k + 1 }))}"${k + 1 < lines.length ? dis : ' disabled'}>${esc(t('man.merge'))}</button>- <button type="button" data-a="del" class="del" aria-label="${esc(t('man.delN', { n: k + 1 }))}"${dis}>×</button>- </span>- ${bad.has(k) ? `<span class="ed-lerr">${esc(bad.get(k))}</span>` : ''}- </li>`).join('') : `<li class="none">${esc(t('man.noLines'))}</li>`;+ $('#edLines').replaceChildren(...(lines.length ? lines.map((l, k) => lineRow(l, k, lines.length, bad, !!c.draft)) : [el('li', 'none', t('man.noLines'))]));}+ // thanh thời gian dưới player: vạch zoom, khoảng đồ hoạ, đầu phát+ function paintTl() {+ const c = M.cur; const tl = $('#edTl');+ tl.hidden = !c || !video() || !(c.duration > 0);+ if (tl.hidden) return;+ const pc = (x) => `${Math.max(0, Math.min(100, (x / c.duration) * 100))}%`;+ const marks = [];+ for (const g of c.graphics) { const m = el('i', 'g' + (g.gone ? ' gone' : '')); m.style.left = pc(g.at); m.style.width = `calc(${pc(Math.max(0.2, (g.until ?? g.at + 1) - g.at))})`; marks.push(m); }+ for (const z of c.zooms) { const m = el('i', 'z' + (z.gone ? ' gone' : '')); m.style.left = pc(z.at); marks.push(m); }+ $('#edTlTrack').replaceChildren(...marks, $('#edTlHead'));+ paintHead();+ }+ function paintHead() {+ const v = video(); const c = M.cur; if (!v || !c?.duration) return;+ $('#edTlHead').style.left = `${Math.min(100, (v.currentTime / c.duration) * 100)}%`;+ }+ $('#edTlTrack').addEventListener('click', (e) => {+ const c = M.cur; if (!c) return;+ const r = e.currentTarget.getBoundingClientRect();+ seek(((e.clientX - r.left) / r.width) * c.duration, false);+ });// ---- bản vá = phần khác bản đang có ----function patch() {@@ -496,36 +669,47 @@const gr = c.graphics.filter((g) => g.gone).map((g) => g.id); if (gr.length) p.graphics = { remove: gr };return p;}+ // thanh Áp dụng / Bỏ thay đổi: chỉ hiện khi có thay đổi (hoặc dòng lỗi, hoặc đang dựng bản chỉnh tay)function paintDirty() {const p = patch(); const n = Object.values(p).reduce((s, v) => s + Object.keys(v).length, 0);const bad = M.cur ? lineErrors(M.cur.captions.lines).size : 0;+ const applying = isBusy() && state.view?.action === 'manual' && !!M.orig; // trang mở giữa chừng: tiến độ đã ở dòng đầuconst what = [...new Set([(p.captions || p.graphics) && t('man.wCap'), (p.music || p.voice || p.sfx) && t('man.wAud'), (p.zooms || p.graphics) && t('man.wBase')].filter(Boolean))];- const el = $('#edManDirty');- el.textContent = bad ? t('man.fixFirst', { n: bad }) : n ? t('man.dirty', { n, what: what.join(' + ') }) : t('man.clean');- el.classList.toggle('bad', !!bad);+ $('#edManBar').hidden = !(n || bad || applying);+ const d = $('#edManDirty');+ d.textContent = bad ? t('man.fixFirst', { n: bad }) : applying ? t('man.running') : t('man.dirtyS', { n });+ d.title = n ? t('man.dirty', { n, what: what.join(' + ') }) : '';+ d.classList.toggle('bad', !!bad);$('#edManApply').disabled = !n || !!bad || isBusy() || M.loading;- $('#edManApply').textContent = isBusy() && state.view?.action === 'manual' ? t('man.applying') : t('man.apply');+ $('#edManApply').textContent = applying ? t('man.applying') : t('man.apply');$('#edManReset').disabled = !n || isBusy();}// ---- sự kiện ----- const tabsEl = [...document.querySelectorAll('.ed-mtabs [role="tab"]')];- function pickTab(b, focus) {- tabsEl.forEach((x) => { const on = x === b; x.setAttribute('aria-selected', String(on)); x.tabIndex = on ? 0 : -1; $('#' + x.getAttribute('aria-controls')).hidden = !on; });- if (focus) b.focus();- }- tabsEl.forEach((b) => b.addEventListener('click', () => pickTab(b)));- $('.ed-mtabs').addEventListener('keydown', (e) => {- const i = tabsEl.indexOf(document.activeElement); if (i < 0) return;- const step = { ArrowRight: 1, ArrowLeft: -1 }[e.key];- if (step) { e.preventDefault(); pickTab(tabsEl[(i + step + tabsEl.length) % tabsEl.length], true); }- });// bấm mốc giờ → video nhảy tới đúng giây (dòng phụ đề, zoom, đồ hoạ)$('#edMan').addEventListener('click', (e) => {- const tm = e.target.closest('.ed-tm'); if (!tm) return;- const v = video(); if (!v) return;- v.currentTime = Math.max(0, Number(tm.dataset.t) + 0.02);- v.play().catch(() => {});+ const tm = e.target.closest('.ed-tm'); if (tm) seek(Number(tm.dataset.t), true);+ });+ function setSel(k) {+ M.sel = k;+ document.querySelectorAll('#edLines li.sel').forEach((x) => { if (Number(x.dataset.k) !== k) x.classList.remove('sel'); });+ $(`#edLines li[data-k="${k}"]`)?.classList.add('sel');+ }+ // chọn 1 dòng (bấm vào chữ) → dòng mở công cụ, video đứng ở đầu dòng+ $('#edLines').addEventListener('focusin', (e) => {+ const li = e.target.closest('li[data-k]'); if (!li || !M.cur) return;+ const k = Number(li.dataset.k);+ if (k !== M.sel) {+ setSel(k);+ const v = video(); const l = M.cur.captions.lines[k];+ if (v && l && v.paused && e.target.classList.contains('ed-ltext')) seek(l.start, false);+ }+ });+ $('#edLines').addEventListener('keydown', (e) => {+ if (!e.target.classList.contains('ed-ltext') || !['Enter', 'ArrowDown', 'ArrowUp'].includes(e.key)) return;+ const k = Number(e.target.closest('li').dataset.k) + (e.key === 'ArrowUp' ? -1 : 1);+ const nx = $(`#edLines li[data-k="${k}"] .ed-ltext`);+ if (nx) { e.preventDefault(); nx.focus(); }});$('#edLines').addEventListener('input', (e) => {const li = e.target.closest('li[data-k]'); if (!li || !M.cur) return;@@ -536,9 +720,9 @@document.querySelectorAll('#edLines li[data-k]').forEach((x) => {const k = Number(x.dataset.k); x.classList.toggle('bad', bad.has(k));let er = x.querySelector('.ed-lerr');- if (bad.has(k)) { if (!er) { er = document.createElement('span'); er.className = 'ed-lerr'; x.append(er); } er.textContent = bad.get(k); } else er?.remove();+ if (bad.has(k)) { if (!er) { er = el('span', 'ed-lerr'); x.append(er); } er.textContent = bad.get(k); } else er?.remove();const tb = x.querySelector('.ed-tm'); const ln = M.cur.captions.lines[k];- if (tb && ln) { tb.dataset.t = ln.start; tb.textContent = sec(ln.start); }+ if (tb && ln) { tb.dataset.t = String(ln.start); tb.textContent = fmtT(ln.start); }});paintDirty();});@@ -555,18 +739,33 @@lines.splice(k, 1, { start: l.start, end: mid, text: a }, { start: mid, end: l.end, text: z });}$('#edManErr').textContent = '';+ M.sel = Math.min(k, lines.length - 1);paintLines(); paintDirty();- $(`#edLines li[data-k="${Math.min(k, lines.length - 1)}"] .ed-ltext`)?.focus();+ $(`#edLines li[data-k="${M.sel}"] .ed-ltext`)?.focus();});- // dòng đang phát sáng lên theo giờ video+ // dòng đang phát tô sáng và tự cuộn tới (trong khung danh sách, không kéo cả trang; đang gõ thì không cuộn)+ function scrollToNow(force) {+ const list = $('#edLines'); const li = $(`#edLines li[data-k="${M.now}"]`); // .ed-lines position: relative → li.offsetTop tính từ khung list+ if (!li || list.hidden || !list.offsetParent) return;+ if (!force && list.contains(document.activeElement)) return;+ const top = li.offsetTop; const bot = top + li.offsetHeight;+ if (top < list.scrollTop + 8 || bot > list.scrollTop + list.clientHeight - 8) {+ const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;+ list.scrollTo({ top: Math.max(0, top - list.clientHeight / 3), behavior: reduce || force ? 'auto' : 'smooth' });+ }+ }$('#edMedia').addEventListener('timeupdate', (e) => {if (!M.cur || e.target.tagName !== 'VIDEO') return;- const tt = e.target.currentTime;- document.querySelectorAll('#edLines li[data-k]').forEach((x) => {- const l = M.cur.captions.lines[Number(x.dataset.k)];- x.classList.toggle('now', !!l && tt >= l.start && tt < l.end);- });+ paintHead();+ const tt = e.target.currentTime; const lines = M.cur.captions.lines;+ const k = lines.findIndex((l) => tt >= l.start && tt < l.end);+ if (k === M.now) return;+ $(`#edLines li[data-k="${M.now}"]`)?.classList.remove('now');+ M.now = k;+ $(`#edLines li[data-k="${k}"]`)?.classList.add('now');+ scrollToNow(false);}, true);+ $('#edMedia').addEventListener('loadedmetadata', () => paintTl(), true);$('#edManLook').addEventListener('change', (e) => { M.cur.captions.look = e.target.value; paintDirty(); });$('#edManHi').addEventListener('change', (e) => { M.cur.captions.highlights = e.target.checked; paintDirty(); });const num = (id, f) => $(id).addEventListener('input', (e) => { const x = Number(e.target.value); if (Number.isFinite(x) && M.cur) f(x); paintAudioOut(); paintDirty(); });@@ -598,10 +797,10 @@paint();} catch (err) { msg.textContent = t('man.uploadErr', { e: I.srv(err.message) }); }});- const toggleGone = (list, li, find) => { const x = list.find(find); if (x) x.gone = !x.gone; paint(); li && $(`#${li}`)?.focus(); };- $('#edManZooms').addEventListener('click', (e) => { const b = e.target.closest('.ed-mx'); if (b) toggleGone(M.cur.zooms, null, (x) => x.n === Number(b.closest('li').dataset.n)); });- $('#edManGfx').addEventListener('click', (e) => { const b = e.target.closest('.ed-mx'); if (b) toggleGone(M.cur.graphics, null, (x) => x.id === b.closest('li').dataset.id); });- $('#edManReset').addEventListener('click', () => { if (M.orig) { M.cur = clone(M.orig); $('#edManErr').textContent = ''; $('#edManMusicMsg').textContent = ''; paint(); } });+ const toggleGone = (list, find) => { const x = list.find(find); if (x) x.gone = !x.gone; paint(); };+ $('#edManZooms').addEventListener('click', (e) => { const b = e.target.closest('.ed-mx'); if (b) toggleGone(M.cur.zooms, (x) => x.n === Number(b.closest('li').dataset.n)); });+ $('#edManGfx').addEventListener('click', (e) => { const b = e.target.closest('.ed-mx'); if (b) toggleGone(M.cur.graphics, (x) => String(x.id) === b.closest('li').dataset.id); });+ $('#edManReset').addEventListener('click', () => { if (M.orig) { M.cur = clone(M.orig); M.sel = -1; $('#edManErr').textContent = ''; $('#edManMusicMsg').textContent = ''; paint(); } });$('#edManApply').addEventListener('click', async () => {const p = patch(); if (!M.id || !Object.keys(p).length) return;$('#edManApply').disabled = true; $('#edManErr').textContent = '';diff --git a/server/public/i18n.js b/server/public/i18n.jsindex 82b8fc0..12454b7 100644--- a/server/public/i18n.js+++ b/server/public/i18n.js@@ -376,7 +376,7 @@'ed.notesPh': 'Ví dụ: bỏ câu chào đầu, giữ đoạn cuối kêu gọi theo dõi','ed.draft': 'Bản nháp nhanh (phụ đề đơn giản, nhanh hơn ~1 phút)','ed.go': 'Dựng',- 'ed.empty': 'Chọn video bên trái rồi bấm Dựng. Bản dựng sẽ hiện ở đây: tiến độ từng bước, video ra, chữ AI đã sửa, và ô sửa bằng lời.',+ 'ed.empty': 'Chọn video bên trái rồi bấm Dựng.','ed.steps': 'Các bước','ed.fixesH': 'Chữ AI đã sửa trong phụ đề, xem lại giúp','ed.reviseH': 'Sửa bằng lời',@@ -437,7 +437,7 @@'man.start': 'Nhạc bắt đầu từ giây','man.voice': 'Âm lượng giọng (so với nhạc)','man.loudHint': 'Cả bản luôn chuẩn về −14 LUFS: tăng giọng tức là nhạc và tiếng động nhỏ đi tương đối.',- 'man.sfx': (v) => `Tiếng động (sfx)${v.n ? ` · ${v.n} tiếng` : ' · bản này không có'}`,+ 'man.sfx': (v) => `Tiếng động${v.n ? ` · ${v.n}` : ' · không có'}`,'man.zooms': 'Zoom','man.gfx': 'Đồ hoạ','man.zoomKind': (v) => `${v.kind === 'punch' ? 'Zoom giật' : 'Zoom đẩy'} ×${v.scale}`,@@ -499,6 +499,21 @@'ed.figuresH': 'Số máy nghe không chắc, chưa đưa lên đồ hoạ, nghe lại giúp','ed.figAt': '{s} s nguồn','ed.figHeard': 'nghe lại: “{h}”',+ 'ed.more': 'Thêm',+ 'ed.review': (v) => `Cần xem lại (${v.n})`,+ 'ed.revFixes': 'Chữ AI sửa',+ 'ed.revFigs': 'Số chưa chắc',+ 'ed.specs': 'Thông số',+ 'ed.stepOf': '{i}/{n} · {step} · {p}%',+ 'ed.revisePhS': 'bỏ 3 giây đầu…',+ 'man.hiShort': 'Chữ nhấn',+ 'man.hiTip': 'Bọc *chữ* để đổi màu',+ 'man.gainS': 'Âm lượng',+ 'man.fadeS': 'Fade cuối',+ 'man.startS': 'Bắt đầu (s)',+ 'man.duckS': 'Tự hạ khi nói',+ 'man.voiceS': 'Giọng',+ 'man.dirtyS': (v) => `${v.n} thay đổi`,'ed.cutRepairs': (v) => `đã sửa ${v.n} vết cắt lẹm chữ`,// ---- Tạo mẫu từ video (learn-panel.js) ----@@ -989,7 +1004,7 @@'ed.notesPh': 'e.g. cut the opening greeting, keep the follow call at the end','ed.draft': 'Quick draft (simple captions, ~1 min faster)','ed.go': 'Build',- 'ed.empty': "Pick a video on the left, then hit Build. Your edit shows up here: step-by-step progress, the output video, words AI fixed, and a box to request changes.",+ 'ed.empty': 'Pick a video on the left, then hit Build.','ed.steps': 'Steps','ed.fixesH': 'Words AI fixed in the captions — please check','ed.reviseH': 'Request changes',@@ -1050,7 +1065,7 @@'man.start': 'Music starts at second','man.voice': 'Voice volume (vs. music)','man.loudHint': 'The whole mix is always normalised to −14 LUFS: a louder voice means relatively quieter music and effects.',- 'man.sfx': (v) => `Sound effects (sfx)${v.n ? ` · ${v.n}` : ' · none in this edit'}`,+ 'man.sfx': (v) => `Sound effects${v.n ? ` · ${v.n}` : ' · none'}`,'man.zooms': 'Zooms','man.gfx': 'Graphics','man.zoomKind': (v) => `${v.kind === 'punch' ? 'Punch zoom' : 'Push zoom'} ×${v.scale}`,@@ -1112,6 +1127,21 @@'ed.figuresH': "Numbers the machine wasn't sure it heard, left off the graphics: please listen again",'ed.figAt': '{s} s in source','ed.figHeard': 'heard again as: “{h}”',+ 'ed.more': 'More',+ 'ed.review': (v) => `Review (${v.n})`,+ 'ed.revFixes': 'AI-fixed words',+ 'ed.revFigs': 'Unsure numbers',+ 'ed.specs': 'Specs',+ 'ed.stepOf': '{i}/{n} · {step} · {p}%',+ 'ed.revisePhS': 'cut the first 3 seconds…',+ 'man.hiShort': 'Highlights',+ 'man.hiTip': 'Wrap *words* to highlight',+ 'man.gainS': 'Volume',+ 'man.fadeS': 'Fade out',+ 'man.startS': 'Start (s)',+ 'man.duckS': 'Duck under voice',+ 'man.voiceS': 'Voice',+ 'man.dirtyS': (v) => `${v.n} change${S(v.n)}`,'ed.cutRepairs': (v) => `fixed ${v.n} cut${S(v.n)} that clipped words`,// ---- Create a template from a video (learn-panel.js) ----@@ -1288,6 +1318,7 @@root.querySelectorAll('[data-i18n]').forEach((el) => { el.textContent = t(el.dataset.i18n); });root.querySelectorAll('[data-i18n-placeholder]').forEach((el) => { el.placeholder = t(el.dataset.i18nPlaceholder); });root.querySelectorAll('[data-i18n-aria]').forEach((el) => { el.setAttribute('aria-label', t(el.dataset.i18nAria)); });+ root.querySelectorAll('[data-i18n-title]').forEach((el) => { el.title = t(el.dataset.i18nTitle); });}function syncSwitch() {document.querySelectorAll('[data-lang]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.lang === lang)));diff --git a/server/public/index.html b/server/public/index.htmlindex df0e2aa..5cfdec7 100644--- a/server/public/index.html+++ b/server/public/index.html@@ -178,95 +178,95 @@</button></div><div class="ed-main">- <div class="ed-empty" id="edEmpty" data-i18n="ed.empty">Chọn video bên trái rồi bấm Dựng. Bản dựng sẽ hiện ở đây: tiến độ từng bước, video ra, chữ AI đã sửa, và ô sửa bằng lời.</div>- <div class="ed-card" id="edView" hidden>- <div class="ed-view">- <div class="ed-media" id="edMedia"></div>- <div>- <div class="ed-head"><span class="tt" id="edTitle"></span><span class="st" id="edStatus"></span></div>- <div class="jid" id="edId"></div>- <div class="bar" id="edBarWrap" hidden><i id="edBar"></i></div>- <div class="hint" id="edNote" aria-live="polite"></div>- <ol class="steps" id="edSteps" aria-label="Các bước" data-i18n-aria="ed.steps"></ol>- <div class="errmsg" id="edViewErr" role="alert"></div>- <div class="links" id="edLinks"></div>+ <div class="ed-empty" id="edEmpty" data-i18n="ed.empty">Chọn video bên trái rồi bấm Dựng.</div>+ <div class="ed-card ed-res" id="edView" hidden>+ <div class="ed-rhead">+ <div class="ed-rtitle"><span class="tt" id="edTitle"></span><span class="ed-dur" id="edDur"></span><span class="st" id="edStatus" hidden></span></div>+ <div class="ed-ract">+ <button type="button" class="ed-review" id="edReviewBtn" aria-expanded="false" aria-controls="edReviewPop" hidden>+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/></svg><span id="edReviewL"></span>+ </button>+ <a class="ed-dl" id="edDl" download hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v12m0 0-5-5m5 5 5-5M4 20h16"/></svg><span data-i18n="ed.mp4">Tải MP4</span></a>+ <button type="button" class="ed-moreb" id="edMoreBtn" aria-expanded="false" aria-controls="edMorePop" aria-label="Thêm" data-i18n-aria="ed.more">+ <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="5" cy="12" r="1.7"/><circle cx="12" cy="12" r="1.7"/><circle cx="19" cy="12" r="1.7"/></svg>+ </button>+ </div>+ <div class="ed-pop" id="edReviewPop" hidden><ul class="ed-rlist" id="edReviewList"></ul></div>+ <div class="ed-pop" id="edMorePop" hidden>+ <div class="ed-popmeta" id="edId"></div>+ <div class="ed-poplinks" id="edLinks"></div>+ <h4 data-i18n="ed.specs">Thông số</h4><div class="ed-checks" id="edChecks"></div>- <div class="fixes" id="edFixes" hidden>- <h4 data-i18n="ed.fixesH">Chữ AI đã sửa trong phụ đề, xem lại giúp</h4>- <ul id="edFixList"></ul>- </div>- <div class="fixes" id="edFigures" hidden>- <h4 data-i18n="ed.figuresH">Số máy nghe không chắc, chưa đưa lên đồ hoạ, nghe lại giúp</h4>- <ul id="edFigureList"></ul>+ <details class="log"><summary data-i18n="ed.log">Nhật ký</summary><pre id="edLog"></pre></details>+ <button type="button" class="ed-delb" id="edDelete" data-i18n="ed.delete">Xoá bản dựng này</button>+ </div>+ </div>+ <div class="ed-prog" id="edProg" hidden><div class="bar"><i id="edBar"></i></div><span class="ed-progt" id="edProgText" aria-live="polite"></span></div>+ <div class="errmsg" id="edViewErr" role="alert"></div>+ <div class="ed-body">+ <div class="ed-stage">+ <div class="ed-media" id="edMedia"></div>+ <div class="ed-tl" id="edTl" hidden>+ <div class="ed-tltrack" id="edTlTrack" aria-hidden="true"><i class="ed-tlh" id="edTlHead"></i></div>+ <div class="ed-tlleg" aria-hidden="true"><span class="z" data-i18n="man.zooms">Zoom</span><span class="g" data-i18n="man.gfx">Đồ hoạ</span></div></div>- <div class="ed-revise" id="edRevise" hidden>- <h4 data-i18n="ed.reviseH">Sửa bằng lời</h4>- <form id="edReviseForm" class="ed-row">- <label class="sr" for="edReviseText" data-i18n="ed.reviseLabel">Lời sửa</label>- <input class="ed-in" id="edReviseText" type="text" maxlength="1000" placeholder='Ví dụ: "bỏ 3 giây đầu", "zoom ít lại"' data-i18n-placeholder="ed.revisePh" autocomplete="off" />- <button type="submit" id="edReviseBtn" data-i18n="ed.reviseBtn">Render lại</button>- </form>- <div class="ed-presets" id="edPresets"><button type="button" data-i18n="ed.p1">bỏ 3 giây đầu</button><button type="button" data-i18n="ed.p2">zoom ít lại</button><button type="button" data-i18n="ed.p3">nhạc nhỏ lại</button><button type="button" data-i18n="ed.p4">phụ đề 2 chữ một lần</button></div>+ </div>+ <section class="ed-side" id="edMan" hidden aria-label="Chỉnh" data-i18n-aria="man.h">+ <div class="ed-mtabs" role="tablist" aria-label="Chỉnh" data-i18n-aria="man.h">+ <button type="button" role="tab" id="edMtCap" aria-controls="edMpCap" aria-selected="true" data-i18n="man.tabCap">Phụ đề</button>+ <button type="button" role="tab" id="edMtAud" aria-controls="edMpAud" aria-selected="false" tabindex="-1" data-i18n="man.tabAud">Nhạc & tiếng</button>+ <button type="button" role="tab" id="edMtFx" aria-controls="edMpFx" aria-selected="false" tabindex="-1" data-i18n="man.tabFx">Zoom & đồ hoạ</button>+ <button type="button" role="tab" id="edMtRev" aria-controls="edMpRev" aria-selected="false" tabindex="-1" data-i18n="ed.reviseH">Sửa bằng lời</button></div>- <section class="ed-man" id="edMan" hidden aria-labelledby="edManH">- <h4 id="edManH" data-i18n="man.h">Chỉnh tay</h4>- <div class="ed-mtabs" role="tablist" aria-label="Chỉnh tay" data-i18n-aria="man.h">- <button type="button" role="tab" id="edMtCap" aria-controls="edMpCap" aria-selected="true" data-i18n="man.tabCap">Phụ đề</button>- <button type="button" role="tab" id="edMtAud" aria-controls="edMpAud" aria-selected="false" tabindex="-1" data-i18n="man.tabAud">Nhạc & tiếng</button>- <button type="button" role="tab" id="edMtFx" aria-controls="edMpFx" aria-selected="false" tabindex="-1" data-i18n="man.tabFx">Zoom & đồ hoạ</button>- </div>- <div role="tabpanel" id="edMpCap" aria-labelledby="edMtCap" class="ed-mpanel">- <div class="ed-mrow">- <label class="ed-mlab" for="edManLook" data-i18n="man.look">Kiểu chữ</label>- <select class="ed-in" id="edManLook"></select>- </div>- <label class="ed-check"><input type="checkbox" id="edManHi" /> <span data-i18n="man.hi">Chữ nhấn (chữ trong *sao* đổi màu)</span></label>- <p class="hint ed-mhint" data-i18n="man.capHint">Bấm mốc giờ để video nhảy tới dòng đó. Bọc *chữ* để nhấn.</p>- <p class="hint" id="edManDraft" hidden data-i18n="man.draftNote">Bản nháp vẽ phụ đề thẳng vào nền nên chưa sửa tay được. Bỏ "nháp" rồi dựng lại.</p>- <ol class="ed-lines" id="edLines"></ol>+ <div role="tabpanel" id="edMpCap" aria-labelledby="edMtCap" class="ed-mpanel">+ <div class="ed-captop">+ <label class="ed-mini" for="edManLook" data-i18n="man.look">Kiểu chữ</label>+ <select class="ed-sm" id="edManLook"></select>+ <label class="ed-minichk" title="Bọc *chữ* để đổi màu" data-i18n-title="man.hiTip"><input type="checkbox" id="edManHi" /> <span data-i18n="man.hiShort">Chữ nhấn</span></label></div>- <div role="tabpanel" id="edMpAud" aria-labelledby="edMtAud" class="ed-mpanel" hidden>- <div class="ed-mrow">- <label class="ed-mlab" for="edManMusic" data-i18n="man.music">Nhạc</label>- <select class="ed-in" id="edManMusic"></select>- <input type="file" id="edManMusicFile" accept="audio/*,.mp3,.wav,.m4a,.aac,.ogg,.flac,.opus" hidden />- </div>- <div class="ed-file" id="edManMusicMsg" aria-live="polite"></div>- <div class="ed-slider" id="edManMusicBox">- <label for="edManGain"><span data-i18n="man.musicGain">Âm lượng nhạc</span> <output id="edManGainV" for="edManGain"></output></label>- <input type="range" id="edManGain" min="-40" max="0" step="1" />- <label class="ed-check"><input type="checkbox" id="edManDuck" /> <span data-i18n="man.duck">Ducking: nhạc nhỏ lại khi có tiếng nói</span></label>- <label for="edManFade"><span data-i18n="man.fade">Fade out cuối</span> <output id="edManFadeV" for="edManFade"></output></label>- <input type="range" id="edManFade" min="0" max="10" step="0.5" />- <div class="ed-mrow">- <label class="ed-mlab" for="edManStart" data-i18n="man.start">Nhạc bắt đầu từ giây</label>- <input class="ed-in ed-num" id="edManStart" type="number" min="0" max="600" step="0.5" inputmode="decimal" />- </div>- </div>- <div class="ed-slider">- <label for="edManVoice"><span data-i18n="man.voice">Âm lượng giọng (so với nhạc)</span> <output id="edManVoiceV" for="edManVoice"></output></label>- <input type="range" id="edManVoice" min="-12" max="12" step="1" />- </div>- <p class="hint" data-i18n="man.loudHint">Cả bản luôn chuẩn về −14 LUFS: tăng giọng tức là nhạc và tiếng động nhỏ đi tương đối.</p>- <label class="ed-check"><input type="checkbox" id="edManSfx" /> <span id="edManSfxL">Tiếng động (sfx)</span></label>+ <p class="hint" id="edManDraft" hidden data-i18n="man.draftNote">Bản nháp vẽ phụ đề thẳng vào nền nên chưa sửa tay được. Bỏ "nháp" rồi dựng lại.</p>+ <ol class="ed-lines" id="edLines" aria-label="Phụ đề" data-i18n-aria="man.tabCap"></ol>+ </div>+ <div role="tabpanel" id="edMpAud" aria-labelledby="edMtAud" class="ed-mpanel" hidden>+ <div class="ed-arow">+ <label class="ed-mini" for="edManMusic" data-i18n="man.music">Nhạc</label>+ <select class="ed-sm" id="edManMusic"></select>+ <input type="file" id="edManMusicFile" accept="audio/*,.mp3,.wav,.m4a,.aac,.ogg,.flac,.opus" hidden /></div>- <div role="tabpanel" id="edMpFx" aria-labelledby="edMtFx" class="ed-mpanel" hidden>- <h5 data-i18n="man.zooms">Zoom</h5>- <ul class="ed-fxlist" id="edManZooms"></ul>- <h5 data-i18n="man.gfx">Đồ hoạ</h5>- <ul class="ed-fxlist" id="edManGfx"></ul>+ <div class="ed-file" id="edManMusicMsg" aria-live="polite"></div>+ <div class="ed-agrp" id="edManMusicBox">+ <div class="ed-arow"><label class="ed-mini" for="edManGain" data-i18n="man.gainS">Âm lượng</label><input type="range" id="edManGain" min="-40" max="0" step="1" /><output id="edManGainV" for="edManGain"></output></div>+ <div class="ed-arow"><label class="ed-mini" for="edManFade" data-i18n="man.fadeS">Fade cuối</label><input type="range" id="edManFade" min="0" max="10" step="0.5" /><output id="edManFadeV" for="edManFade"></output></div>+ <div class="ed-arow"><label class="ed-mini" for="edManStart" data-i18n="man.startS">Bắt đầu (s)</label><input class="ed-sm ed-num" id="edManStart" type="number" min="0" max="600" step="0.5" inputmode="decimal" /></div>+ <label class="ed-minichk"><input type="checkbox" id="edManDuck" /> <span data-i18n="man.duckS">Tự hạ khi nói</span></label></div>- <div class="errmsg" id="edManErr" role="alert"></div>- <div class="ed-mbar">- <span class="ed-mdirty" id="edManDirty" aria-live="polite"></span>- <button type="button" class="ed-mreset" id="edManReset" data-i18n="man.reset">Bỏ thay đổi</button>- <button type="button" class="ed-mapply" id="edManApply" data-i18n="man.apply">Áp dụng</button>+ <div class="ed-agrp">+ <div class="ed-arow" title="Cả bản luôn chuẩn về −14 LUFS: tăng giọng tức là nhạc và tiếng động nhỏ đi tương đối." data-i18n-title="man.loudHint"><label class="ed-mini" for="edManVoice" data-i18n="man.voiceS">Giọng</label><input type="range" id="edManVoice" min="-12" max="12" step="1" /><output id="edManVoiceV" for="edManVoice"></output></div>+ <label class="ed-minichk"><input type="checkbox" id="edManSfx" /> <span id="edManSfxL">Tiếng động</span></label></div>- </section>- <div class="ed-hist" id="edHist" hidden><h4 data-i18n="ed.histH">Các lần sửa</h4><ol id="edHistList"></ol></div>- <details class="log"><summary data-i18n="ed.log">Nhật ký</summary><pre id="edLog"></pre></details>- <div class="links ed-danger"><button type="button" id="edDelete" data-i18n="ed.delete">Xoá bản dựng này</button></div>- </div>+ </div>+ <div role="tabpanel" id="edMpFx" aria-labelledby="edMtFx" class="ed-mpanel" hidden>+ <h5 data-i18n="man.zooms">Zoom</h5>+ <ul class="ed-fxlist" id="edManZooms"></ul>+ <h5 data-i18n="man.gfx">Đồ hoạ</h5>+ <ul class="ed-fxlist" id="edManGfx"></ul>+ </div>+ <div role="tabpanel" id="edMpRev" aria-labelledby="edMtRev" class="ed-mpanel" hidden>+ <form id="edReviseForm" class="ed-revf">+ <label class="sr" for="edReviseText" data-i18n="ed.reviseLabel">Lời sửa</label>+ <input class="ed-in" id="edReviseText" type="text" maxlength="1000" placeholder="bỏ 3 giây đầu…" data-i18n-placeholder="ed.revisePhS" autocomplete="off" />+ <button type="submit" id="edReviseBtn" data-i18n="ed.reviseBtn">Render lại</button>+ </form>+ <div class="ed-presets" id="edPresets"><button type="button" data-i18n="ed.p1">bỏ 3 giây đầu</button><button type="button" data-i18n="ed.p2">zoom ít lại</button><button type="button" data-i18n="ed.p3">nhạc nhỏ lại</button></div>+ <div class="ed-hist" id="edHist" hidden><h5 data-i18n="ed.histH">Các lần sửa</h5><ol id="edHistList"></ol></div>+ </div>+ <div class="errmsg" id="edManErr" role="alert"></div>+ <div class="ed-mbar" id="edManBar" hidden>+ <span class="ed-mdirty" id="edManDirty" aria-live="polite"></span>+ <button type="button" class="ed-mreset" id="edManReset" data-i18n="man.reset">Bỏ thay đổi</button>+ <button type="button" class="ed-mapply" id="edManApply" data-i18n="man.apply">Áp dụng</button>+ </div>+ </section></div></div><h2 data-i18n="ed.listH">Các bản đã dựng</h2>