forked from eekbatani/micro-note
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (40 loc) · 1.37 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Micro-Note</title>
<meta name="description" content="Micro-Note">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="https://unpkg.com/papercss@1.6.1/dist/paper.min.css">
</head>
<body style="margin-left: 10%; margin-right: 10%;">
<h1>DPS909 Lab 2</h1>
<h2> Micro-Note </h2>
<div class="card" style="width: 85%;">
<div class="card-body">
<h4 class="card-title">Type Your Notes in Below</h4>
<p class="card-text">
<div id="note" contenteditable></div>
</p>
</div>
</div>
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>
<script>const
fs = new Filer.FileSystem();
document.addEventListener('DOMContentLoaded', (event) => {
fs.readFile('/note', 'utf8', function(err, data) {
if(err != null || data == null){
data = "Welcome to my notepad!"
}
document.querySelector('#note').innerHTML = data;
});
});
var saveFile = function(){
fs.writeFile('/note', document.querySelector('#note').innerHTML, function (err) {
if (err) throw err;
});
}
var interval = window.setInterval(saveFile, 3000);
</script>
</body>
</html>