gitea源码

123456789101112131415161718
  1. import {queryElems} from '../utils/dom.ts';
  2. export async function initMarkupRenderAsciicast(elMarkup: HTMLElement): Promise<void> {
  3. queryElems(elMarkup, '.asciinema-player-container', async (el) => {
  4. const [player] = await Promise.all([
  5. // @ts-expect-error: module exports no types
  6. import(/* webpackChunkName: "asciinema-player" */'asciinema-player'),
  7. import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'),
  8. ]);
  9. player.create(el.getAttribute('data-asciinema-player-src'), el, {
  10. // poster (a preview frame) to display until the playback is started.
  11. // Set it to 1 hour (also means the end if the video is shorter) to make the preview frame show more.
  12. poster: 'npt:1:0:0',
  13. });
  14. });
  15. }