mirror of
https://github.com/Radiquum/radiquum.github.io.git
synced 2025-05-08 05:49:34 +05:00
Initial Commit: Add 1st screen
This commit is contained in:
commit
f94a1bb008
18 changed files with 2787 additions and 0 deletions
23
static/script.js
Normal file
23
static/script.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
function updatePlayingTrack() {
|
||||
const trackName = document.getElementById("track-name");
|
||||
|
||||
fetch("https://lastfm-last-played.biancarosa.com.br/radiquum/latest-song")
|
||||
.then((res) => {
|
||||
if (!res.ok) {
|
||||
throw new Error("Error Fetching Data");
|
||||
}
|
||||
return res.json();
|
||||
})
|
||||
.then((data) => {
|
||||
trackName.innerHTML = `"${data.track.artist['#text']} - ${data.track.name}"`;
|
||||
})
|
||||
.catch((err) => {
|
||||
trackName.innerHTML = "\"ERROR: last.fm is not reachable\"";
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
updatePlayingTrack();
|
||||
setInterval(updatePlayingTrack, 360000);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue