use insertAdjacentHTML
parent
481fdaeced
commit
ecda2536ec
|
@ -132,8 +132,8 @@ function post_reply(id){
|
||||||
if (data && data["comment"]) {
|
if (data && data["comment"]) {
|
||||||
const comments = document.getElementById('replies-of-c_' + id);
|
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, '');
|
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);
|
bs_trigger(comments);
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ function post_comment(fullname, wall_user_id, hide){
|
||||||
let comments = document.getElementById('replies-of-' + fullname);
|
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, '');
|
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);
|
bs_trigger(comments);
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,8 @@ function update_ghost_div_textarea(text)
|
||||||
if (!ghostdiv) return;
|
if (!ghostdiv) return;
|
||||||
|
|
||||||
ghostdiv.innerText = text.value.substring(0, text.selectionStart);
|
ghostdiv.innerText = text.value.substring(0, text.selectionStart);
|
||||||
ghostdiv.innerHTML += "<span></span>";
|
|
||||||
|
ghostdiv.insertAdjacentHTML('beforeend', "<span></span>");
|
||||||
|
|
||||||
// Now lets get coordinates
|
// Now lets get coordinates
|
||||||
|
|
||||||
|
|
|
@ -56,10 +56,12 @@ async function getGif(searchTerm) {
|
||||||
for (let i = 0; i < 48; i++) {
|
for (let i = 0; i < 48; i++) {
|
||||||
gifURL[i] = "https://media.giphy.com/media/" + data[i].id + "/giphy.webp";
|
gifURL[i] = "https://media.giphy.com/media/" + data[i].id + "/giphy.webp";
|
||||||
if (data[i].username==''){
|
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 {
|
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;
|
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've reached the end of the list!</p></div>';
|
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've reached the end of the list!</p></div>';
|
||||||
|
|
Loading…
Reference in New Issue