105 lines
3.7 KiB
HTML
105 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|
<!--
|
|
Author: W175B/TechRunner
|
|
Created: October 6th, 2025
|
|
-->
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="/stylesheets/base.css">
|
|
<link rel="stylesheet" href="/stylesheets/jukebox.css">
|
|
<title>Jukebox</title>
|
|
<style>
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Welcome to my Jukebox!</h1>
|
|
<h2></h2>
|
|
<div class="jukeBox">
|
|
<div class="songSelector">
|
|
<div class="songList">
|
|
<ol id="songList">
|
|
|
|
</ol>
|
|
</div>
|
|
<div class="songChanger">
|
|
<input onclick="jukebox.prev()" type="button" value="prev" class="jukeboxButton" id="prevSong">
|
|
<input onclick="jukebox.next()"type="button" value="next" class="jukeboxButton" id="nextSong">
|
|
</div>
|
|
</div>
|
|
<div class="playing">
|
|
<h5 class="playing">Currently Playing:</h5>
|
|
<p id="currentlyPlaying"></p>
|
|
</div>
|
|
<audio controls src="" id="audioPlayer"></audio>
|
|
</div>
|
|
<script>
|
|
|
|
let jukebox = {
|
|
current: document.getElementById("currentlyPlaying"),
|
|
audioPlayer: document.getElementById("audioPlayer"),
|
|
prevBtn: document.getElementById("prevSong"),
|
|
nextBtn: document.getElementById("nextSong"),
|
|
selected: 0,
|
|
songlist: [
|
|
{
|
|
title: "Begging to Bleed",
|
|
path: "/media/music/01 - Begging To Bleed.mp3",
|
|
},
|
|
{
|
|
title: "Better off dead",
|
|
path: "/media/music/02 - Better Off Dead.mp3"
|
|
},
|
|
{
|
|
title: "Eye for an eye",
|
|
path: "/media/music/03 - Eye For An Eye.mp3"
|
|
},
|
|
{
|
|
title: "Pink Bubblegum",
|
|
path: "/media/music/Pink_Bubblegum.mp3"
|
|
}
|
|
],
|
|
next: (self = this) => {
|
|
if (jukebox.selected >= jukebox.songlist.length-1){
|
|
jukebox.selected = 0;
|
|
}else{
|
|
jukebox.selected += 1;
|
|
}
|
|
jukebox.current.textContent = jukebox.songlist[jukebox.selected].title;
|
|
jukebox.audioPlayer.src = jukebox.songlist[jukebox.selected].path;
|
|
if (jukebox.audioPlayer.allowedToPlay){
|
|
jukebox.audioPlayer.play();
|
|
}
|
|
},
|
|
prev: (self) => {
|
|
if (jukebox.selected-1 < 0){
|
|
jukebox.selected = jukebox.songlist.length - 1;
|
|
} else {
|
|
jukebox.selected -= 1;
|
|
}
|
|
jukebox.current.textContent = jukebox.songlist[jukebox.selected].title;
|
|
jukebox.audioPlayer.src = jukebox.songlist[jukebox.selected].path;
|
|
if (jukebox.audioPlayer.allowedToPlay){
|
|
jukebox.audioPlayer.play();
|
|
}
|
|
|
|
},
|
|
init: () => {
|
|
let songList = document.getElementById("songList");
|
|
for(let i = 0; i < jukebox.songlist.length; i++){
|
|
songList.append(Object.assign(document.createElement("li"),{textContent: jukebox.songlist[i].title}));
|
|
}
|
|
jukebox.current.textContent = jukebox.songlist[0].title;
|
|
jukebox.audioPlayer.src = jukebox.songlist[0].path;
|
|
}
|
|
}
|
|
|
|
jukebox.init();
|
|
|
|
|
|
</script>
|
|
</body>
|
|
</html> |