-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
86 lines (75 loc) · 2.03 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebNote | Github Project</title>
<!-- Compressed CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.3/dist/css/foundation.min.css"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Sedgwick+Ave+Display&display=swap" rel="stylesheet">
<style>
body,
h1 {
font-family: 'Sedgwick Ave Display', cursive;
}
html,
body,
.grid-container,
grid-x,
cell {
height: 100%;
margin: 0;
}
.blackside {
color: white;
background: #000000;
height: 100%;
min-height: 300px;
}
</style>
<script src="https://unpkg.com/filer/dist/filer.min.js"></script>
<script>
const fs = new Filer.FileSystem();
let notepad = "";
window.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
fs.readFile('/note', 'utf8', function (err, data) {
if (err) {
notepad = "Welcome to my Notepad";
console.log(err);
fs.writeFile("/note", notepad, function (err) {
if (err) alert(err);
});
} if (data) {
document.getElementById('note').innerHTML = data;
}
});
var div = document.getElementById('note');
div.innerHTML = notepad;
});
let nIntervId = setInterval(saveText, 30000);
function saveText() {
divconttent = document.getElementById('note').innerHTML;
fs.writeFile('/note', divconttent, function (err) {
if (err) {
console.error("Error saving", err);
}
console.log("Saved!");
});
}
</script>
</head>
<body>
<div class="grid-container">
<div class="grid-x grid-margin-x">
<div class="cell small-8" id="note" contenteditable="true" aria-placeholder="Welcome to my Notepad" style="border: 1px rgb(0, 0, 0) solid">
</div>
<div class="cell small-4 blackside">
<h1>Webpad Github App</h1>
</div>
</div>
<button class="btn-secondary" onclick="saveText()">Save Note</button>
</div>
</body>
</html>