forked from Zack-Dx/Mini-TODO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
94 lines (92 loc) · 2.95 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
<!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" />
<link
rel="icon"
href="https://camo.githubusercontent.com/fbec99eed4273705c07cdebcd31744b97df8ca7a6b8603bb246ba895820627e7/68747470733a2f2f686f74656d6f6a692e636f6d2f696d616765732f646c2f372f6d656d6f2d656d6f6a692d62792d676f6f676c652e706e67"
type="image/icon type"
/>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<title>Todo List using Javascript</title>
</head>
<body onload="showNotes()" class="light-mode">
<div id="msgbox" class="msg">message</div>
<header>
<nav id="navbar">
<div id="logo">
<h1><a href="index.html" id="a-link">Blueberry KEEP📝</a></h1>
</div>
<!-- <button id="toggleDarkModeBtn" onclick="toggleDarkMode()">Dark mode</button> -->
<button
class="light-mode-button"
aria-label="Toggle Light Mode"
onclick="toggle_light_mode()"
>
<span></span><span></span>
</button>
</nav>
</header>
<!-- Welcome Section -->
<section class="welcome-message">
<h2>TO-DO LIST</h2>
</section>
<form id="container">
<div id="notebox">
<input
type="text"
id="note"
placeholder="Enter your Note"
value=""
class=""
/>
</div>
<div class="buttons">
<button id="add">Add note</button>
</div>
<br /><br />
</form>
<div id="mainbox"></div>
</body>
<script src="index.js"></script>
<script>
function toggle_light_mode(firstLoad) {
var app = document.getElementsByTagName('BODY')[0];
const check = firstLoad
? localStorage.lightMode != 'dark'
: localStorage.lightMode == 'dark';
if (check) {
localStorage.lightMode = 'light';
app.setAttribute('light-mode', 'light');
if (!firstLoad) showmsg('Light Mode Enabled.');
} else {
localStorage.lightMode = 'dark';
app.setAttribute('light-mode', 'dark');
if (!firstLoad) showmsg('Dark Mode Enabled.');
}
}
var maggio = document.querySelector('#msgbox');
function showmsg(txt) {
document.getElementById('msgbox').innerText = '✉ ' + txt;
maggio.classList.add('show');
setTimeout(function () {
maggio.classList.remove('show');
}, 3000);
}
document.onreadystatechange = () => {
if (document.readyState === 'complete') {
console.log('Flipped!');
toggle_light_mode({});
}
};
</script>
</html>