diff options
author | Jimmy Cai <jimmehcai@gmail.com> | 2021-03-07 14:51:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 14:51:47 +0300 |
commit | d5268a41e0629efe728524d5f0a14564359ff279 (patch) | |
tree | 7e0f9a2fb77c108e5a3f3e4b26f24991a0a9f7c1 /layouts | |
parent | 38eb9c4eaf513c278ca991c7f0e9e65f6d11890e (diff) |
refactor(article): add default padding (#166)
* refactor(article): add default padding
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/165
* fix(article): video iframe margin
* fix: remove youtube iframe border
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/shortcodes/bilibili.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/tencent.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/youtube.html | 10 |
3 files changed, 11 insertions, 8 deletions
diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html index 3c563dc..602406c 100644 --- a/layouts/shortcodes/bilibili.html +++ b/layouts/shortcodes/bilibili.html @@ -12,13 +12,12 @@ <p>当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}</p>
{{ end }}
-<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
+<div class="video-wrapper">
<iframe src="//player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
- style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"
>
</iframe>
</div>
diff --git a/layouts/shortcodes/tencent.html b/layouts/shortcodes/tencent.html index 09f9e8b..baf5f3c 100644 --- a/layouts/shortcodes/tencent.html +++ b/layouts/shortcodes/tencent.html @@ -1,10 +1,10 @@ {{ $vid := .Get 0 }}
-<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
+<div class="video-wrapper">
<iframe src="http://v.qq.com/txp/iframe/player.html?vid={{ $vid }}&auto=0"
scrolling="no"
frameborder="no"
framespacing="0"
- allowfullscreen="true"
- style="position: absolute; width: 100%; height: 100%;">
+ allowfullscreen="true"
+ >
</iframe>
</div>
\ No newline at end of file diff --git a/layouts/shortcodes/youtube.html b/layouts/shortcodes/youtube.html index 5dd94e6..2f85931 100644 --- a/layouts/shortcodes/youtube.html +++ b/layouts/shortcodes/youtube.html @@ -2,8 +2,12 @@ {{- if not $pc.Disable -}} {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} {{- $id := .Get "id" | default (.Get 0) -}} -{{- $class := .Get "class" | default (.Get 1) }} -<div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> - <iframe loading="lazy" src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="YouTube Video"></iframe> +<div class="video-wrapper"> + <iframe loading="lazy" + src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" + allowfullscreen + title="YouTube Video" + > + </iframe> </div> {{ end -}}
\ No newline at end of file |