You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
<!DOCTYPE html> |
|
<html lang="en"> |
|
|
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Ждём лета</title> |
|
</head> |
|
<style> |
|
body { |
|
margin: 0; |
|
padding: 0; |
|
} |
|
|
|
.timer_frame { |
|
margin: 0; |
|
padding: 0; |
|
font-family: arial; |
|
font-size: 5vw; |
|
outline: dashed 1px black; |
|
height: 100vh; |
|
/* Center child horizontally*/ |
|
text-align: center; |
|
|
|
display: flex; |
|
flex-direction: column; |
|
justify-content: center; |
|
} |
|
</style> |
|
|
|
<body> |
|
<div class="timer_frame"> |
|
<p id="timer_data" class="timer_data"></p> |
|
</div> |
|
</body> |
|
<script> |
|
async function fetchAsync (url) { |
|
let response = await fetch(url); |
|
let data = await response; |
|
return data.text(); |
|
} |
|
|
|
async function updateInfoAsync() { |
|
let url = "/time"; |
|
let info = await fetchAsync(url); |
|
let elem = document.getElementById("timer_data"); |
|
elem.textContent = info; |
|
setTimeout(updateInfoAsync, 1000) |
|
} |
|
|
|
updateInfoAsync(); |
|
|
|
</script> |
|
</html> |