diff --git a/static/client.js b/static/client.js index 5935f92..3206eff 100644 --- a/static/client.js +++ b/static/client.js @@ -694,10 +694,21 @@ if(searchbox_wrapper.length !== 0){ /* Textarea shortcuts */ + // Auto submit on enter for touch devices + const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; + if(isTouchDevice) { + document.addEventListener("change", function(key){ + if(searchbox.value !== ""){ + submit(form); + } else { + alert("Please fill out the search query."); + searchbox.focus(); + } + }) + }; + document.addEventListener("keydown", function(key){ - switch(key.keyCode){ - case 191: // 191 = / if(document.activeElement.tagName == "INPUT"){