Fixed search on mobile/tablet devices

Fixed a research (second search query) not working on mobile & tablet devices.

Also, ensured a blank search gives alert.
This commit is contained in:
FbIN Support 2025-12-20 17:02:55 +05:30
commit 4413387b38

View file

@ -694,10 +694,21 @@ if(searchbox_wrapper.length !== 0){
/* /*
Textarea shortcuts 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){ document.addEventListener("keydown", function(key){
switch(key.keyCode){ switch(key.keyCode){
case 191: case 191:
// 191 = / // 191 = /
if(document.activeElement.tagName == "INPUT"){ if(document.activeElement.tagName == "INPUT"){