updated website

This commit is contained in:
Alex Frantz
2022-06-22 20:30:39 -04:00
parent bce362c430
commit f3943205f3
14 changed files with 66 additions and 382 deletions
-12
View File
@@ -1,12 +0,0 @@
const clipSpan = document.getElementById("clip");
fetch("https://developers.medal.tv/v1/latest?userId=215577&limit=1", {
method: "GET",
headers: {
"authorization": "pub_ecEyOlY5G2u9476DMGOxcxiNcaOTEjmq",
"Content-Type": "application/json"
}
}).then(async function(response) {
const data = await response.json();
if(screen.width < 1920) { clipSpan.innerHTML = `<h3><a href="${data.contentObjects[0].directClipUrl}" target="_blank">${data.contentObjects[0].contentTitle}</a></h3>` }
else clipSpan.innerHTML = `${data.contentObjects[0].embedIframeCode}<br><hr><h3>${data.contentObjects[0].contentTitle}</h3>`;
});
-10
View File
@@ -1,10 +0,0 @@
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
const div = document.getElementById("querydiv");
console.log(params)
if (params.reason) {
if (params.reason == "old_domain") {
div.innerHTML = '<p style="color:red;">You have been redirected here from an old domain. Please use this domain.</p>';
}
}
-17
View File
@@ -1,17 +0,0 @@
async function getState() {
const data = await fetch("https://api.thatalex.dev/v0/web/spotify/player/state", {
method: "GET"
}).then(response => response.json())
.catch(async function(response) {
const d = await response.json();
if (response.status == 401 && d.message == "Access Token was invalid. Token was refreshed & next request should succeed.") {
location.reload();
} else if (response.status != 200 || response.status != 204) {
console.log(`Uh oh, a little fucky wucky owo occurred\n\n${d}`)
document.getElementById("songContent").innerHTML = `<p style="color:red;">Uh oh! There was an error fetching song content.<br>The API may be temporarily down.</p>`
}
});
if(data.playing) document.getElementById("songContent").innerHTML = `<p><strong>${data.data.songData.songName}</strong> by <strong>${data.data.songData.artists[0].name}</strong> at <strong>${data.data.device.volume}%</strong> volume.`
else document.getElementById("songContent").innerHTML = `<p><strong>${data.data.songData.songName}</strong> by <strong>${data.data.songData.artists[0].name}</strong> is <strong>paused</strong>.`
}