-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsayword.html
201 lines (168 loc) · 4.17 KB
/
sayword.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Live Transcript</title>
<style>
* {
box-sizing: border-box
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
scroll-behavior: smooth;
}
a {
font-weight: bold;
text-decoration: none;
color: yellowgreen;
}
a:visited {
color: yellowgreen;
}
header,
.header-buffer {
background-color: #fff;
position: fixed;
width: 100%;
top: 0;
background-color: aliceblue;
padding: 10px;
}
h1 {
margin: 2px;
}
#words-to-say {
width: 100%;
font-size: 50px;
}
/*
TODO: solve the problem of having to update media queries every time the content of the header changes
Possiblities:
1. just always set the margin on the <main> element with JS based on the height of the header?
something like :
window.addEventListener('resize', function(){
document.querySelector('main').style.marginTop = document.querySelector("header").clientHeight + 'px';
})
... with a similar function firing when the page first loads.
2. Something else? Can CSS do this on its own, and not break if the user changes the default font, lineheight, spacing, etc etc or the content itself is changed?
*/
/* Start Media Queries on Main for Changing screen size */
@media only screen and (min-width: 150px) and (max-width: 167px) {
main {
padding-top: 17em;
}
}
@media only screen and (min-width: 168px) and (max-width: 195px) {
main {
padding-top: 16em;
}
}
@media only screen and (min-width: 196px) and (max-width:225px) {
main {
padding-top: 15em;
}
}
@media only screen and (min-width: 226px) and (max-width:251px) {
main {
padding-top: 14em;
}
}
@media only screen and (min-width: 252px) and (max-width:260px) {
main {
padding-top: 10.4em;
}
}
@media only screen and (min-width: 261px) and (max-width:354px) {
main {
padding-top: 9.4em;
}
}
@media only screen and (min-width: 354px) and (max-width:637px) {
main {
padding-top: 8.6em;
}
}
@media only screen and (min-width: 637px) {
main {
padding-top: 7.4em;
}
}
/* End Media Queries for Changing screen size */
p {
font-size: 30px;
line-height: 1.2;
white-space: pre-wrap;
outline: none;
margin: 2px;
margin-bottom: 62px;
}
section {
padding: 10px;
}
.interim {
font-size: 22px;
color: #555;
bottom: 0;
left: 0;
background-color: #FFF;
padding: 8px;
width: 100%;
border-top: 1px solid gray;
position: fixed;
}
.credit {
margin-top: 4px;
font-size: 12px;
color: #333;
display: block;
}
.snippet {
margin: .15em;
outline: none;
display: inline-block;
}
.name-transcript {
font-size: 14px;
}
.transcript-id-form {
margin-top: 6px;
}
.status {
margin-top: 4px;
}
</style>
</head>
<body>
<header id="header">
<h1>Say A Words</h1>
<button onclick="toggleDarkTheme()">Toggle Light/Dark</button>
<button onclick="toggle()" class='startListen'>Start Listening</button>
<button onclick="toggle()" class="stopListen" style="display:none">Stop Listening</button>
<div class="status">Status:
<span id="status">Not Listening</span>
</div>
</header>
<main>
<section>
<!-- TODO: Well it's not just made by me any more :) so how about we do something that follows the all-contributors spec:
https://github.com/kentcdodds/all-contributors -->
<!-- TODO: the language here could be improved. The class and ID names could be more clear also. -->
<input type="text" name="" id="words-to-say">
<p id="transcript" contenteditable="false"></p>
<span class="interim" id="interim"></span>
</section>
</main>
<script src="https://www.gstatic.com/firebasejs/4.8.2/firebase.js"></script>
<script>
window.noZensmooth = true
</script>
<script src="javascripts/zenscroll-min.js"></script>
<script src="javascripts/common.js"></script>
<script src="javascripts/listen.js"></script>
<script src="javascripts/sayword.js"></script>
</body>
</html>