mirror of
https://github.com/seigler/fhqwhgads
synced 2025-07-28 15:26:09 +00:00
added node and grunt stuff, improved cursor and selection handling
This commit is contained in:
parent
e226475f42
commit
edae59d5e7
23 changed files with 487 additions and 114 deletions
15
src/scripts/index.js
Normal file
15
src/scripts/index.js
Normal 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;
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue