hexo-theme-stellar/layout/_partial/comments/twikoo/script.ejs

18 lines
589 B
Plaintext
Raw Normal View History

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 %>);
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,
}));
});
2024-05-31 20:32:04 +08:00
}
</script>