Skip to content

Commit

Permalink
Update Artalk.astro
Browse files Browse the repository at this point in the history
  • Loading branch information
jkjoy committed Oct 29, 2024
1 parent dc281c1 commit 4f1e099
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Artalk.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { site, server } = Astro.props;
<link href="https://artalk.loliko.cn/dist/Artalk.css" rel="stylesheet">
<script is:inline src="https://artalk.loliko.cn/dist/Artalk.js"></script>
<div id="Comments"></div>

<script is:inline>
function initializeArtalk(document) {
try {
Expand Down Expand Up @@ -48,8 +49,11 @@ const { site, server } = Astro.props;
});

// 开始观察
observer.observe(document.getElementById('Comments'), {
childList: true,
subtree: true
});
const commentsDiv = document.getElementById('Comments');
if (commentsDiv) {
observer.observe(commentsDiv, {
childList: true,
subtree: true
});
}
</script>

0 comments on commit 4f1e099

Please sign in to comment.