diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js index da5bd62676..00c56d039b 100644 --- a/files/assets/js/gif_modal.js +++ b/files/assets/js/gif_modal.js @@ -1,5 +1,4 @@ const gifSearchBar = document.getElementById('gifSearch') -const loadGIFs = document.getElementById('gifs-load-more'); const noGIFs = document.getElementById('no-gifs-found'); const container = document.getElementById('GIFs'); @@ -25,23 +24,11 @@ document.getElementById('gifModal').addEventListener('shown.bs.modal', function }, 1000); }); -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.innerHTML = null; - loadGIFs.innerHTML = null; + noGIFs.classList.add("d-none"); container.innerHTML = `
Aw shucks. No GIFs found...
'; - container.innerHTML = null; - loadGIFs.innerHTML = null; + if (data.length) { + for (const e of data) { + const url = "https://media.giphy.com/media/" + e.id + "/giphy.webp"; + const insert = `Thou hast reached the end of the list!
'; - } + noGIFs.classList.remove('d-none') } } -document.getElementById('gifs-back-btn').onclick = getGifs; -document.getElementById('gifs-cancel-btn').onclick = getGifs; +gifSearchBar.onchange = ()=>{searchGifs(gifSearchBar.value)}; diff --git a/files/templates/modals/gif.html b/files/templates/modals/gif.html index 366ba9685c..8664a8f73d 100644 --- a/files/templates/modals/gif.html +++ b/files/templates/modals/gif.html @@ -4,22 +4,20 @@Aw shucks. No GIFs found...