-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-list.html
210 lines (183 loc) · 7.55 KB
/
new-list.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
<!doctype html>
<html lang="en" class="h-100" data-bs-theme="auto">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="To-Do Together | A simple, shared to-do list made with Bootstrap and Node.js">
<meta name="author" content="Ritin Malhotra">
<meta name="generator" content="To-Do Together">
<title>To-Do Together</title>
<link href="css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<!-- Favicons -->
<link rel="icon" href="img/card-checklist.svg">
<meta name="theme-color" content="#712cf9">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.b-example-divider {
width: 100%;
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}
.bi {
vertical-align: -.125em;
fill: currentColor;
}
.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
}
.nav-scroller .nav {
display: flex;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.btn-bd-primary {
--bd-violet-bg: #712cf9;
--bd-violet-rgb: 112.520718, 44.062154, 249.437846;
--bs-btn-font-weight: 600;
--bs-btn-color: var(--bs-white);
--bs-btn-bg: var(--bd-violet-bg);
--bs-btn-border-color: var(--bd-violet-bg);
--bs-btn-hover-color: var(--bs-white);
--bs-btn-hover-bg: #6528e0;
--bs-btn-hover-border-color: #6528e0;
--bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
--bs-btn-active-color: var(--bs-btn-hover-color);
--bs-btn-active-bg: #5a23c8;
--bs-btn-active-border-color: #5a23c8;
}
.bd-mode-toggle {
z-index: 1500;
}
input[type='text'],
input[type='password'] {
background-color: #212529;
color: whitesmoke;
border: 1px solid grey;
}
input[type='text']:focus,
input[type='password']:focus {
background-color: #212529;
color: whitesmoke;
border: 1px solid whitesmoke;
}
input[type='text']::placeholder,
input[type='password']::placeholder {
color: grey;
}
/* Create a mobile query */
@media only screen and (max-width: 600px) {
#get-started {
margin-top: 2.5%;
}
}
</style>
<!-- Custom styles for this template -->
<link href="cover/cover.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css">
</head>
<body class="d-flex h-100 text-center text-bg-dark p-1">
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<header class="mb-auto">
<div>
<h3 class="float-md-start mb-0 icon-link-hover" style="cursor: pointer;" onclick="
// Navigate to home page
window.location.href = 'index.html';
">To-Do Together</h3>
<nav class="nav nav-masthead justify-content-center float-md-end">
<a class="nav-link icon-link-hover" href="new-list.html">New List</a>
<a class="nav-link icon-link-hover" href="my-lists.html">My Lists</a>
</nav>
</div>
</header>
<main class="px-3">
<h1 class="mb-3">Create New List</h1>
<div>
<!-- <p class="lead d-inline m-lg-1">Display Name </p> -->
<!-- Form to get user's name -->
<form class="d-inline-flex flex-column justify-content-center align-items-center" style="width: 58.5%"
onsubmit="
// Send a POST request to the server with the user's name
const name = document.getElementById('name-input').value;
const password = document.getElementById('password-input').value;
const data = {name: name, password: password};
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
};
fetch('/new-list.html', options).then(response => {
if (response.ok) {
// Get the name and ID of the list from the response
response.json().then(data => {
// Create an entry for the new list in localStorage
// If myLists doesn't exist, create it
if (!localStorage.getItem('myLists')) {
localStorage.setItem('myLists', JSON.stringify({}));
}
// Add the new list to myLists
let lists = JSON.parse(localStorage.getItem('myLists'));
// Create a new object to store in the lists
let newList = {
'code': data.id,
'date_modified': data.dateTime
};
lists[data.id] = newList;
localStorage.setItem('myLists', JSON.stringify(lists));
// Navigate to the list page
window.location.href = 'list-template.html?name=' + data.name + '&code=' + data.id;
});
} else {
console.log('Error!');
}
});
return false;
">
<div class="mb-3 d-flex flex-column gap-2" style="width: 97.5%;">
<input type="text" class="form-control" placeholder="Your Name (as Displayed on the To-Do List)"
aria-label="Recipient's username" aria-describedby="basic-addon2" style="text-align: center"
id="name-input">
<input type="password" class="form-control" placeholder="Password"
aria-label="Recipient's username" aria-describedby="basic-addon2" style="text-align: center"
id="password-input">
</div>
<button class="btn btn-sm btn-secondary" style="font-size: 1.05rem; width: 97.5%"
type="submit">Create List</button>
</form>
</div>
</main>
<footer class="mt-auto text-white-50">
<p>CADT-UH 1013EQ 2023 Spring 001-2 | Language of Computers</p>
</footer>
</div>
</body>
</html>