-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmouse.html
More file actions
48 lines (40 loc) · 1.37 KB
/
mouse.html
File metadata and controls
48 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>efenow | Don't Move your Mouse!</title>
<link rel="stylesheet" href="css/mouse.css">
<script src="https://kit.fontawesome.com/e0c0a06cdf.js" crossorigin="anonymous"></script>
<link rel="icon" href="resimler/favicon.png" type="image/x-icon" />
</head>
<body>
<h1 id="baslik"><i class="fa-solid fa-computer-mouse fa-xl" style="color: #141414;"></i> Do not move your mouse.</h1>
<div id="stopwatch">0.0</div>
<footer id="footer-text"><a>efenow.xyz</a></footer>
<script>
let startTime;
let interval;
function startStopwatch() {
startTime = Date.now();
interval = setInterval(updateStopwatch, 100);
}
function updateStopwatch() {
const elapsedTime = (Date.now() - startTime) / 1000;
document.getElementById('stopwatch').textContent = elapsedTime.toFixed(1);
}
function resetStopwatch() {
clearInterval(interval);
startStopwatch();
}
document.body.onmousemove = resetStopwatch;
document.addEventListener('visibilitychange', () => {
if (document.hidden) {
resetStopwatch();
}
});
// Start the stopwatch initially
startStopwatch();
</script>
</body>
</html>