diff --git a/assets/scss/_stream.scss b/assets/scss/_stream.scss new file mode 100644 index 0000000..d2dc9e1 --- /dev/null +++ b/assets/scss/_stream.scss @@ -0,0 +1,43 @@ +// The following rules are styling the stream player +// that I'm using on top of live section pages. +// It doesn't belong to the theme, but to my website +// so it is here. + +@use "@picocss/pico/scss/colors/index" as *; + +.stream { + .status-player { + display: flex; + + audio { + border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0; + } + } +} + +// Rules used by the off and on classes below +@mixin status { + display: flex; + border-radius: var(--pico-border-radius) 0 0 var(--pico-border-radius); + flex-grow: 1; + flex-direction: column; + justify-content: space-around; + text-transform: uppercase; + font-weight: bold; + text-align: center; + padding: 0 calc(var(--pico-spacing)/2); + margin: 0; + color: $grey-50; +} + +.off { + @include status; + background-color: $red-500; +} + +.on { + @include status; + background-color: $green-500; +} + +// End of the stream section diff --git a/assets/scss/main.scss b/assets/scss/main.scss index a1b3481..91bd665 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -12,4 +12,5 @@ @use "footer"; @use "lists"; /* Lists, post-infos, posts-lists */ @use "medias"; /* Audio, streams, figures, post-images */ +@use "stream"; /* Specific to the stream player */ @use "texts"; diff --git a/i18n/en.toml b/i18n/en.toml index 2116ee7..e2ec1bd 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,4 +1,6 @@ address = "Address" +announcedLive = "Announce of the next live!" +announce = "Announce!" audioDownload = "Your browser does not support the audio tag, you can access the file directly with" categories = "Categories" contactsPriv = "Personal contacts" diff --git a/i18n/fr.toml b/i18n/fr.toml index 00e040d..a7288d5 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -1,4 +1,6 @@ address = "Adresse" +announcedLive = "Annonce du prochain live !" +announce = "Annonce !" audioDownload = "Ton navigateur ne supporte pas la balise audio, tu peux télécharger le fichier avec" categories = "Catégories " contactsPriv = "Contacts personnels" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a04c2ca..8d6279f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -9,4 +9,9 @@ {{- partial "footer.html" . -}} + + {{ if .Params.local_include }} + + {{ end }} diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 611b812..42b0721 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -11,17 +11,24 @@
{{ range .Pages.ByPublishDate.Reverse }} -
- - {{.Title}} - - {{ partial "lists-footer.html" . }} -
+
+ {{ if .Params.Announce }} + + {{- .Title -}} + {{ i18n "announce" }} + {{ else }} + + {{- .Title -}} + {{ end }} + {{ partial "lists-footer.html" . }} +
+ {{ end }}
{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 933bf2b..15aef03 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -51,4 +51,7 @@ + {{ if .Params.local_include }} + {{ partial "stream.html" }} + {{ end }} diff --git a/layouts/partials/home_post_list.html b/layouts/partials/home_post_list.html index cbc45c5..31f9de1 100644 --- a/layouts/partials/home_post_list.html +++ b/layouts/partials/home_post_list.html @@ -6,9 +6,16 @@ --> {{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }}
- + {{ if .Params.Announce }} + {{- .Title -}} + {{ i18n "announce" }} + {{ else }} + + {{- .Title -}} + {{ end }}
{{ end }} diff --git a/layouts/partials/stream.html b/layouts/partials/stream.html new file mode 100644 index 0000000..7c54f00 --- /dev/null +++ b/layouts/partials/stream.html @@ -0,0 +1,18 @@ +
+
+

+ +
+
+

+ Écouter le flux (s'il est « on »). + Pour utiliser ton propre client : + OGG + MP3 +

+
+
diff --git a/layouts/shortcodes/abbr.html b/layouts/shortcodes/abbr.html new file mode 100644 index 0000000..79fbfde --- /dev/null +++ b/layouts/shortcodes/abbr.html @@ -0,0 +1,4 @@ + + + +{{ .Get "text" }} diff --git a/layouts/shortcodes/blockquote.html b/layouts/shortcodes/blockquote.html new file mode 100644 index 0000000..3ec66f5 --- /dev/null +++ b/layouts/shortcodes/blockquote.html @@ -0,0 +1,80 @@ + + + + + + +{{ $.Scratch.Set "bl_lang" false }} +{{ $.Scratch.Set "bl_author" false }} +{{ $.Scratch.Set "bl_source" false }} +{{ $.Scratch.Set "bl_link" false }} +{{ $.Scratch.Set "bl_title" false }} + +{{ if .IsNamedParams }} + {{ $.Scratch.Set "bl_lang" (.Get "lang") }} + {{ $.Scratch.Set "bl_author" (.Get "author") }} + {{ $.Scratch.Set "bl_source" (.Get "source") }} + {{ $.Scratch.Set "bl_link" (.Get "link") }} + {{ $.Scratch.Set "bl_title" (.Get "title") }} +{{ else }} + +{{ end }} + + + +{{ with $.Scratch.Get "bl_title" }} + +{{ else }} + {{ with $.Scratch.Get "bl_link" }} + {{ range last 1 (split ($.Scratch.Get "bl_link" ) "://") }} + {{ $.Scratch.Set "title_without_protocol" . }} + {{ end }} + {{ range last 1 (split ($.Scratch.Get "title_without_protocol" ) "www.") }} + {{ $.Scratch.Set "title_without_protocol" . }} + {{ end }} + {{ $.Scratch.Set "bl_title" ($.Scratch.Get "title_without_protocol") }} + + + {{ if (gt (len ($.Scratch.Get "title_without_protocol") ) 32) }} + {{ $title := (slicestr ($.Scratch.Get "title_without_protocol") 0 32) }} + {{ $split_by_fw_slash := split $title "/" }} + {{ $count := (sub (len $split_by_fw_slash) 1) }} + + {{ $.Scratch.Set "tempstring" "" }} + {{ range first $count $split_by_fw_slash }} + {{ $.Scratch.Set "tempstring" ( . | printf "%s%s/" ($.Scratch.Get "tempstring") | printf "%s" ) }} + {{ end }} + {{ $.Scratch.Set "bl_title" ( printf "%s..." ($.Scratch.Get "tempstring") | printf "%s" ) }} + {{ end }} + {{ end }} +{{ end }} +
+
+ {{ .Inner | markdownify | safeHTML -}} + {{ with $.Scratch.Get "bl_author" -}} +
+ {{ with $.Scratch.Get "bl_author" -}}{{ . }}{{ end }} + {{ with $.Scratch.Get "bl_source" }} + — {{ . }} + {{ else }} + {{ with $.Scratch.Get "bl_link" }} + — + {{ $.Scratch.Get "bl_title" }} + + {{ else }} + {{ with $.Scratch.Get "bl_title" }} + — + {{ $.Scratch.Get "bl_title" }} + + {{ end }} + {{ end }} + {{ end }} +
+ {{- end -}} +
+
diff --git a/static/js/on_fiber.js b/static/js/on_fiber.js new file mode 100644 index 0000000..ccd5a61 --- /dev/null +++ b/static/js/on_fiber.js @@ -0,0 +1,16 @@ +const url = 'https://id-libre.org/live/status-json.xsl'; +const statusElement = document.getElementById('on'); + +async function status() { + const response = await fetch(url); + const data = await response.json(); + const status = data.icestats.source ? 'on' : 'off' + + statusElement.innerHTML = status; + statusElement.classList.remove("on", "off"); + statusElement.classList.add(status); +} + +status(); + +setInterval(() => status(), 2000);