104 lines
2.6 KiB
JavaScript
104 lines
2.6 KiB
JavaScript
// TYPERWRITER
|
|
|
|
const values = [
|
|
"Web developer",
|
|
"Pc games enjoyer",
|
|
"Server backend survivor",
|
|
"python programmer",
|
|
"Javascript disliker",
|
|
"I use Arch btw",
|
|
"Owo, what's this?",
|
|
"Ultimate procrastinator",
|
|
"Ultrakill gaming",
|
|
"00111010 00110011",
|
|
"fistful of dollar",
|
|
"Thy end is now!!!",
|
|
"Possibly a furry",
|
|
"Prepare thyself!!!",
|
|
"Spegatti code master",
|
|
"Ethernet cable untangler",
|
|
"Caffeine addict",
|
|
"I'm not a robot ☑",
|
|
"Loud Music enjoyer",
|
|
"part time femboy :<",
|
|
];
|
|
var direction = 1;
|
|
var text = "";
|
|
var speed = 100;
|
|
var selectedValue = 0;
|
|
var currentValueIndex = 0;
|
|
var pause = false;
|
|
|
|
function randomValue() {
|
|
selectedValue = Math.floor(Math.random() * values.length);
|
|
currentValueIndex = 0;
|
|
}
|
|
|
|
function type() {
|
|
if (direction == 1) {
|
|
if (currentValueIndex < values[selectedValue].length) {
|
|
text += values[selectedValue][currentValueIndex];
|
|
currentValueIndex++;
|
|
} else {
|
|
direction = -1;
|
|
pause = true;
|
|
}
|
|
} else {
|
|
if (currentValueIndex > 0) {
|
|
text = text.slice(0, -1);
|
|
currentValueIndex--;
|
|
} else {
|
|
direction = 1;
|
|
randomValue();
|
|
}
|
|
}
|
|
}
|
|
|
|
function typing() {
|
|
type();
|
|
document.getElementById("typing").innerHTML = "$ " + text;
|
|
if (direction == 1) {
|
|
speed = 80 + Math.random() * 100;
|
|
} else {
|
|
speed = 60 + (Math.random() * 100) / 2;
|
|
}
|
|
if (!pause) {
|
|
setTimeout(typing, speed);
|
|
} else {
|
|
setTimeout(typing, 500);
|
|
pause = false;
|
|
}
|
|
}
|
|
|
|
typing();
|
|
|
|
// HIDDEN STUFF (shh don't tell anyone >:3)
|
|
|
|
var last5Chars = "";
|
|
|
|
document.addEventListener('keydown', function(event) {
|
|
last5Chars += event.key;
|
|
if (last5Chars == "furry") {
|
|
console.log("owo, whats this?");
|
|
document.getElementById('furry').style.display = 'block';
|
|
}
|
|
while (last5Chars.length >= 5) {
|
|
last5Chars = last5Chars.slice(1);
|
|
}
|
|
});
|
|
|
|
// Spotify API
|
|
|
|
function getSpotify() {
|
|
fetch('https://api.alfieking.dev/spotify/nowplaying/xz02oolstlvwxqu1pfcua9exz').then(response => {
|
|
return response.json();
|
|
}).then(data => {
|
|
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;
|
|
document.getElementById('spotify-link').href = data.item.external_urls.spotify;
|
|
});
|
|
}
|
|
|
|
getSpotify();
|
|
setInterval(getSpotify, 15000); |