added node and grunt stuff, improved cursor and selection handling

This commit is contained in:
Joshua Seigler 2014-12-20 14:02:54 -05:00
parent e226475f42
commit edae59d5e7
23 changed files with 487 additions and 114 deletions

15
build/application.js Normal file
View file

@ -0,0 +1,15 @@
(function() {
function syncTyping() {
var beforeSelection, selection, afterSelection;
beforeSelection = this.value.slice(0, this.selectionStart);
selection = this.value.slice(this.selectionStart, this.selectionEnd);
afterSelection = this.value.slice(this.selectionEnd);
document.getElementById("typing").innerHTML = beforeSelection + (this.selectionStart == this.selectionEnd ? "<span id='cursor'></span>" : "") + "<span id='selection'>" + selection + "</span>" + afterSelection;
}
var commandline = document.getElementById("command");
commandline.value = "";
commandline.focus();
commandline.onkeydown = syncTyping;
commandline.onkeyup = syncTyping;
commandline.onselect = syncTyping;
})();