Skip to content

Commit e74b624

Browse files
authored
Create clock.html
1 parent aa69284 commit e74b624

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

secondary/clock.html

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!-- :D clock.html -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Clock</title>
8+
</head>
9+
<body>
10+
<h1 id="clock">00:00:00</h1>
11+
<form><input type="checkbox" name="" id="seconds_hide" value="True">Hide seconds</form>
12+
</body>
13+
</html>
14+
<style>
15+
@import url('https://fonts.googleapis.com/css2?family=42dot+Sans:wght@300..800&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Pochaevsk&display=swap');
16+
:root{
17+
--coffee: #7F5743ff;
18+
--raw-umber: #8A5F47ff;
19+
--raw-umber-2: #91654Aff;
20+
--raw-umber-3: #996D53ff;
21+
--coffee-2: #5F412Fff;
22+
}
23+
body{
24+
display: grid;
25+
place-items: center;
26+
background-color: var(--raw-umber-3);
27+
}
28+
body,html{
29+
height: 100%;
30+
}
31+
h1#clock{
32+
font-size: 250px;
33+
color: var(--coffee-2);
34+
font-family: "Pochaevsk", serif;
35+
font-weight: 400;
36+
font-style: normal;
37+
}
38+
*{
39+
overflow: hidden;
40+
}
41+
.hidemouse{
42+
cursor: none;
43+
}
44+
</style>
45+
<script>
46+
//should i work on my optimizations?
47+
var _seconds_hidden_ = false
48+
function __updateclock__(){
49+
const clock = new Date()
50+
const minute = clock.getMinutes()
51+
const hour = clock.getHours()
52+
const second = clock.getSeconds()
53+
54+
const _clock_ = document.getElementById('clock')
55+
_clock_.innerText = `${hour}:${minute}:${second}`
56+
if (_seconds_hidden_){
57+
_clock_.innerText = `${hour}:${minute}`
58+
}
59+
}
60+
const update = setInterval(() => {
61+
62+
__updateclock__()
63+
_seconds_hidden_ = document.getElementById('seconds_hide').checked
64+
}, 100);
65+
document.getElementById('seconds_hide').addEventListener('change',() => {
66+
_seconds_hidden_ = document.getElementById('seconds_hide').checked
67+
__updateclock__()
68+
})
69+
70+
//too much... it was working some, but it was just too buggy, and i dont really like the optimizations.
71+
/*var mousex = 0
72+
var mousey = 0
73+
document.addEventListener('mousemove',(event) => {
74+
mousex = event.clientX
75+
mousey = event.clientY
76+
})
77+
var mouseopen = true
78+
document.addEventListener('mousemove',(event) => {
79+
if (document.body.classList.contains('hidemouse')){
80+
document.body.classList.remove('hidemouse')
81+
}
82+
if (mouseopen){
83+
console.log('started mouse hide check')
84+
mouseopen = false
85+
const permmousex = event.clientX
86+
const permmousey = event.clientY
87+
var i = 0
88+
89+
const check = setInterval(() => {
90+
console.log('mouse checked. ' + i)
91+
if (!(permmousex == mousex)){
92+
console.log('mouse moved.')
93+
mouseopen = true
94+
clearInterval(check)
95+
}
96+
i+=100
97+
if (i>=(10000*2)){
98+
document.body.classList.add('hidemouse')
99+
console.log('hiding')
100+
}
101+
}, 10);
102+
}
103+
})*/
104+
105+
106+
</script>

0 commit comments

Comments
 (0)