-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyCodeTool.html
More file actions
43 lines (43 loc) · 1.21 KB
/
KeyCodeTool.html
File metadata and controls
43 lines (43 loc) · 1.21 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
<!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>Keyboard Keycode</title>
<style type="text/css">
body{
padding: 0px;
margin: 0px;
position: relative;
display: block;
height: 100vh;
width: 100%;
}
div, p, span, h1{
margin: 0px;
padding: 0px;
}
.parent{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
</style>
</head>
<body>
<div class="parent">
<h1>Keyboard Keycode</h1>
<div class="conatiner" id="canvas">
<p>event.keyCode = <span>Press anything</span></p>
<p>event.key = <span>Press anything</span></p>
<p>event.code = <span>Press anything</span></p>
</div>
</div>
<script>
document.addEventListener("keyup",function(e){e.preventDefault();var o=[e.keyCode,e.key,e.code],n=-1;if(document.querySelectorAll("#canvas span").forEach(e=>{n++,e.innerHTML=o[n]}),123==o[0]||"F12"==o[1]||"F12"==o[2]||e.shiftKey&&e.ctrlKey&&"I"==o[1]){window.open(window.location,"_blank");window.focus(),setTimeout(()=>{window.location="https://youtu.be/orbjuMHZ4k4"},200)}});
</script>
</body>
</html>