2024-05-16 13:08:24 +00:00
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
|
|
|
def define_env(env: Any) -> None:
|
2024-05-16 17:32:05 +00:00
|
|
|
static_dir = "/static/"
|
2024-05-16 13:08:24 +00:00
|
|
|
video_dir = "https://clan.lol/" + "videos/"
|
|
|
|
asciinema_dir = static_dir + "asciinema-player/"
|
|
|
|
|
|
|
|
@env.macro
|
|
|
|
def video(name: str) -> str:
|
|
|
|
return f"""<video loop muted autoplay id="{name}">
|
|
|
|
<source src={video_dir + name} type="video/webm">
|
|
|
|
Your browser does not support the video tag.
|
|
|
|
</video>"""
|
|
|
|
|
|
|
|
@env.macro
|
|
|
|
def asciinema(name: str) -> str:
|
2024-05-16 17:32:05 +00:00
|
|
|
return f"""<div id="{name}">
|
2024-05-16 13:08:24 +00:00
|
|
|
<script src="{asciinema_dir}/asciinema-player.min.js"></script>
|
|
|
|
<script>
|
|
|
|
AsciinemaPlayer.create('{video_dir + name}',
|
|
|
|
document.getElementById("{name}"), {{
|
|
|
|
loop: true,
|
|
|
|
autoPlay: true,
|
|
|
|
controls: false,
|
|
|
|
speed: 1.5,
|
2024-05-17 14:07:09 +00:00
|
|
|
theme: "solarized-light"
|
2024-05-16 13:08:24 +00:00
|
|
|
}});
|
2024-05-16 17:32:05 +00:00
|
|
|
</script>
|
|
|
|
</div>"""
|