-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
195 lines (161 loc) · 6 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
let counter = 0;
let counter2 = 0;
//Static
const birthdayString = "Birthday: November 20, 2009";
const celebrateString = "Today is my birthday! Happy birthday to me!"
const contactmethod = "Contact me through Discord: @hito.akk1to";
//Countdown
const birthdayMonth = 11;
const birthdayDay = 20;
const birthYear = 2009;
const today = new Date();
const dayoftoday = new Date().getDate;
const monthoftoday = new Date().getMonth;
const currentYear = today.getFullYear();
var radio = null;
var radioPlayingSong = null;
var radioIsLoading = false;
let nextBirthday = new Date(currentYear, birthdayMonth - 1, birthdayDay);
if (today > nextBirthday) {
nextBirthday = new Date(currentYear + 1, birthdayMonth - 1, birthdayDay);
}
const timeDifference = nextBirthday - today;
const daysUntilBirthday = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
const nextAge = nextBirthday.getFullYear() - birthYear;
//Event
document.addEventListener('DOMContentLoaded', function() {
if (dayoftoday == birthdayDay && monthoftoday == birthdayMonth) document.getElementById('countdown').textContent = celebrateString;
else document.getElementById('countdown').textContent = birthdayString;
document.addEventListener('contextmenu', event => event.preventDefault());
document.addEventListener('keydown', function(event) {
if (event.key === 'F12' || (event.ctrlKey && event.shiftKey && event.key === 'I') || (event.ctrlKey && event.shiftKey && event.key === 'C') || (event.ctrlKey && event.key === 'U')) {
event.preventDefault();
}
});
//Status
fetch('https://api.lanyard.rest/v1/users/727497287777124414')
.then(response => response.json())
.then(data => {
const status = data.data.discord_status;
const statusElement = document.getElementById('bio-status');
// Set the text based on status
statusElement.textContent = '●';
// Remove any existing status classes
statusElement.classList.remove('online', 'idle', 'dnd', 'offline');
console.log(status);
// Add class based on the status
switch (status) {
case 'online':
statusElement.classList.add('online');
break;
case 'idle':
statusElement.classList.add('idle');
break;
case 'dnd':
statusElement.classList.add('dnd');
break;
case 'offline':
statusElement.classList.add('offline');
break;
default:
statusElement.classList.add('offline'); // Default to offline
}
})
.catch(error => {
console.error('Error fetching the API:', error);
document.getElementById('bio-status').textContent = '⚠︎';
});
setInterval(change, 5000);
// setInterval(changemethod, 5000);
setInterval(setRadioText, 500);
let a = new EventSource("https://api.zeno.fm/mounts/metadata/subscribe/fikggbpoi71vv");
a.onmessage = function(t) {
let e = JSON.parse(t.data);
if (e.streamTitle) {
radioPlayingSong = e.streamTitle;
}
}
});
function setRadioText() {
var m = getMutedStatus();
if (radioIsLoading) {
var mt = "(Loading...)"
}
else {
if (m) {
var mt = "(Tap here to unmute)"
}
else {
var mt = "(Tap here to mute)"
}
}
document.getElementById("radio-text-1").textContent = "📻 akk1to's chill vibes " + mt;
document.getElementById("radio-text-2").textContent = radioPlayingSong;
}
function getMutedStatus() {
if (radio == null) {
return true;
}
if (radio.muted) {
return true;
}
else {
return false;
}
}
function radiotoggle() {
if (radioIsLoading) {
return;
}
if (radio == null) {
radioIsLoading = true;
radio = new Audio('https://stream.zeno.fm/fikggbpoi71vv');
radio.addEventListener("canplaythrough", (event) => {
radioIsLoading = false;
});
radio.play();
return;
}
if (radio.muted) {
radio.muted = false;
}
else {
radio.muted = true;
}
}
function change() {
document.getElementById("countdown").setAttribute("class", "text-fade");
setTimeout(() => {
const countdownElement = document.getElementById('countdown');
if (counter == 0) {
if (dayoftoday == birthdayDay && monthoftoday == birthdayMonth) { countdownElement.textContent = celebrateString; }
else { countdownElement.textContent = birthdayString; }
}
if (counter == 1) {
if (dayoftoday == birthdayDay && monthoftoday == birthdayMonth) { countdownElement.textContent = `Celebrate my birthday on my Facebook! Click the Facebook icon below!` }
else { countdownElement.textContent = `${daysUntilBirthday} days until my ${nextAge}-year-old birthday!`; }
}
document.getElementById("countdown").setAttribute("class", "text-show");
}, 500)
counter++;
if (counter > 1) {
counter = 0;
}
}
// function changemethod() {
// document.getElementById("contactmethod").setAttribute("class", "text-fade");
// setTimeout(() => {
// const contactElement = document.getElementById('contactmethod');
// if (counter2 == 0) {
// contactElement.textContent = contactmethod;
// }
// if (counter2 == 1) {
// contactElement.textContent = `Contact me through mail: akk1to.dev@gmail.com`;
// }
// document.getElementById("contactmethod").setAttribute("class", "text-show");
// }, 500)
// counter2++;
// if (counter2 > 1) {
// counter2 = 0;
// }
// }