-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
99 lines (84 loc) · 2.1 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
95
96
97
98
99
<!DOCTYPE html>
<html>
<head>
<!-- Responsive -->
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width,
initial-scale=1"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- Title -->
<title>PWA Roam</title>
<!-- Meta Tags required for
Progressive Web App -->
<meta name="apple-mobile-web-app-status-bar" content="#aa7700" />
<meta name="theme-color" content="black" />
<!-- Manifest File link -->
<link rel="manifest" href="manifest.json" />
<style>
body {}
.wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
.todo-form input {
width: 400px;
height: 50px;
font-size: medium;
padding: 0 10px;
}
.item-list {
list-style: none;
display: flex;
flex-direction: column;
align-self: flex-center;
width: 512px;
}
.item-list li {
margin-bottom: 4px;
font: 1.3em sans-serif;
color: slategray;
margin-left: 1em;
}
</style>
</head>
<body>
<div class="wrapper">
<h1 style="color: green">Roam</h1>
<form class="todo-form" onsubmit="return addItem('list', this.inputItem)">
<input type="text" name="todo" id="inputItem" placeholder="Enter your task item" onfocus="c" />
</form>
<br />
<ul id="list" class="item-list" >
</ul>
</form>
<script>
window.addEventListener('load', () => {
registerSW();
});
window.resizeTo(512, 512);
// Register the Service Worker
async function registerSW() {
if ('serviceWorker' in navigator) {
try {
await navigator.serviceWorker.register('serviceworker.js');
} catch (e) {
console.log('SW registration failed');
}
}
}
function addItem(list, inputField) {
let task = document.getElementById(list);
let listItem = document.createElement("li");
listItem.innerText = `=> ${inputField.value}`;
task.appendChild(listItem);
var input = document.getElementsByName('todo')[0];
input.value = ''
return false;
}
</script>
</body>
</html>