-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
123 lines (108 loc) · 2.44 KB
/
index.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<html>
<head>
<title>musquito test drive</title>
<meta charset="UTF-8">
<style>
:root {
font-size: 16px;
}
body {
margin: 0;
color: #525240;
font-family: 'Roboto', sans-serif;
display: flex;
flex-direction: column;
min-height: 100vh;
}
header {
height: 8rem;
display: flex;
align-items: center;
justify-content: center;
background-color: #dede07;
color: #424236;
}
header h1 {
text-align: center;
font-family: 'Righteous', cursive;
font-size: 4rem;
}
main {
flex-grow: 1;
min-height: calc(100vh - 128px);
}
main textarea {
display: block;
width: 100%;
min-height: calc(100vh - 168px);
font-family: 'Fira Code', monospace;
font-size: 1rem;
color: #666;
padding: 1rem 5rem 1rem 1rem;
border: none;
outline: none;
resize: none;
}
.buttons {
position: absolute;
top: 9rem;
right: 1rem;
display: flex;
flex-direction: column;
}
.buttons button {
width: 3rem;
height: 3rem;
border: solid 2px #fced14;
margin-top: 0.75rem;
background-color: #fced14;
color: #292924;
font-weight: bold;
font-size: 1rem;
transition: all 0.25s;
cursor: pointer;
border-radius: 50%;
}
.buttons button:hover {
background-color: transparent;
}
footer {
position: fixed;
width: 100%;
bottom: 1rem;
font-size: 0.75rem;
text-align: center;
color: #666;
background-color: transparent;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Righteous|Roboto|Fira+Code&display=swap" rel="stylesheet">
</head>
<body>
<header>
<h1 class="heading">musquito</h1>
</header>
<main>
<textarea id="code" placeholder="Type code here..."></textarea>
<div class="buttons">
<button id="run">▶</button>
<button id="clear">x</button>
</div>
</main>
<footer>
Copyright © 2020 musquito. All rights reserved.
</footer>
<script>
var textarea = document.querySelector('textarea');
textarea.addEventListener('keydown', function (e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 9) {
e.preventDefault();
const TAB_SIZE = 4;
// The one-liner that does the magic
document.execCommand('insertText', false, ' '.repeat(TAB_SIZE));
}
});
</script>
</body>
</html>