1
1
mirror of https://github.com/go-gitea/gitea.git synced 2025-01-23 22:01:03 +01:00
gitea/web_src/js/markup/asciicast.ts
silverwind c7f4ca2653
Enable Typescript noImplicitAny (#33322)
Enable `noImplicitAny` and fix all issues.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-22 15:11:51 +08:00

19 lines
739 B
TypeScript

export async function renderAsciicast() {
const els = document.querySelectorAll('.asciinema-player-container');
if (!els.length) return;
const [player] = await Promise.all([
// @ts-expect-error: module exports no types
import(/* webpackChunkName: "asciinema-player" */'asciinema-player'),
import(/* webpackChunkName: "asciinema-player" */'asciinema-player/dist/bundle/asciinema-player.css'),
]);
for (const el of els) {
player.create(el.getAttribute('data-asciinema-player-src'), el, {
// poster (a preview frame) to display until the playback is started.
// Set it to 1 hour (also means the end if the video is shorter) to make the preview frame show more.
poster: 'npt:1:0:0',
});
}
}