Skip to content

Commit 745e8ed

Browse files
committed
Add audio shortcode, plus styling
1 parent 353b0d0 commit 745e8ed

File tree

3 files changed

+414
-0
lines changed

3 files changed

+414
-0
lines changed

layouts/shortcodes/audio.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div id="player">
2+
<div class="listen">Listen to this article instead</div>
3+
<div id="waveform">
4+
{{ $waveform := resources.Get "img/waveform.svg" | minify }}
5+
<img src="{{ $waveform.Permalink }}" alt="waveform">
6+
</div>
7+
<audio controls
8+
class="audio_controls {{ .Get "class" }}"
9+
{{ with .Get "id" }}id="{{ . }}"{{ end }}
10+
{{ with .Get "preload" }}preload="{{ . }}"{{ else }}preload="metadata"{{ end }}
11+
12+
style="{{ with .Get "style" }}{{ . | safeCSS }}; {{ end }}"
13+
{{ with .Get "title" }}data-info-title="{{ . }}"{{ end }}
14+
>
15+
{{ if .Get "src" }}
16+
<source {{ with .Get "src" }}src="{{ . }}"{{ end }}
17+
{{ with .Get "type" }}type="audio/{{ . }}"{{ end }}>
18+
{{ else if .Get "backup_src" }}
19+
<source src="{{ .Get "backup_src" }}"
20+
{{ with .Get "backup_type" }}type="audio/{{ . }}"{{ end }}
21+
{{ with .Get "backup_codec" }}codecs="{{ . }}"{{ end }}
22+
>
23+
{{ end }}
24+
Your browser does not support the audio element
25+
</audio>
26+
</div>

static/css/bart.degoe.de.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,23 @@ figcaption h4 {
7777
input[type="search"] {
7878
-webkit-appearance: textfield;
7979
}
80+
81+
#player {
82+
padding: 20px 20px;
83+
margin: 20px 0;
84+
border-radius: 3px;
85+
box-shadow: 0 0 8px 0 #eee;
86+
}
87+
88+
#player .listen {
89+
color: #19BC9C;
90+
margin-bottom: 7px;
91+
}
92+
93+
#player #waveform img {
94+
width: 100%;
95+
}
96+
97+
#player audio {
98+
width: 100%;
99+
}

0 commit comments

Comments
 (0)