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

25 lines
922 B
Plaintext
Raw Normal View History

2022-12-11 14:33:10 +08:00
<script>
function load_artalk() {
if (!document.querySelectorAll("#artalk_container")[0]) return;
stellar.loadCSS('<%- theme.comments.artalk.css %>');
stellar.loadScript('<%- 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);
}
2023-12-30 12:21:01 +08:00
var artalk = Artalk.init({
2022-12-11 14:33:10 +08:00
el: '#artalk_container',
pageKey: path,
pageTitle: '<%= page.title || page.seo_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>