don't do anything on enter if input is blank
This commit is contained in:
+4
-1
@@ -170,6 +170,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
searchForm.addEventListener('submit', function(event) {
|
searchForm.addEventListener('submit', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (searchInput.value === '') return false;
|
||||||
|
|
||||||
var redirect = opts.defaultCommand + encodeURIComponent(q);
|
var redirect = opts.defaultCommand + encodeURIComponent(q);
|
||||||
var q = searchInput.value.split(opts.delimiter);
|
var q = searchInput.value.split(opts.delimiter);
|
||||||
|
|
||||||
@@ -186,7 +190,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.location.href = redirect;
|
window.location.href = redirect;
|
||||||
event.preventDefault();
|
|
||||||
}, false);
|
}, false);
|
||||||
})({
|
})({
|
||||||
delimiter: ' ',
|
delimiter: ' ',
|
||||||
|
|||||||
Reference in New Issue
Block a user