-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
52 lines (42 loc) · 1.28 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
const SOCIALS = {
youtube: 'https://www.youtube.com/@cattyngmd',
github: 'https://github.com/cattyngmd',
telegram: 'https://cattyn.t.me/'
}
const WAVE_PATTERN = "⋆⭒˚.";
const WAVE_LEN = 33;
const BIRTHDAY = 1159905600000;
let offset = 0;
const main = () => {
$('bio').innerText = $('bio').innerText.replace("%age%", yearPassed(BIRTHDAY))
setInterval(() => {
let localoffset = 0;
let str = '';
for (let i = 0; i < WAVE_LEN; i++) {
if (i == Math.floor(WAVE_LEN / 2)) {
str += '$';
localoffset += 'cattyn'.length;
continue;
}
str += WAVE_PATTERN[(i + offset + localoffset) % WAVE_PATTERN.length]
}
let split = str.split("$");
$('prefix').innerHTML = split[0];
$('suffix').innerHTML = split[1];
offset++
}, 150);
}
const onSocialClick = (e) => {
let clicked = e.target.innerText;
let url = SOCIALS[clicked];
window.location.href = url;
}
const yearPassed = (day) => {
let ageDifMs = Date.now() - day;
let ageDate = new Date(ageDifMs);
return ageDate.getUTCFullYear() - 1970;
}
const $ = (id) => {
return document.getElementById(id);
}
document.addEventListener('DOMContentLoaded', main);