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

18 lines
589 B
Plaintext

<script type="module">
const el = document.getElementById('artalk_container');
util.viewportLazyload(el, load_twikoo, <%= theme.comments.lazyload ?? false %>);
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,
}));
});
}
</script>