2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<!DOCTYPE html>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<html lang="en">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<head>
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-02 15:24:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<title>Jody's Notes</title>
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-05 13:09:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<meta http-equiv="cache-control" content="max-age=0" />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<meta http-equiv="cache-control" content="no-cache" />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<meta http-equiv="expires" content="0" />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<meta http-equiv="pragma" content="no-cache" />
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<link rel="stylesheet" href="lib/codemirror.css">
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<link rel="stylesheet" href="addon/dialog/dialog.css">
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script src="lib/codemirror.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-05 13:59:59 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<script src="addon/selection/active-line.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<script src="addon/dialog/dialog.js"></script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script src="addon/search/searchcursor.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script src="mode/markdown/markdown.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 19:24:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<script src="addon/edit/matchbrackets.js"></script>
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script src="keymap/vim.js"></script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<style type="text/css">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .CodeMirror {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        border: 1px solid #eee;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        height: auto;
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-05 13:59:59 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        border-top: 1px solid black;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        border-bottom: 1px solid black;
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</style>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</head>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<body>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<form><textarea id="editor" name="editor">
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-18 16:51:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{{{notetxt}}}
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</textarea></form>
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								<div style="font-size: 13px; width: 300px; height: 30px;">Key buffer: <span id="command-display"></span></div>
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        mode:  "markdown",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        lineNumbers: "true",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        keyMap: "vim",
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 19:24:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        matchBrackets: true,
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        showCursorWhenSelecting: true,
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-01 13:03:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        viewportMargin: Infinity,
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-05 13:59:59 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        tabSize: 4,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        styleActiveLine: true
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // Add my .vimrc stuff.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    CodeMirror.Vim.map('jj', '<Esc>', 'insert')
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 19:24:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // Hacked semi-colon/colon swap remap into /assets/keymap/vim.js...kind of a heavy hammer might bite me later.
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 21:44:20 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // ...and it's already confused me later the same day. I deleted ~/notes.kaplon.us/CodeMirror w/out realizing I'd symlinked it into /assets!
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-09 09:23:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // This no worky, there's no concept of <leader> in CodeMirror, but i was hoping this would work-around it.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    //CodeMirror.Vim.map(' c', '<Esc>o- [ ] ', 'normal')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    //CodeMirror.Vim.map(' x', '<ESC>;s/\[\s\]/[x]/g<CR>;noh<CR>', 'normal')
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    //CodeMirror.commands.save = function(){ alert("Saving"); }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    var commandDisplay = document.getElementById('command-display');
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    var keys = ''
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    CodeMirror.on(editor, 'vim-keypress', function(key) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        keys = keys + key
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 19:24:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        commandDisplay.innerHTML = keys;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    CodeMirror.on(editor, 'vim-command-done', function(e) {
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-28 19:24:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        keys = '';
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        commandDisplay.innerHTML = keys;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    var typingTimer;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    editor.on("changes", function() {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        clearTimeout(typingTimer);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        typingTimer = setTimeout(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        function() {
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-27 13:39:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            //console.log(editor.getValue());
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-18 16:51:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           var request = new XMLHttpRequest();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            request.onreadystatechange = function () {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                var DONE = this.DONE || 4;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                if (this.readyState === DONE){
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-18 18:03:22 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    console.log('ajax is done.');
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-18 16:51:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            };
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            request.open('POST', '/', true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            request.send(editor.getValue()); 
							 | 
						
					
						
							
								
									
										
										
										
											2016-02-16 17:52:38 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        },
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        2000
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      );
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    });
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</script>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</body>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</html>
							 |