const gifSearchBar = document.getElementById('gifSearch') const noGIFs = document.getElementById('no-gifs-found'); const container = document.getElementById('GIFs'); let commentFormID; function insertGIF(url) { const commentBox = document.getElementById(commentFormID); const old = commentBox.value; if (old) commentBox.value = `${old}\n${url}`; else commentBox.value = url if (typeof checkForRequired === "function") checkForRequired(); } document.getElementById('gifModal').addEventListener('shown.bs.modal', function () { gifSearchBar.focus(); setTimeout(() => { gifSearchBar.focus(); }, 200); setTimeout(() => { gifSearchBar.focus(); }, 1000); }); async function getGifs(form) { commentFormID = form; gifSearchBar.value = null; noGIFs.classList.add("d-none"); container.innerHTML = `