autofocus gif search too

pull/83/head
Aevann1 2022-12-20 00:16:06 +02:00
parent a613a190c2
commit 32bc631648
1 changed files with 11 additions and 2 deletions

View File

@ -4,13 +4,15 @@ function commentForm(form) {
commentFormID = form;
};
const gifSearchBar = document.getElementById('gifSearch')
async function getGif(searchTerm) {
if (searchTerm !== undefined) {
document.getElementById('gifSearch').value = searchTerm;
gifSearchBar.value = searchTerm;
}
else {
document.getElementById('gifSearch').value = null;
gifSearchBar.value = null;
}
const loadGIFs = document.getElementById('gifs-load-more');
@ -80,3 +82,10 @@ function insertGIF(url,form) {
if (typeof checkForRequired === "function") checkForRequired();
}
document.getElementById('gifModal').addEventListener('shown.bs.modal', function () {
gifSearchBar.focus();
setTimeout(() => {
gifSearchBar.focus();
}, 200);
});