Created
May 10, 2017 17:17
-
-
Save baorv/1dcf272cf56b3a381089747f3e4d424f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var enterInput = document.getElementsByTagName("input")[0]; | |
function getCurrent(){ | |
var current = null; | |
for (i = 0; i < 99; i ++) { | |
current = document.getElementById("nhwMiddlegwt-uid-" + i); | |
if (current != null) break; | |
} | |
return current; | |
} | |
function setCurrent(){ | |
var currentComma = null; | |
for(j = 0; j < 99; j ++){ | |
currentComma = document.getElementById("nhwMiddleCommagwt-uid-" + j); | |
if(currentComma != null) break; | |
} | |
if(currentComma != null){ | |
enterInput.value = getCurrent().innerHTML + currentComma.innerHTML; | |
}else{ | |
enterInput.value = getCurrent().innerHTML; | |
} | |
} | |
setCurrent(); | |
document.addEventListener("keypress", function(e) { | |
if (e.keyCode == 32) setCurrent(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment