play single contribution

main
km0 2 years ago
parent f4f2e01a30
commit ae9f20acce

@ -50,6 +50,31 @@ function createSection(contribution) {
section.querySelector(".author").innerHTML = contribution.author; section.querySelector(".author").innerHTML = contribution.author;
section.querySelector(".description").innerHTML = contribution.description; section.querySelector(".description").innerHTML = contribution.description;
section.querySelector(".content").innerHTML = contribution.content_html; section.querySelector(".content").innerHTML = contribution.content_html;
if ((contribution.audio && contribution.audio.length == 1) || contribution.original) {
let audio = new Audio(
`https://hub.xpub.nl/soupboat/SI18/03/${contribution.folder}/${
contribution.original || contribution.audio[0]
}`
);
audio.addEventListener("canplaythrough", (event) => {
/* the audio is now playable; play it if permissions allow */
section.querySelector(".filename").innerHTML = `${~~(audio.duration / 60)}:${~~(
audio.duration % 60
)}`;
let player = section.querySelector(".player");
player.innerHTML = "Play";
player.addEventListener("click", () => {
if (audio.paused) {
audio.play();
player.innerHTML = "Pause";
} else {
audio.pause();
player.innerHTML = "Play";
}
});
});
} else section.querySelector(".audio").remove();
return section; return section;
} }

@ -317,7 +317,7 @@
</div> </div>
<!-- --------------------- --> <!-- --------------------- -->
</div> </div>
<div class="libretto" contenteditable="true"> <div class="libretto">
<header class="cover"> <header class="cover">
<div class="release"> <div class="release">
10.05.2022 <br /> 10.05.2022 <br />
@ -367,6 +367,10 @@
</div> </div>
<h2 class="title">Overture Atlas</h2> <h2 class="title">Overture Atlas</h2>
<div class="description">description</div> <div class="description">description</div>
<div class="audio">
<button class="player">Loading</button>
<span class="filename"></span>
</div>
<div class="content"></div> <div class="content"></div>
</section> </section>
</div> </div>

@ -12,16 +12,15 @@
:root { :root {
--text: #111; --text: #111;
--wireframe: #111; --wireframe: #111;
--background:#FF6347; --background: #ff6347;
} }
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
body,
html {
body, html{
margin: 0; margin: 0;
padding: 0; padding: 0;
background-color: var(--background); background-color: var(--background);
@ -30,6 +29,7 @@ body, html{
font-size: 21px; font-size: 21px;
line-height: 1.6; line-height: 1.6;
overflow: hidden;
} }
.container { .container {
@ -52,8 +52,6 @@ body, html{
border-right: solid 1px var(--wireframe); border-right: solid 1px var(--wireframe);
} }
.info { .info {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -68,16 +66,18 @@ body, html{
scroll-behavior: smooth; scroll-behavior: smooth;
} }
.libretto > * { .libretto > * {
border-bottom: solid 1px var(--wireframe); border-bottom: solid 1px var(--wireframe);
} }
.contribution:last-of-type {
border-bottom: none;
}
.atlas svg { .atlas svg {
padding: 32px; padding: 32px;
width: 100%; width: 100%;
overflow: visible; overflow: visible;
} }
.atlas svg #live-path { .atlas svg #live-path {
@ -93,13 +93,11 @@ body, html{
} }
} }
path[data-link] { path[data-link] {
pointer-events: all; pointer-events: all;
pointer-events: bounding-box; pointer-events: bounding-box;
} }
.moment { .moment {
text-transform: uppercase; text-transform: uppercase;
} }
@ -121,7 +119,6 @@ path[data-link]{
.cover .title { .cover .title {
font-size: 64px; font-size: 64px;
margin: 64px 0; margin: 64px 0;
} }
.cover .description { .cover .description {
@ -146,12 +143,10 @@ dd {
display: none; display: none;
} }
#reference { #reference {
display: none; display: none;
} }
.contribution { .contribution {
padding: 16px; padding: 16px;
padding-bottom: 64px; padding-bottom: 64px;
@ -170,14 +165,27 @@ dd {
text-transform: uppercase; text-transform: uppercase;
} }
ul, ol { .contribution .audio {
margin-bottom: 32px;
}
.contribution .player {
border: 1px solid currentColor;
outline: none;
background: none;
padding: 4px 8px;
cursor: pointer;
}
ul,
ol {
margin: 16px 0; margin: 16px 0;
} }
.contribution .description { .contribution .description {
font-style: italic; font-style: italic;
padding-bottom: 32px; padding-bottom: 8px;
} }
.contribution .content h3, .contribution .content h3,
@ -196,7 +204,6 @@ ul, ol {
object-fit: contain; object-fit: contain;
} }
.content { .content {
white-space: pre-line; white-space: pre-line;
} }
@ -230,14 +237,12 @@ a{
position: relative; position: relative;
color: currentColor; color: currentColor;
pointer-events: all; pointer-events: all;
} }
a:hover { a:hover {
color: white; color: white;
} }
@namespace svg url(http://www.w3.org/2000/svg); @namespace svg url(http://www.w3.org/2000/svg);
/* Necessary to select only SVG <a> elements, and not also HTML's. /* Necessary to select only SVG <a> elements, and not also HTML's.
See warning below */ See warning below */

Loading…
Cancel
Save