let commentFormID; function commentForm(form) { commentFormID = form; }; async function getGif(searchTerm) { if (searchTerm !== undefined) { document.getElementById('gifSearch').value = searchTerm; } else { document.getElementById('gifSearch').value = null; } var loadGIFs = document.getElementById('gifs-load-more'); var noGIFs = document.getElementById('no-gifs-found'); var container = document.getElementById('GIFs'); var backBtn = document.getElementById('gifs-back-btn'); var cancelBtn = document.getElementById('gifs-cancel-btn'); container.innerHTML = ''; if (searchTerm == undefined) { container.innerHTML = '
' backBtn.innerHTML = null; cancelBtn.innerHTML = null; noGIFs.innerHTML = null; loadGIFs.innerHTML = null; } else { backBtn.innerHTML = ''; cancelBtn.innerHTML = ''; let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48"); let data = await response.json() var max = data.length - 1 data = data.data var gifURL = []; if (max <= 0) { noGIFs.innerHTML = 'Aw shucks. No GIFs found...
Thou've reached the end of the list!