гитигнор подставил

This commit is contained in:
Kira Edges 2025-05-16 11:10:33 +04:00
parent 2b3511f69c
commit 08d00aabd6
Signed by: edges
SSH key fingerprint: SHA256:RT4iUXBlbU5TGAtoYgAX7B0MQ9VaDbhv3/lTdrVrQEA
2 changed files with 23 additions and 1 deletions

23
static/index.js Normal file
View file

@ -0,0 +1,23 @@
const startDate = new Date('2019-06-20T00:00:00Z'); /* будем считать, что именно в это время был первый релиз */
function updateYearsPassed() {
const now = Date.now();
const millisecondsPerYear = 1000 * 60 * 60 * 24 * 365.2425; /* учёт високосных лет */
const yearsPassed = (now - startDate) / millisecondsPerYear;
document.getElementById('counter').textContent =
`${yearsPassed}`;
}
function updateYear() {
const now = new Date().getFullYear();
years = document.getElementsByClassName("year")
for (year in years) {
year.textContent = ` ${now} `}
}
updateYearsPassed(); /* сразу при загрузке */
updateYear();
setInterval(updateYearsPassed, 10);
setInterval(updateYear, 10000);
/* код написал чат гопоты, мне осталось лишь подправить. Каюсь, гречневая */