2024-05-01 18:33:30 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css" integrity="sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A==" crossorigin="anonymous">
|
|
|
|
<title>MusicThread Test</title>
|
|
|
|
<script>
|
|
|
|
// retrieves latest link from a musicthread thread and displays it on the page
|
2024-05-02 02:15:51 +00:00
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
2024-05-02 02:40:25 +00:00
|
|
|
const musicthread = "https://musicthread.app/api/v0/thread/2aVjZUocjk96LELFbV5JvJjm14v";
|
2024-05-02 02:15:51 +00:00
|
|
|
const nowPlayingElement = document.getElementById("now-playing");
|
|
|
|
if (nowPlayingElement) {
|
|
|
|
fetch(musicthread)
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(function(res){
|
|
|
|
let nowPlaying = res;
|
|
|
|
nowPlayingElement.innerHTML = "<a href='" + nowPlaying.page_url + "'>" + nowPlaying.title + "</a> by " + nowPlaying.artist;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2024-05-01 18:33:30 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Now Playing</h1>
|
|
|
|
<ul>
|
2024-05-02 02:15:51 +00:00
|
|
|
<li><span id="now-playing"></span> <i class='fa-solid fa-headphones'></i></li>
|
2024-05-01 18:33:30 +00:00
|
|
|
</ul>
|
|
|
|
</body>
|
|
|
|
</html>
|