2023-10-10 12:03:33 -06:00
|
|
|
const resp = fetch("/resources/testimonials.json").then(async resp => {
|
|
|
|
const testimonials = await resp.json();
|
2023-10-07 16:43:39 -06:00
|
|
|
console.log(testimonials);
|
2023-10-10 12:03:33 -06:00
|
|
|
|
|
|
|
ready(function() {
|
|
|
|
for (let i = 0; i < testimonials.length; i++) {
|
|
|
|
const testimonial = testimonials[i];
|
|
|
|
const tpl = cloneTemplate('#tpl-testimonial');
|
|
|
|
$('.testimonial-picture', tpl).src = testimonial.picture || "";
|
|
|
|
$('.testimonial-quote', tpl).innerText = `"${testimonial.quote}"`;
|
2023-10-26 22:24:46 -06:00
|
|
|
if (testimonial.username) {
|
|
|
|
$('.testimonial-name', tpl).innerText = ` @${testimonial.username}`;
|
|
|
|
} else {
|
|
|
|
$('.testimonial-name', tpl).innerText = testimonial.name || "";
|
|
|
|
}
|
2023-10-10 12:03:33 -06:00
|
|
|
$('.testimonial-role', tpl).innerText = testimonial.role || "";
|
2023-10-26 22:24:46 -06:00
|
|
|
if (testimonial.org) {
|
|
|
|
$('.testimonial-role', tpl).appendChild(document.createElement("br"));
|
|
|
|
$('.testimonial-role', tpl).appendChild(document.createTextNode(testimonial.org));
|
|
|
|
}
|
2023-10-10 12:03:33 -06:00
|
|
|
$(`.testimonial-col:nth-child(${i%3 + 1})`).append(tpl);
|
|
|
|
}
|
2023-11-08 17:40:38 -07:00
|
|
|
|
|
|
|
on('mouseover', '.rollover', e => {
|
|
|
|
const target = e.target.closest('.rollover') || e.target;
|
|
|
|
$$(`.${target.dataset.rollover}`).forEach(elem => elem.classList.add('show'));
|
|
|
|
});
|
|
|
|
on('mouseout', '.rollover', e => {
|
|
|
|
const target = e.target.closest('.rollover') || e.target;
|
|
|
|
$$(`.${target.dataset.rollover}`).forEach(elem => elem.classList.remove('show'));
|
|
|
|
});
|
2023-10-10 12:03:33 -06:00
|
|
|
});
|
|
|
|
});
|