diff --git a/files/assets/css/main.css b/files/assets/css/main.css index df5db7d62f..8aa41d6715 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -4418,10 +4418,6 @@ pre .str, code .str { pre .com, code .com { color: #ab4bc3; } -.gif-categories .card { - overflow: hidden; - border: none; -} .gif-categories img { border-radius: 0.35rem; width: 100%; @@ -6520,3 +6516,9 @@ div.markdown { column-count: 11 !important; } } + +.giphy { + overflow: hidden; + background-color: var(--gray-600); + cursor: pointer; +} diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 515e13776f..6e244c8aeb 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -451,4 +451,6 @@ document.addEventListener("click", function(e){ expandDesktopImage() else if (element.tagName == "TH") sort_table(element) + else if (element.classList.contains('giphy')) + insertGIF(e.target.src); }); diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js index 4a14f0c2e3..f9f6a3f235 100644 --- a/files/assets/js/gif_modal.js +++ b/files/assets/js/gif_modal.js @@ -1,80 +1,14 @@ +const gifSearchBar = document.getElementById('gifSearch') +const loadGIFs = document.getElementById('gifs-load-more'); +const noGIFs = document.getElementById('no-gifs-found'); +const container = document.getElementById('GIFs'); +const backBtn = document.getElementById('gifs-back-btn'); +const cancelBtn = document.getElementById('gifs-cancel-btn'); + let commentFormID; -function commentForm(form) { - commentFormID = form; -}; - -const gifSearchBar = document.getElementById('gifSearch') - -async function getGif(searchTerm) { - - if (searchTerm !== undefined) { - gifSearchBar.value = searchTerm; - } - else { - gifSearchBar.value = null; - } - - const loadGIFs = document.getElementById('gifs-load-more'); - - const noGIFs = document.getElementById('no-gifs-found'); - - const container = document.getElementById('GIFs'); - - const backBtn = document.getElementById('gifs-back-btn'); - - const 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() - const max = data.length - 1 - data = data.data - const gifURL = []; - - if (max <= 0) { - noGIFs.innerHTML = 'Aw shucks. No GIFs found...
Thou've reached the end of the list!
Aw shucks. No GIFs found...
Thou've reached the end of the list!