Abspielknopf
This commit is contained in:
parent
1d906d4d5f
commit
ec5b29dff3
5 changed files with 57 additions and 11 deletions
4
app.py
4
app.py
|
|
@ -137,7 +137,7 @@ def suche_finden():
|
||||||
json.dump(songs,f,indent=2,ensure_ascii=False)
|
json.dump(songs,f,indent=2,ensure_ascii=False)
|
||||||
return redirect("/suche?liste="+liste,303)
|
return redirect("/suche?liste="+liste,303)
|
||||||
|
|
||||||
@app.route("/rm")
|
@app.route("/remove")
|
||||||
def admin():
|
def admin():
|
||||||
liste = request.args.get("liste")
|
liste = request.args.get("liste")
|
||||||
if liste is None:
|
if liste is None:
|
||||||
|
|
@ -151,7 +151,7 @@ def admin():
|
||||||
gesamtLaenge += song["laenge"]
|
gesamtLaenge += song["laenge"]
|
||||||
return render_template('index.html', karten=songs,gesamtLaenge=gesamtLaenge,liste=liste,admin=True)
|
return render_template('index.html', karten=songs,gesamtLaenge=gesamtLaenge,liste=liste,admin=True)
|
||||||
|
|
||||||
@app.route("/rm",methods=["POST"])
|
@app.route("/remove",methods=["POST"])
|
||||||
def loeschen():
|
def loeschen():
|
||||||
liste = request.args.get("liste")
|
liste = request.args.get("liste")
|
||||||
song = int(request.form.get("index"))
|
song = int(request.form.get("index"))
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,49 @@
|
||||||
const audios = document.querySelectorAll("audio")
|
const audios = document.querySelectorAll("audio")
|
||||||
|
const articles = document.querySelectorAll("article")
|
||||||
|
const signs = document.querySelectorAll(".sing")
|
||||||
|
outindex = 0
|
||||||
|
playing = false
|
||||||
|
playcolor = "#00ff3c"
|
||||||
|
function abspielen(){
|
||||||
|
if(playing){
|
||||||
|
audios[outindex].pause()
|
||||||
|
signs[outindex].innerHTML = ""
|
||||||
|
playing = false
|
||||||
|
articles[outindex].style.margin = "0px"
|
||||||
|
articles[outindex].style.boxShadow = "0 0 0px 0px "+playcolor
|
||||||
|
document.querySelector("button").innerHTML = "Abspielen"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
audios[outindex].play()
|
||||||
|
playing = true
|
||||||
|
signs[outindex].innerHTML = "Spielt"
|
||||||
|
articles[outindex].style.margin = "8px"
|
||||||
|
articles[outindex].style.boxShadow = "0 0 6px 3px "+playcolor
|
||||||
|
document.querySelector("button").innerHTML = "Pausieren"
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const [index,audio] of audios.entries()){
|
for (const [index,audio] of audios.entries()){
|
||||||
audio.addEventListener("ended", (event) => {
|
audio.addEventListener("ended", (event) => {
|
||||||
if (index+1!= audios.length){
|
signs[index].innerHTML = ""
|
||||||
audios[index + 1].play()
|
if (index != audios.length -1){
|
||||||
|
outindex = index +1
|
||||||
|
audios[outindex].play()
|
||||||
|
// Visueles
|
||||||
|
signs[index].innerHTML = ""
|
||||||
|
articles[index].style.filter = "grayscale("+(index+1)*50+"%)"
|
||||||
|
articles[index].style.boxShadow = "0 0 0px 0px "+playcolor
|
||||||
|
articles[outindex].style.margin = "8px"
|
||||||
|
signs[outindex].innerHTML = "Spielt"
|
||||||
|
articles[outindex].style.boxShadow = "0 0 6px 1px "+playcolor
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
signs[index].innerHTML = ""
|
||||||
|
articles[index].style.filter = "grayscale(80%)"
|
||||||
|
articles[index].style.boxShadow = "0 0 0px 0px "+playcolor
|
||||||
|
articles[index].style.margin = "8px"
|
||||||
|
signs[index].innerHTML = "Spielt"
|
||||||
|
articles[index].style.boxShadow = "0 0 6px 1px "+playcolor
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log(audios)
|
console.log(audios)
|
||||||
|
|
@ -44,11 +44,18 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: rgb(181, 181, 181);
|
color: rgb(181, 181, 181);
|
||||||
}
|
}
|
||||||
|
button{
|
||||||
|
padding: 10px;
|
||||||
|
margin: 5px;
|
||||||
|
border: black;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<h1>ESC Playlist</h1>
|
<h1>ESC Playlist</h1>
|
||||||
<h2>2026</h2>
|
<h2>2026</h2>
|
||||||
<a href="/suche?liste={{liste}}">Du willst ein weiteres Lied in der Playlist?</a>
|
<a href="/suche?liste={{liste}}">Du willst ein weiteres Lied in der Playlist?</a>
|
||||||
<p>Die Playlist {{liste}} ist insgesamt lang {{ gesamtLaenge | zeit }} und enthält {{ karten|length }} Lieder</p>
|
<p>Die Playlist {{liste}} ist insgesamt {{ gesamtLaenge | zeit }} lang und enthält {{ karten|length }} Lieder</p>
|
||||||
|
<button onclick="abspielen()">Abspielen</button>
|
||||||
<div id = "flex-container">
|
<div id = "flex-container">
|
||||||
{% for karte in karten %}
|
{% for karte in karten %}
|
||||||
{% set karte_loop = loop %}
|
{% set karte_loop = loop %}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
<article>
|
<article>
|
||||||
|
<p id="{{karte_loop.index0}}" class="sing"></p>
|
||||||
<img src="{{ karte.img }}"/>
|
<img src="{{ karte.img }}"/>
|
||||||
{% if karte.ytid %}
|
{% if karte.ytid %}
|
||||||
<audio controls autoplay src="/static/{{karte.datei}}"></audio>
|
<audio src="/static/{{karte.datei}}"></audio>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>{{ karte.titel}}</h2>
|
<h2>{{ karte.titel}}</h2>
|
||||||
<p><b>Übersetzter Titel:</b>{{ karte.uetitel}}</p>
|
<p><b>Übersetzter Titel:</b>{{ karte.uetitel}}</p>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<style>
|
<style>
|
||||||
form,a{
|
form,a,p{
|
||||||
display: block;
|
display: block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: black;
|
color: black;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue