sakrecoer-mother-web/_layouts/music.html
2019-04-28 19:26:34 +02:00

70 lines
2.4 KiB
HTML

---
layout: default
---
<div id="navigation">
<button id="mu_pause">Pause / Play</button>
<h1>{% if page.previous_in_category != nil %}
<a href="{{ base }}{{ page.previous_in_category.url }}" title="Previous Track"><img
src="{{ base }}/assets/img/icons/skiprwd.png" title="Previous Track" /></a>
{% endif %}
<a id="download" title="Download This Track!" href="{{ site.audio_url }}{{ page.mp3 }}"><img
src="{{ base }}/assets/img/icons/dl.png" title="Download Track" /></a>
{% if page.next_in_category != nil %}
<a href="{{ base }}{{ page.next_in_category.url }}" title="Next Track"><img
src="{{ base }}/assets/img/icons/skipfwd.png" title="Next Track" /></a>{% endif %}
</h1>
<a href="{{ base }}/music/index.html">Back to Index</a>
</div>
<div id="lyrics">
<h1 class="title">{{ page.title }}</h1>
{{ page.content }}
</div>
<audio preload="true"
ontimeupdate="document.getElementById('tracktime').innerHTML = Math.floor(this.currentTime) + ' / ' + Math.floor(this.duration);">
<source src="{{ site.audio_url }}{{ page.mp3 }}" type="audio/mpeg" />
<source src="{{ site.audio_url }}{{ page.ogg }}" type="audio/ogg" />
<h1>Your browser isn't ready for so much hotness. Use the download-link instead.</h1>.
</audio>
<div id="tracktime"></div>
<!-- stylemachine by Sakrecoer -snipthis if ya feel it - its the pary that runs the player ;) -->
<script type="text/javascript">
function loadUrl(newLocation) {
window.location = newLocation;
return false;
}
var mu = document.getElementsByTagName("audio")[0];
var pauseButton = document.getElementById("mu_pause");
function muFade() {
mu.classList.add("stopfade");
}
mu.addEventListener('ended', function () {
// only functional if "loop" is removed
mu.pause();
mu.currentTime = 0;
{% if page.next_in_category != nil %}
loadUrl('{{ base }}{{ page.next_in_category.url }}'); return false;
{% endif %}
// qq IE10
muFade();
});
pauseButton.addEventListener("click", function () {
mu.classList.toggle("stopfade");
if (mu.paused) {
mu.play();
pauseButton.innerHTML = "Pause<br />Music";
} else {
mu.pause();
pauseButton.innerHTML = "Resume<br />Music";
}
});
</script>
<style type="text/css">
html,
body {
background:url('{{ site.audio_url }}{{ page.bgimg }}') #0ff no-repeat center center fixed;
background-size: contain;
}
</style>