Skip to content

Commit c33aa48

Browse files
committed
Switch to using localStorage instead of cookies
1 parent fb6e727 commit c33aa48

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

site/static/home.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,11 @@ function homePageSetup() {
2525
const input_item = document.getElementById('knock_name_input');
2626
for (const button of buttons) {
2727
button.addEventListener("click", () => {
28-
document.cookie = "name=" + input_item.value;
28+
localStorage.name = input_item.value;
2929
knockSocket(`${button.id}`);
3030
});
3131
}
32-
// Check the cookie to see if a name is included
33-
let ca = document.cookie.split(';');
34-
for (let i = 0; i < ca.length; i++) {
35-
let c = ca[i];
36-
while (c.charAt(0) == ' ') {
37-
c = c.substring(1);
38-
}
39-
if (c.indexOf('name=') == 0) {
40-
input_item.value = c.substring(5, c.length);
41-
}
42-
}
32+
input_item.value = localStorage.name ?? "";
4333
}
4434

4535
function knockSocket(location) {

0 commit comments

Comments
 (0)