use insertAdjacentHTML

master
Aevann1 2022-12-07 22:27:22 +02:00
parent 481fdaeced
commit ecda2536ec
3 changed files with 9 additions and 6 deletions

View File

@ -132,8 +132,8 @@ function post_reply(id){
if (data && data["comment"]) {
const comments = document.getElementById('replies-of-c_' + id);
const comment = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '');
comments.innerHTML = comments.innerHTML + comment;
comments.insertAdjacentHTML('beforeend', comment);
bs_trigger(comments);
@ -229,7 +229,7 @@ function post_comment(fullname, wall_user_id, hide){
let comments = document.getElementById('replies-of-' + fullname);
let comment = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '');
comments.insertAdjacentHTML('beforebegin', comment);
comments.insertAdjacentHTML('afterbegin', comment);
bs_trigger(comments);

View File

@ -388,7 +388,8 @@ function update_ghost_div_textarea(text)
if (!ghostdiv) return;
ghostdiv.innerText = text.value.substring(0, text.selectionStart);
ghostdiv.innerHTML += "<span></span>";
ghostdiv.insertAdjacentHTML('beforeend', "<span></span>");
// Now lets get coordinates

View File

@ -56,10 +56,12 @@ async function getGif(searchTerm) {
for (let i = 0; i < 48; i++) {
gifURL[i] = "https://media.giphy.com/media/" + data[i].id + "/giphy.webp";
if (data[i].username==''){
container.innerHTML += ('<div class="card bg-white" style="overflow: hidden" data-bs-dismiss="modal" aria-label="Close" onclick="insertGIF(\'' + 'https://media.giphy.com/media/' + data[i].id + '/giphy.webp' + '\',\'' + commentFormID + '\')"><img loading="lazy" class="img-fluid" src="' + gifURL[i] + '"></div>');
const insert = '<div class="card bg-white" style="overflow: hidden" data-bs-dismiss="modal" aria-label="Close" onclick="insertGIF(\'' + 'https://media.giphy.com/media/' + data[i].id + '/giphy.webp' + '\',\'' + commentFormID + '\')"><img loading="lazy" class="img-fluid" src="' + gifURL[i] + '"></div>'
container.insertAdjacentHTML('beforeend', insert);
}
else {
container.innerHTML += ('<div class="card bg-white" style="overflow: hidden" data-bs-dismiss="modal" aria-label="Close" title="by '+data[i].username+' on GIPHY" onclick="insertGIF(\'' + 'https://media.giphy.com/media/' + data[i].id + '/giphy.webp' + '\',\'' + commentFormID + '\')"><img loading="lazy" class="img-fluid" src="' + gifURL[i] + '"></div>');
const insert = '<div class="card bg-white" style="overflow: hidden" data-bs-dismiss="modal" aria-label="Close" title="by '+data[i].username+' on GIPHY" onclick="insertGIF(\'' + 'https://media.giphy.com/media/' + data[i].id + '/giphy.webp' + '\',\'' + commentFormID + '\')"><img loading="lazy" class="img-fluid" src="' + gifURL[i] + '"></div>'
container.insertAdjacentHTML('beforeend', insert);
}
noGIFs.innerHTML = null;
loadGIFs.innerHTML = '<div class="text-center py-3"><div class="mb-3"><i class="fas fa-grin-beam-sweat text-gray-500" style="font-size: 3.5rem"></i></div><p class="font-weight-bold text-gray-500 mb-0">Thou&#39;ve reached the end of the list!</p></div>';