Added working datetime display, embedded wttr.in
This commit is contained in:
parent
d88782b820
commit
eaecb1838f
10
index.html
10
index.html
@ -1,9 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>News</title>
|
||||
<link rel="stylesheet" type="text/css" href="layout.css" />
|
||||
<link rel="stylesheet" type="text/css" href="dark_theme.css" />
|
||||
<script type="application/javascript" src="index.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="datetime">2018-04-12 12:34:56.345h UTC+1</div>
|
||||
<iframe id="weather" src="https://wttr.in/Karlsruhe"></iframe>
|
||||
<div id="datetime">
|
||||
<span>2018-04-12 12:34:56.345h UTC+1</span>
|
||||
</div>
|
||||
<img id="weather" src="https://wttr.in/Karlsruhe.png" />
|
||||
</body>
|
||||
</html>
|
||||
|
17
index.js
Normal file
17
index.js
Normal file
@ -0,0 +1,17 @@
|
||||
function startDateTimeDisplay() {
|
||||
|
||||
const displayNode = document.querySelector('#datetime span')
|
||||
let dateTime = new Date()
|
||||
|
||||
const updateDateTime = () => {
|
||||
displayNode.innerHTML = dateTime.toString()
|
||||
dateTime = new Date()
|
||||
window.requestAnimationFrame(updateDateTime)
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(updateDateTime)
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
startDateTimeDisplay()
|
||||
}
|
19
layout.css
19
layout.css
@ -5,7 +5,22 @@ html, body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#datetime, #weather {
|
||||
width: 100%;
|
||||
#weather {
|
||||
display: block;
|
||||
margin: auto;
|
||||
height: 60vh;
|
||||
}
|
||||
|
||||
#datetime {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 15vh;
|
||||
text-align: center;
|
||||
line-height: 15vh;
|
||||
}
|
||||
#datetime span {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
line-height: 8vh;
|
||||
font-size: 8vh;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user