-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (211 loc) · 7.86 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
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
202
203
204
205
206
207
208
209
210
211
212
<!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">
<meta name="Description" CONTENT="Collection of texts from Tράπεζα κειμένων with synced audio for learning Modern Greek.">
<title>Greek Texts</title>
<!-- Google Font CDN -->
<!-- https://fonts.google.com/specimen/Open+Sans -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
<!-- Favicon source: -->
<!-- https://www.flaticon.com/free-icon/greek-temple_1597821 -->
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
<style>
* {
box-sizing: border-box;
}
html, body {
font-size: 16px;
font-family: "Open Sans", Calibri, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
margin: 0px;
padding: 8px 8px 0px 8px;
}
img {
width: 100%;
max-height: 420px; /* 680 / 1.61803398875 */
}
@media only screen and (min-width: 680px) {
p, li, .github-link {
font-size: 1.25rem;
}
.github-icon {
width: 1.25rem;
height: 1.25rem;
}
}
audio {
width: 100%;
position: sticky;
bottom: 8px;
}
header {
text-align: right;
max-width: 680px;
margin-right: auto;
margin-left: auto;
margin-bottom: 8px;
}
select {
font-size: 1.125rem;
padding: 2px 4px;
}
main {
height: 100%;
max-width: 680px;
margin-left: auto;
margin-right: auto;
position: relative;
}
.highlight {
background-color: yellow;
}
span {
/* https://www.cssportal.com/css-cubic-bezier-generator/ */
transition: background 100ms ease-in;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
#loading-spinner {
border-radius: 50%;
border-top: 4px solid rgba(0, 0, 0, 0.67);
border-right: 4px solid rgba(0, 0, 0, 0.67);
border-bottom: 4px solid rgba(0, 0, 0, 0.67);
border-left: 4px solid transparent;
width: 50px;
height: 50px;
animation: spin 800ms ease-out infinite;
margin-left: auto;
margin-right: auto;
margin-top: 33vh;
}
footer {
text-align: center;
margin: 24px 0px;
display: flex;
align-items: center;
justify-content: center;
}
.github-link {
text-decoration: none;
display: flex;
align-items: center;
}
.github-link, .github-link:active, .github-link:visited {
color: #616161; /* Grey 700 https://materialui.co/colors/ */
}
.github-link:hover {
color: #424242; /* Grey 800 https://materialui.co/colors/ */
}
.github-link:hover .github-icon {
fill: #424242; /* Grey 800 https://materialui.co/colors/ */
}
.github-icon {
fill: #616161; /* Grey 700 https://materialui.co/colors/ */
width: 1rem;
height: 1rem;
margin-right: 8px;
transition: fill 350ms ease-in-out;
}
.space-between {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.space-between > *:first-child {
display: inline-block;
margin-right: 16px;
}
.A2 {
color:rgb(0 165 132);
}
.B1 {
color: rgb(230 116 0);
}
a {
transition: color 350ms ease-in-out;
}
a, a:visited {
color: #1E88E5; /* Blue 600 https://materialui.co/colors/ */
}
a:hover {
color: #1976D2; /* Blue 700 https://materialui.co/colors/ */
}
</style>
</head>
<body>
<header>
<select id="text-select">
<option value="Τσιντσιλά" selected>Τσιντσιλά</option>
<option value="Ο γάτος">Ο γάτος</option>
<option value="Το δελφίνι">Το δελφίνι</option>
<option value="Πώς να γίνεις καλός στη δουλειά σου">Πώς να γίνεις καλός στη δουλειά σου</option>
<option value="Καφές με …παντοτινή γεύση">Καφές με …παντοτινή γεύση</option>
</select>
</header>
<main id="root">
<div id="loading-spinner"></div>
</main>
<footer>
<a class="github-link" target="_blank" href="https://github.com/gbroques/greek-texts">
<svg class="github-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z" transform="scale(64)"/>
</svg>
<span>Contribute on GitHub</span>
</a>
</footer>
</body>
<script>
(() => {
const textSelect = document.getElementById('text-select');
let textFromHash = location.hash.substring(2);
try {
textFromHash = decodeURIComponent(textFromHash);
} catch (e) {
// do nothing.
}
const selectedIndex = Array.prototype.findIndex.call(
textSelect.options,
option => option.value === textFromHash);
if (selectedIndex === -1) {
location.hash = '';
} else {
textSelect.selectedIndex = selectedIndex;
}
})();
</script>
<script type="module">
import createRoot from './src/createRoot.js';
const loadingSpinner = document.getElementById('loading-spinner');
const hideLoadingSpinner = () => loadingSpinner.style.display = 'none';
const root = createRoot(document.getElementById('root'));
const textSelect = document.getElementById('text-select');
const defaultSelected = textSelect.options[textSelect.selectedIndex].value;
const initialTitle = document.title;
const setHash = text => location.hash = '/' + encodeURIComponent(text);
const setTitle = text => document.title = text + ' - ' + initialTitle;
const setText = text => {
setHash(text);
setTitle(text);
};
if (!location.hash.substring(2)) {
setText(defaultSelected);
} else {
setTitle(defaultSelected);
}
root.renderText(defaultSelected).then(hideLoadingSpinner);
textSelect.addEventListener('change', e => {
const text = e.target.value;
setText(text);
root.renderText(text);
});
</script>
</html>