24 lines
698 B
Plaintext
24 lines
698 B
Plaintext
<script type="module">
|
|
const el = document.querySelector('#comments #beaudar');
|
|
util.viewportLazyload(el, load_beaudar, <%= theme.comments.lazyload ?? false %>);
|
|
|
|
function load_beaudar() {
|
|
if (!el) return;
|
|
try {
|
|
el.innerHTML = '';
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
const script = document.createElement('script');
|
|
script.src = 'https://beaudar.lipk.org/client.js';
|
|
script.async = true;
|
|
for (const key of Object.keys(el.attributes)) {
|
|
const attr = el.attributes[key];
|
|
if (['class', 'id'].includes(attr.name) === false) {
|
|
script.setAttribute(attr.name, attr.value);
|
|
}
|
|
}
|
|
el.appendChild(script);
|
|
}
|
|
</script>
|