How to check if user input is from barcode scanner or keyboard javascript