Rework AJQuery to $_ to not interfere with jQuery

This commit is contained in:
Francis Lavoie 2023-11-19 07:11:21 -05:00
parent babfa3a7c0
commit 36841d57d4
No known key found for this signature in database
GPG key ID: 0F66EE1687682239
13 changed files with 57 additions and 57 deletions

View file

@ -6,28 +6,28 @@ const resp = fetch("/resources/testimonials.json").then(async resp => {
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}"`;
$_('.testimonial-picture', tpl).src = testimonial.picture || "";
$_('.testimonial-quote', tpl).innerText = `"${testimonial.quote}"`;
if (testimonial.username) {
$('.testimonial-name', tpl).innerText = ` @${testimonial.username}`;
$_('.testimonial-name', tpl).innerText = ` @${testimonial.username}`;
} else {
$('.testimonial-name', tpl).innerText = testimonial.name || "";
$_('.testimonial-name', tpl).innerText = testimonial.name || "";
}
$('.testimonial-role', tpl).innerText = testimonial.role || "";
$_('.testimonial-role', tpl).innerText = testimonial.role || "";
if (testimonial.org) {
$('.testimonial-role', tpl).appendChild(document.createElement("br"));
$('.testimonial-role', tpl).appendChild(document.createTextNode(testimonial.org));
$_('.testimonial-role', tpl).appendChild(document.createElement("br"));
$_('.testimonial-role', tpl).appendChild(document.createTextNode(testimonial.org));
}
$(`.testimonial-col:nth-child(${i%3 + 1})`).append(tpl);
$_(`.testimonial-col:nth-child(${i%3 + 1})`).append(tpl);
}
on('mouseover', '.rollover', e => {
const target = e.target.closest('.rollover') || e.target;
$$(`.${target.dataset.rollover}`).forEach(elem => elem.classList.add('show'));
$$_(`.${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'));
$$_(`.${target.dataset.rollover}`).forEach(elem => elem.classList.remove('show'));
});
});
});