Not tested this at all, I bet there is a bug or two... not sure why you need GM though
var lastKeyTime=new Date();
var low_threshold = 10; //assuming milliseconds, keys required to be input with this much or less time between them
var high_threshold = 250; //assuming
milliseconds between barcode reads, to reset the system if they wait long enough
<input id="myfield" type="text" onkeyup="return barcodeonkeyup(event)" />
In your keyup listener (use document.getElementById('myfield').addEventListener('keyup',barcodeonkeyup,false);
function barcodeonkeyup(ev){
var keytimediference=new Date() - lastKeyTime;
if(keytimediference >
low_threshold && keytimediference < high_threshold ){
// must be a keyboard input, clear your text field
// document.getElementById('myfield').value="";
ev.preventDefault()
return false;
}
lastKeyTime=new Date();
}