mobile tweaks

This commit is contained in:
2025-05-02 15:28:06 +01:00
parent 392e788d91
commit e97255897c
10 changed files with 375 additions and 14 deletions

View File

@@ -82,6 +82,11 @@ document.addEventListener('keydown', function(event) {
console.log("owo, whats this?");
document.getElementById('furry').style.display = 'block';
}
if (last5Chars == "irken") {
console.log("doom doom doom!");
document.querySelector(":root").style.setProperty('--font-family', 'Irken');
document.querySelector(":root").style.setProperty('--title-font', '1.5em');
}
while (last5Chars.length >= 5) {
last5Chars = last5Chars.slice(1);
}
@@ -93,6 +98,13 @@ function getSpotify() {
fetch('https://api.alfieking.dev/spotify/nowplaying/xz02oolstlvwxqu1pfcua9exz').then(response => {
return response.json();
}).then(data => {
if (data.item == null) {
document.getElementById('spotify').style.backgroundImage = "none";
document.getElementById('spotify-title').innerHTML = "Spotify is not playing anything";
document.getElementById('spotify-artist').innerHTML = ":(";
document.getElementById('spotify-link').href = "https://open.spotify.com/";
return;
}
document.getElementById('spotify').style.backgroundImage = "url(" + data.item.album.images[0].url + ")";
document.getElementById('spotify-title').innerHTML = data.item.name;
document.getElementById('spotify-artist').innerHTML = data.item.artists[0].name;
@@ -100,5 +112,29 @@ function getSpotify() {
});
}
getSpotify();
setInterval(getSpotify, 15000);
if (document.getElementById('spotify')) {
getSpotify();
setInterval(getSpotify, 15000);
}
// load buttons
function loadButtons() {
fetch('/static/content/buttons.txt').then(response => {
return response.text();
}).then(data => {
container = document.getElementById('button-collection');
for (let line of data.split('\n')) {
if (line == "") {
continue;
}
let img = document.createElement('img');
img.src = line;
container.appendChild(img);
}
});
}
if (document.getElementById('button-collection')) {
loadButtons();
}