code.gitea.io/gitea@v1.21.7/web_src/js/markup/asciicast.js (about)

     1  export async function renderAsciicast() {
     2    const els = document.querySelectorAll('.asciinema-player-container');
     3    if (!els.length) return;
     4  
     5    const [player] = await Promise.all([
     6      import(/* webpackChunkName: "asciinema-player" */'asciinema-player'),
     7      import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'),
     8    ]);
     9  
    10    for (const el of els) {
    11      player.create(el.getAttribute('data-asciinema-player-src'), el, {
    12        // poster (a preview frame) to display until the playback is started.
    13        // Set it to 1 hour (also means the end if the video is shorter) to make the preview frame show more.
    14        poster: 'npt:1:0:0',
    15      });
    16    }
    17  }