fix
This commit is contained in:
parent
7e48f5aeb4
commit
4be1f236c4
2 changed files with 37 additions and 23 deletions
|
@ -1,8 +1,23 @@
|
|||
function initializeBootstrap() {
|
||||
// tooltips
|
||||
let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
||||
tooltipTriggerList.map(function(element){
|
||||
return new bootstrap.Tooltip(element);
|
||||
});
|
||||
// popovers
|
||||
let popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
||||
let popoverList = popoverTriggerList.map(function(popoverTriggerEl) {
|
||||
let popoverId = popoverTriggerEl.getAttribute('data-content-id');
|
||||
let contentEl = document.getElementById(popoverId).innerHTML;
|
||||
return new bootstrap.Popover(popoverTriggerEl, {
|
||||
content: contentEl,
|
||||
html: true,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
||||
tooltipTriggerList.map(function(element){
|
||||
return new bootstrap.Tooltip(element);
|
||||
});
|
||||
initializeBootstrap()
|
||||
});
|
||||
|
||||
function post_toast(url, reload, data) {
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
function loadMore() {
|
||||
// const btn = document.getElementById(trigger) // trigger button
|
||||
// const el = document.getElementById(id) // target element to populate
|
||||
// const form = new FormData();
|
||||
// const xhr = new XMLHttpRequest();
|
||||
function loadMore(pid,sort,offset,id,trigger) {
|
||||
const btn = document.getElementById(trigger) // trigger button
|
||||
const el = document.getElementById(id) // target element to populate
|
||||
const form = new FormData();
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
// btn.classList.toggle('animate-pulse');
|
||||
btn.classList.toggle('animate-pulse');
|
||||
|
||||
// xhr.open("post", `/viewmore/${pid}/${sort}/${offset}`);
|
||||
// xhr.withCredentials=true;
|
||||
// xhr.onload=function(){
|
||||
// if (xhr.status==200) {
|
||||
// el.innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, ''); // replace desired element with response html
|
||||
// btn.style.display = "none"; // hide button
|
||||
// initializeBootstrap()
|
||||
// } else {
|
||||
// btn.disabled = false; // enable our button if GET fails
|
||||
// }
|
||||
// }
|
||||
// xhr.send(form)
|
||||
console.log(pid,sort,offset,id,trigger)
|
||||
xhr.open("post", `/viewmore/${pid}/${sort}/${offset}`);
|
||||
xhr.withCredentials=true;
|
||||
xhr.onload=function(){
|
||||
if (xhr.status==200) {
|
||||
el.innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, ''); // replace desired element with response html
|
||||
btn.style.display = "none"; // hide button
|
||||
initializeBootstrap()
|
||||
} else {
|
||||
btn.disabled = false; // enable our button if GET fails
|
||||
}
|
||||
}
|
||||
xhr.send(form)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue