2024-05-31 20:32:04 +08:00
|
|
|
<script type="module">
|
|
|
|
const el = document.getElementById('artalk_container');
|
|
|
|
util.viewportLazyload(el, load_artalk, <%= theme.comments.lazyload ?? false %>);
|
|
|
|
|
2022-12-11 14:33:10 +08:00
|
|
|
function load_artalk() {
|
2024-05-31 20:32:04 +08:00
|
|
|
if (!el) return;
|
2024-02-12 23:07:56 +08:00
|
|
|
utils.css('<%- theme.comments.artalk.css %>');
|
|
|
|
utils.js('<%- theme.comments.artalk.js %>', {defer: true}).then(function () {
|
2024-06-16 22:30:38 +08:00
|
|
|
const path = el.getAttribute('comment_id') ?? decodeURI(window.location.pathname);
|
2024-05-31 20:32:04 +08:00
|
|
|
const artalk = Artalk.init({
|
2022-12-11 14:33:10 +08:00
|
|
|
el: '#artalk_container',
|
|
|
|
pageKey: path,
|
2024-01-18 12:33:12 +08:00
|
|
|
pageTitle: '<%= page.title %>',
|
2022-12-11 14:33:10 +08:00
|
|
|
server: '<%= theme.comments.artalk.server %>',
|
|
|
|
placeholder: '<%= theme.comments.artalk.placeholder %>',
|
2024-05-09 20:59:55 +08:00
|
|
|
site: "<%- config.title %>",
|
2022-12-11 14:33:10 +08:00
|
|
|
darkMode: '<%= theme.comments.artalk.darkMode %>'
|
|
|
|
});
|
2024-05-31 20:32:04 +08:00
|
|
|
});
|
2022-12-11 14:33:10 +08:00
|
|
|
}
|
|
|
|
</script>
|