2021-07-18 10:59:37 +08:00
|
|
|
<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 () {
|
2021-07-18 10:59:37 +08:00
|
|
|
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>
|