-
Notifications
You must be signed in to change notification settings - Fork 42
/
index.html
67 lines (62 loc) · 2.01 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Steno Jig</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="font-roboto.css">
<script src="util.js"></script>
</head>
<body>
<div class="wrapper">
<h1 class="center title">Steno Jig</h1>
<p class="welcome-text">This is a widget for stenography lessons: you can
<a href="learn-keyboard.html">learn the steno keyboard</a>, do <a
href="form.html">our lessons</a> or the <a
href="learn-plover.html">Learn Plover ones</a>, or fork the <a
href="https://github.com/JoshuaGrams/steno-jig">GitHub repo</a>
and customize it to make your own.</p>
</div>
<script>
setTheme()
if(storageAvailable('localStorage')) {
let wrapper = document.querySelector('.wrapper')
let isDark = localStorage.theme === 'dark'
let checkbox = document.createElement('input')
checkbox.setAttribute('id', 'night-mode')
checkbox.setAttribute('type', 'checkbox')
checkbox.checked = isDark
checkbox.addEventListener('input', function(e) {
if(e.target.checked) {
localStorage.theme = 'dark'
document.body.setAttribute('data-theme', localStorage.theme)
} else {
delete localStorage.theme
document.body.removeAttribute('data-theme')
}
})
wrapper.appendChild(checkbox)
let label = document.createElement('label')
label.setAttribute('for', 'night-mode')
label.appendChild(document.createTextNode(' Night Mode'))
wrapper.appendChild(label)
const saveStats = localStorage.save_stats != null
const statsCtrl = N('input', {
type: 'checkbox',
click: (evt) => {
if(statsCtrl.checked) localStorage.setItem('save_stats', 1)
else localStorage.removeItem('save_stats')
}
})
statsCtrl.checked = saveStats
N(wrapper, N('br'), N('label', statsCtrl, 'Record Stats'))
if(localStorage.count) {
linkExercises(localStorage, wrapper)
listExercises(localStorage, wrapper)
}
} else {
document.body.appendChild(document.createTextNode('localStorage not available.'))
}
</script>
</body>
</html>