Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Collapse the library back label when the header runs out of space

Bowen Xuedd7811f0bd0f
diff --git a/web/library.css b/web/library.css
index cd8a009..bebe158 100644
--- a/web/library.css
+++ b/web/library.css
@@ -1,6 +1,9 @@
.fv-studio.fv-library{width:calc(100vw - 32px);height:calc(100dvh - 32px);overflow:hidden}
.fv-library .fv-library-header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px;padding:18px 22px;border-bottom:1px solid var(--fv-border)}
-.fv-library-header h2{font-size:var(--fv-strong);font-weight:var(--fv-semibold);margin:0}.fv-library-header>button:first-child{justify-self:start}.fv-library-header>button:last-child{justify-self:end}
+.fv-library-header h2{font-size:var(--fv-strong);font-weight:var(--fv-semibold);margin:0;white-space:nowrap}.fv-library-header>button:first-child{justify-self:start}.fv-library-header>button:last-child{justify-self:end}
+.fv-library-back-label{white-space:nowrap}.fv-library-back>.fv-icon{display:none}
+.fv-library-header[data-compact=true] .fv-library-back-label{display:none}
+.fv-library-header[data-compact=true] .fv-library-back>.fv-icon{display:inline-flex}
.fv-library-body{height:calc(100% - 75px);display:grid;grid-template-columns:320px minmax(0,1fr);min-height:0}
.fv-library-collection{overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:18px;border-right:1px solid var(--fv-border);text-align:center}
.fv-library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 10px}
diff --git a/web/library.js b/web/library.js
index 59fedee..2cae758 100644
--- a/web/library.js
+++ b/web/library.js
@@ -1,6 +1,6 @@
import { api } from '../../scripts/api.js';
import { closeDialog } from './motion.js';
-import { resultActions, previewBadge } from './result_actions.js';
+import { resultActions, previewBadge, icon } from './result_actions.js';
import { videoUnavailableText } from './studio_extend.js';
import { topDialog } from './dialog_keys.js';
@@ -167,12 +167,21 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nu
dialog.setAttribute('aria-label', t('Your creations', '我的作品'));
const header = el('header', null, 'fv-library-header');
// Closing returns to the view this was opened from; that view names itself on the button.
- const back = button(backLabel || t('Back to create', '返回创作'), () => closeDialog(dialog), 'fv-quiet');
+ const backText = backLabel || t('Back to create', '返回创作');
+ const back = button('', () => closeDialog(dialog), 'fv-quiet fv-library-back');
+ back.setAttribute('aria-label', backText); back.title = backText;
+ back.append(icon('back'), el('span', backText, 'fv-library-back-label'));
const title = el('h2', t('Your creations', '我的作品'));
const refresh = button(t('Refresh', '刷新'), () => load(false), 'fv-quiet');
const choose = button(t('Select', '选择'), () => setSelecting(!selecting), 'fv-quiet fv-library-choose');
const tools = el('div', null, 'fv-library-tools'); tools.append(choose, refresh);
header.append(back, title, tools);
+ // Try the full label on each resize, so wider windows restore it too.
+ const headerObserver = new ResizeObserver(() => {
+ header.dataset.compact = 'false';
+ header.dataset.compact = String(title.scrollWidth > title.clientWidth || header.scrollWidth > header.clientWidth);
+ });
+ headerObserver.observe(header); headerObserver.observe(tools);
const body = el('div', null, 'fv-library-body');
const collection = el('section', null, 'fv-library-collection'); collection.setAttribute('aria-label', t('Saved videos', '已保存的视频'));
const grid = el('div', null, 'fv-library-grid');
@@ -668,6 +677,7 @@ export function openLibrary(t, {upscale = null, selectedWork = null, extend = nu
window.addEventListener('freevideo-result', completed);
dialog.addEventListener('cancel', event => { event.preventDefault(); if (selecting && !deleting) setSelecting(false); else closeDialog(dialog); });
dialog.onclose = () => {
+ headerObserver.disconnect();
disposed = true; abort.abort(); thumbnails.disconnect(); releasePlayer(); clearTimeout(undoTimer); clearTimeout(sizeTimer); clearTimeout(syncTimer);
window.removeEventListener('freevideo-result', completed); window.removeEventListener('storage', undoChanged); window.removeEventListener('freevideo-library-undo', showUndo); window.removeEventListener('freevideo-library-deleted', deletedElsewhere); dialog.remove();
if (opened === dialog) opened = null;
diff --git a/web/result_actions.js b/web/result_actions.js
index 2ec5967..735d131 100644
--- a/web/result_actions.js
+++ b/web/result_actions.js
@@ -7,6 +7,7 @@ const css = document.createElement('link');
css.rel = 'stylesheet'; css.href = new URL('./result_actions.css', import.meta.url).href; document.head.append(css);
const ICONS = {
+ back: '<path d="M13 8H3m0 0 4-4M3 8l4 4"/>',
sidebar: '<rect x="2" y="2.5" width="12" height="11" rx="1.5"/><path d="M9.5 2.5v11"/>',
download: '<path d="M8 2.5v7.5m0 0 3-3m-3 3-3-3M3 11.5v1a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-1"/>',
share: '<path d="M8 10V2.5m0 0L5.2 5.3M8 2.5l2.8 2.8M4.5 7.5H4a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-.5"/>',