-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (19 loc) · 689 Bytes
/
index.js
File metadata and controls
22 lines (19 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const navToggle = document.querySelector('.nav-toggle')
require('./editor')()
navToggle.addEventListener('click', function (e) {
document.body.classList.toggle('nav-enabled')
return e.preventDefault() && false
}, false)
const doneMarks = document.querySelectorAll('.done-mark[data-name]')
if (window.localStorage) {
for (var i = 0; i < doneMarks.length; i++) {
var markEl = doneMarks[i]
var markName = markEl.getAttribute('data-name')
var markKey = 'lesson:' + markName
var markValue = !!window.localStorage.getItem(markKey)
if (markValue) {
markEl.classList.add('is-done')
markEl.parentNode && markEl.parentNode.classList.add('faded')
}
}
}