-
Notifications
You must be signed in to change notification settings - Fork 2
/
notebook.html
executable file
·50 lines (50 loc) · 2.96 KB
/
notebook.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notebook</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.css">
<style>
html,body{height:100%;width:100%;margin:0;padding:0;overflow:hidden}
textarea { visibility:hidden; }
.CodeMirror {height:100%}
.navbar {margin-bottom:0;}
::selection{background:#7D7}
::-moz-selection{background:#7D7}
</style>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Notebook</a>
</div>
<ul class="nav navbar-nav">
<!-- TODO: make this add another localStorage item for another 'page' of notes <li><a href="#add" class="add"><i class="glyphicon glyphicon-plus"></i></a></li> -->
</ul>
</div>
</nav>
<textarea placeholder="Type here, see it here..." id="notepad"></textarea>
<script>
$(function(){
var textArea = document.getElementById('notepad');
textArea.value = localStorage.getItem("notepad");
var notepad = CodeMirror.fromTextArea(textArea, {lineNumbers: true, readOnly: false});
notepad.on("changes", function(changeObj) {
changeObj.save();
localStorage.setItem("notepad", changeObj.getTextArea().value);
});
$('.navbar').on('click', function(evt) {
if (evt.target.classList.contains('add')) {
console.log('add localStorage item for new page of notes');
}
});
});
</script>
</body>
</html>