aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/index.html
blob: e214d03117d44000651acc473df95720d7c250bb (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
50
51
52
53
54
55
56
57
58
59
<!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>

			const autoSaveFrequency = 1000;
			const editor = document.querySelector('textarea');

			editor.focus();

			if (typeof(Storage) !== 'undefined') {
				editor.value = localStorage.getItem('content');
				setInterval(function() {
					localStorage.setItem('content', editor.value);
				}, autoSaveFrequency);
			} else {
				console.log('Local Storage not supported');
			}

		</script>

	</body>
</html>