dc09.ru-old/js/script.js

16 lines
540 B
JavaScript

addEventListener('load', () => {
const birthday = new Date(2009, 6, 13, 13, 30)
const delta = new Date() - birthday
const age = delta / (1000 * 3600 * 24 * 365.25)
document.getElementById('age').innerText = Math.floor(age)
})
addEventListener('load', () => {
const xhr = new XMLHttpRequest()
xhr.open('GET', '/inxi.txt')
xhr.onreadystatechange = () => {
if (xhr.readyState != xhr.DONE || xhr.status != 200) return
document.getElementById('inxi').innerText = xhr.response
}
xhr.send()
})