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.

Keep tour cards closed while a how-to opens the Edit view

Bowen Xuead2a3d05fa05
diff --git a/web/feature_tour.js b/web/feature_tour.js
index 7f21c98..b54fcec 100644
--- a/web/feature_tour.js
+++ b/web/feature_tour.js
@@ -68,6 +68,8 @@ function styles() {
const css = el('link'); css.rel = 'stylesheet'; css.setAttribute(`data-fv-tour-${name}`, ''); css.href = new URL(`./${name}.css`, import.meta.url).href; document.head.append(css);
}
}
+// The guide, its next-step hint and a how-to that is still opening its view all keep automatic tour cards closed.
+const GUIDE_ON_SCREEN = '.fv-guide-layer,.fv-first-start,.fv-next-step,body[data-fv-how-to]';
export async function openFeatureTour({api = contextFor()?.api, cn = contextFor()?.cn, cards = readyCards(), start, grid = false, trigger = null, version, owner = contextFor()?.dialog, isBusy = contextFor()?.isBusy} = {}) {
if (!api || opening || active) return false;
opening = true;
@@ -82,7 +84,7 @@ export async function openFeatureTour({api = contextFor()?.api, cn = contextFor(
if (grid) cards = [...cards].sort((a, b) => Number(record.record?.seen.includes(tourKey(a))) - Number(record.record?.seen.includes(tourKey(b))));
loaded = (await Promise.all(cards.map(c => loadTourCard(c)))).filter(Boolean);
if (!loaded.length || (owner && (!owner.open || !owner.isConnected || [...document.querySelectorAll('dialog[open]')].at(-1) !== owner))
- || ((trigger || version) && (isBusy?.() || document.querySelector('.fv-guide-layer,.fv-first-start,.fv-next-step')))) { release(loaded); return false; }
+ || ((trigger || version) && (isBusy?.() || document.querySelector(GUIDE_ON_SCREEN)))) { release(loaded); return false; }
styles();
const lang = cn ? 'zh' : 'en', text = TOUR_TEXT[lang];
const dialog = el('dialog', 'fv-feature-tour'); dialog.lang = cn ? 'zh-CN' : 'en';
@@ -191,7 +193,7 @@ export async function openFeatureTour({api = contextFor()?.api, cn = contextFor(
}
export async function triggerFeatureTour(trigger, options = {}) {
const context = {...contextFor(), ...options};
- if (!context.api || context.isBusy?.() || document.querySelector('.fv-guide-layer,.fv-first-start,.fv-next-step')) return false;
+ if (!context.api || context.isBusy?.() || document.querySelector(GUIDE_ON_SCREEN)) return false;
return openFeatureTour({...context, owner: context.owner || document.querySelector('dialog.fv-editor[open]') || context.dialog, trigger});
}
export async function offerVersionTour(context) {
diff --git a/web/howto.js b/web/howto.js
index 86c2e98..72e1679 100644
--- a/web/howto.js
+++ b/web/howto.js
@@ -71,12 +71,17 @@ const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
// Plays one how-to. The editor ones open the Edit view first; the others open the creation panel.
export async function startHowTo(id, {openWorkspace = async () => (await import('./view_navigation.js')).openCreativeWorkspace()} = {}) {
const howTo = HOWTOS.find(item => item.id === id);
- if (!howTo || !await howToAvailable(id) || !await openWorkspace()) return false;
- if (howTo.view === 'editor') {
- document.querySelector('dialog.fv-studio [data-view="editor"]')?.click();
- for (let i = 0; i < 40 && !document.querySelector('dialog.fv-editor[open]'); i++) await wait(100);
- }
- await document.fonts.ready;
- await wait(250);
- return showHowTo(howTo.steps);
+ if (!howTo || !await howToAvailable(id)) return false;
+ // Tour cards stay closed while a how-to opens its view, as they do over the guide layer.
+ document.body.dataset.fvHowTo = 'opening';
+ try {
+ if (!await openWorkspace()) return false;
+ if (howTo.view === 'editor') {
+ document.querySelector('dialog.fv-studio [data-view="editor"]')?.click();
+ for (let i = 0; i < 40 && !document.querySelector('dialog.fv-editor[open]'); i++) await wait(100);
+ }
+ await document.fonts.ready;
+ await wait(250);
+ return await showHowTo(howTo.steps);
+ } finally { delete document.body.dataset.fvHowTo; }
}