-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
36 lines (33 loc) · 1.31 KB
/
main.js
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
(function () {
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
// console.log('CLIENT: service worker registration in progress.');
navigator.serviceWorker.register('service-worker.js');
// .then(function() {
// console.log('CLIENT: service worker registration complete.');
// });
});
} else {
console.log('CLIENT: service worker is not supported.');
}
})();
(function () {
let emailInput = document.querySelector('input[type=email]');
emailInput.addEventListener('keyup', function () {
document.querySelector('input[type=submit]').disabled = emailInput.value.length <= 0;
})
})();
(function () {
let darkModeUrl = 'https://cdn.jsdelivr.net/gh/ferror/grave@gh-pages/3.3/grave-dark.min.css';
let lightModeUrl = 'https://cdn.jsdelivr.net/gh/ferror/grave@gh-pages/3.3/grave-light.min.css';
document.querySelector('body').addEventListener('dblclick', function() {
let links = document.querySelectorAll('link[rel=stylesheet]');
links.forEach(function (link) {
if (link.href === darkModeUrl) {
link.href = lightModeUrl;
} else {
link.href = darkModeUrl;
}
});
});
})();