blob: 25254b75c4294c4dc5db701099378f94f367ff20 (
plain)
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
|
<!DOCTYPE html>
<html lang="en">
<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">
<title>Editor</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<style>
textarea {
display: block;
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
padding: 20px;
font: 16px monospace;
outline: none;
border: 0;
background: #333;
color: #fff;
}
</style>
<textarea></textarea>
<script>
if (typeof(Storage) !== 'undefined') {
const autoSaveFrequency = 1000;
const editor = document.querySelector('textarea');
editor.value = localStorage.getItem('content');
setInterval(function() {
localStorage.setItem('content', editor.value);
}, autoSaveFrequency);
} else {
console.log('storage nok');
}
</script>
</body>
</html>
|