-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
66 lines (55 loc) · 2.23 KB
/
index.html
File metadata and controls
66 lines (55 loc) · 2.23 KB
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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/papercss@1.6.1/dist/paper.min.css">
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<title>Small note</title>
</head>
<body>
<!-- This is a comment -->
<h1>Small note</h1>
<div class="row">
<textarea id="note" contenteditable></textarea>
<div class="col-md-3" style="padding-right: 0px">
<div class="row">
<button onclick="myCallback()">Save</button>
</div>
<div class="row">
<button onclick="document.querySelector('#note').innerHTML = ''">Clear</button>
</div>
</div>
</div>
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>
<script>
const fs = new Filer.FileSystem();
//step 5 for acturally coding...
window.addEventListener("DOMContentLoaded", (event) => {
fs.readFile("/note", 'utf8', function (err, data) {
if (err) {
document.querySelector('#note').innerHTML = "Just type, it will save automatically"
}
if (data) {
document.querySelector('#note').innerHTML = data;
}
});
});
window.setInterval(myCallback, 3000);
function myCallback() {
fs.writeFile('/note', document.querySelector('#note').innerHTML, function (err){
if(err)
console.error('Saving error', err);
});
}
</script>
</body>
</html>