// «Fotogrammi…» from the selection bar of the Libreria (spec §4.10, tappa E3; composed from the dialogs of mockup 13 and // the choices of mockup 09): @marta.demo, «Seleziona», four tiles of videos and four of photos, then the dialog with // the time field only (there is no single video) and the summary that says the photos are skipped. Nothing starts. const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const until = async (test, tries = 100) => { for (let i = 0; i < tries && !test(); i++) await sleep(100); return test(); }; const tiles = () => [...document.querySelectorAll('.mosaico .tess[data-id]')]; const isVideo = (tile) => Boolean(tile.querySelector('use[href="#i-play"]')); await until(() => tiles().filter(isVideo).length >= 4 && tiles().length >= 8); [...document.querySelectorAll('.strumenti .btn')].find((b) => b.textContent.includes('Seleziona')).click(); await sleep(300); const chosen = [...tiles().filter(isVideo).slice(0, 4), ...tiles().filter((x) => !isVideo(x)).slice(0, 4)]; for (const tile of chosen) { tile.click(); await sleep(60); } const frames = () => document.querySelector('.salva .fotogrammi-selezione'); await until(() => frames() && !frames().disabled); frames().click(); const dialog = () => document.querySelector('.dialogo.fotogrammi'); await until(() => dialog()?.querySelector('.riepilogo-fotogrammi .riepilogo-copia')); await sleep(500); document.activeElement?.blur(); return dialog().querySelector('.riepilogo-fotogrammi').textContent;