This commit is contained in:
loikein 2023-04-18 23:50:58 +01:00
parent 8049030489
commit 2ba3e7fb75
2 changed files with 15 additions and 9 deletions

View file

@ -409,18 +409,22 @@ label.marginnote-ind {
display: none; display: none;
} }
iframe.video { .video-container {
width: 55%; width: 100%;
margin-top: 1.4em; margin-top: 1.4rem;
margin-bottom: 1.4em; margin-bottom: 1.4rem;
} }
iframe.video--16x9 { .video {
aspect-ratio: 16/9; width: 55%;
} }
iframe.video--4x3 { .video--16x9 {
aspect-ratio: 4/3; aspect-ratio: 16/9;
}
.video--4x3 {
aspect-ratio: 4/3;
} }
@media (max-width: 760px) { @media (max-width: 760px) {
@ -469,7 +473,7 @@ iframe.video--4x3 {
img { img {
width: 100%; width: 100%;
} }
iframe.video { .video {
width: 90%; width: 90%;
} }
} }

View file

@ -2,6 +2,8 @@
{{ $4x3 := .Get "4x3" | default "false" }} {{ $4x3 := .Get "4x3" | default "false" }}
{{ $title := .Get "title" | default "YouTube Video" }} {{ $title := .Get "title" | default "YouTube Video" }}
<div class="video-container">
<iframe <iframe
class="video {{ with $4x3 }}{{ if eq . "true" }}video--4x3{{ else }}video--16x9{{ end }}{{ end }}" class="video {{ with $4x3 }}{{ if eq . "true" }}video--4x3{{ else }}video--16x9{{ end }}{{ end }}"
src="https://www.youtube-nocookie.com/embed/{{ $id }}?cc_load_policy=1&cc=1{{ with .Get "start" }}&start={{ . }}{{ end }}{{ with .Get "end" }}&end={{ . }}{{ end }}" allowfullscreen title="{{ $title }}" frameborder="0" sandbox="allow-same-origin allow-scripts" loading="lazy"></iframe> src="https://www.youtube-nocookie.com/embed/{{ $id }}?cc_load_policy=1&cc=1{{ with .Get "start" }}&start={{ . }}{{ end }}{{ with .Get "end" }}&end={{ . }}{{ end }}" allowfullscreen title="{{ $title }}" frameborder="0" sandbox="allow-same-origin allow-scripts" loading="lazy"></iframe>
</div>