2024-05-31 20:32:04 +08:00
|
|
|
<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);
|
2021-07-23 23:44:25 +08:00
|
|
|
}
|
2024-05-31 20:32:04 +08:00
|
|
|
}
|
|
|
|
el.appendChild(script);
|
2021-07-23 12:10:24 +08:00
|
|
|
}
|
|
|
|
</script>
|