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

20 lines
709 B
Plaintext
Raw Normal View History

<script>
function load_twikoo() {
if (!document.querySelectorAll("#twikoo_container")[0]) return;
2024-02-12 23:07:56 +08:00
utils.js('<%- theme.comments.twikoo.js %>', {defer: true}).then(function () {
const el = document.getElementById("twikoo_container");
var 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,
}));
});
}
window.addEventListener('DOMContentLoaded', (event) => {
load_twikoo();
});
</script>