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

25 lines
888 B
Plaintext

<script>
function load_artalk() {
if (!document.querySelectorAll("#artalk_container")[0]) return;
utils.css('<%- theme.comments.artalk.css %>');
utils.js('<%- theme.comments.artalk.js %>', {defer: true}).then(function () {
const el = document.getElementById("artalk_container");
var path = el.getAttribute('comment_id');
if (!path) {
path = decodeURI(window.location.pathname);
}
var artalk = Artalk.init({
el: '#artalk_container',
pageKey: path,
pageTitle: '<%= page.title %>',
server: '<%= theme.comments.artalk.server %>',
placeholder: '<%= theme.comments.artalk.placeholder %>',
site: "<%- config.title %>",
darkMode: '<%= theme.comments.artalk.darkMode %>'
})
});
}
window.addEventListener('DOMContentLoaded', (event) => {
load_artalk();
});
</script>