2024-05-31 20:32:04 +08:00
|
|
|
<script type="module">
|
|
|
|
const el = document.getElementById('artalk_container');
|
|
|
|
util.viewportLazyload(el, load_twikoo, <%= theme.comments.lazyload ?? false %>);
|
2021-07-18 10:59:37 +08:00
|
|
|
|
2024-05-31 20:32:04 +08:00
|
|
|
function load_twikoo() {
|
|
|
|
if (!el) return;
|
|
|
|
utils.js('<%- theme.comments.twikoo.js %>', {defer: true}).then(function () {
|
|
|
|
const path = el.getAttribute('comment_id');
|
|
|
|
if (!path) {
|
|
|
|
path = decodeURI(window.location.pathname);
|
|
|
|
}
|
|
|
|
twikoo.init(Object.assign(<%- JSON.stringify(theme.comments.twikoo) %>, {
|
|
|
|
el: '#twikoo_container',
|
|
|
|
path: path,
|
|
|
|
}));
|
2021-07-18 10:59:37 +08:00
|
|
|
});
|
2024-05-31 20:32:04 +08:00
|
|
|
}
|
2021-07-18 10:59:37 +08:00
|
|
|
</script>
|