selfprivacy.org/_vendor/github.com/google/docsy/layouts/shortcodes/iframe.html
2024-04-22 02:04:16 +03:00

21 lines
1.2 KiB
HTML

{{ $src := .Get "src" | }}
{{ $width := .Get "width" | default "100%" }}
{{ $tryautoheight := .Get "tryautoheight" | default true }}
{{ $style := .Get "style" | default "min-height:98vh; border:none;" }}
{{ $sandbox := .Get "sandbox" | default false }}
{{ $name := .Get "name" | default "iframe-name" }}
{{ $id := .Get "id" | default "iframe-id" }}
{{ $class := .Get "class" }}
{{ $sub := .Get "sub" | default "Your browser can not display embedded frames. You can access the embedded page via the following link:" }}
{{ with $src }}
{{ if $tryautoheight }}
<script type="text/javascript">
function resizeIframe(iframe) {
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
</script>
{{ end }}
<iframe id="{{ $id }}"{{ with $class }} class="{{ $class }}"{{ end }} src="{{ $src }}" width="{{ $width }}" name="{{ $name }}"{{ with $style }} style="{{ $style | safeCSS }}"{{ end }}{{ if $tryautoheight }} onload="resizeIframe(this)"{{ end }} referrerpolicy="no-referrer"{{ if (eq $sandbox false)}}{{ else if (eq $sandbox true) }} sandbox{{ else }} sandbox="{{ $sandbox }}"{{ end }}>
<p>{{ $sub }} <a href="{{ $src }}">{{ $src }}</a></p>
</iframe>
{{ end }}