fix gif modal buttons

pull/83/head
Aevann 2023-01-01 11:47:59 +02:00
parent 424b643678
commit 4480e454f8
2 changed files with 5 additions and 10 deletions

View File

@ -2,8 +2,6 @@ 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;
@ -42,8 +40,6 @@ async function getGifs(form) {
commentFormID = form;
gifSearchBar.value = null;
backBtn.innerHTML = null;
cancelBtn.innerHTML = null;
noGIFs.innerHTML = null;
loadGIFs.innerHTML = null;
@ -133,10 +129,6 @@ async function searchGifs(searchTerm) {
container.innerHTML = '';
backBtn.innerHTML = `<button class="btn btn-link pl-0 pr-3" id="gifs-back-btn" data-nonce="${nonce}" data-onclick="getGifs()"><i class="fas fa-long-arrow-left text-muted ml-3"></i></button>`;
cancelBtn.innerHTML = `<button class="btn btn-link pl-3 pr-0" id="gifs-cancel-btn" data-nonce="${nonce}" data-onclick="getGifs()"><i class="fas fa-times text-muted"></i></button>`;
let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48");
let data = await response.json()
const max = data.length - 1
@ -158,3 +150,6 @@ async function searchGifs(searchTerm) {
}
}
}
document.getElementById('gifs-back-btn').onclick = getGifs;
document.getElementById('gifs-cancel-btn').onclick = getGifs;

View File

@ -3,9 +3,9 @@
<div class="modal-content">
<div class="modal-header border-bottom-0 shadow-md p-3">
<div class="form-group d-flex align-items-center w-100 mb-0">
<div id="gifs-back-btn"></div>
<div id="gifs-back-btn"><button class="btn btn-link mx-2" id="gifs-back-btn"><i class="fas fa-long-arrow-left text-muted"></i></button></div>
<input autocomplete="off" type="text" class="form-control" id="gifSearch" placeholder="Search and press enter" data-nonce="{{g.nonce}}" data-onchange="searchGifs()">
<div id="gifs-cancel-btn"></div>
<div id="gifs-cancel-btn"><button class="btn btn-link mx-2" id="gifs-cancel-btn"><i class="fas fa-times text-muted"></i></button></div>
</div>
</div>
<div style="overflow-y: auto;">