修复弹幕逻辑
This commit is contained in:
1 parent
409e70cf30
commit
50d140c32c
123 files changed
+1667
-2071
No files matched your search
@@ -3,9 +3,9 @@
|
||||
<article style="margin-bottom: 3.5em;">
|
||||
<h1 class="post-title" itemprop="name headline">{{ .Title }}</h1>
|
||||
<div class="meta">
|
||||
作者: 小赵同学 浏览: {{ .Params.views }} 字数: {{ .WordCount }} 分类:
|
||||
作者: 小赵同学 浏览: {{ .Params.views }} 字数: {{ .WordCount }} 分类:
|
||||
{{ range .Params.categories }}
|
||||
<a href="{{ . }}">{{ . }}</a>
|
||||
<a href="{{ . }}">{{ . }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="post-content" itemprop="articleBody">
|
||||
@@ -29,22 +29,25 @@
|
||||
</div>
|
||||
{{/* 文章页面评论弹幕 */}}
|
||||
<script>
|
||||
for(let i =0;i<=100;i++){
|
||||
for (let i = 0; i <= 100; i++) {
|
||||
loadBarrager();
|
||||
}
|
||||
function loadBarrager() {
|
||||
// 获取当前页面的路径
|
||||
var currentPath = "{{ .RelPermalink }}";
|
||||
|
||||
// 调用封装的函数
|
||||
fetchCommentsAndCreateBarrager(currentPath, {
|
||||
looper_time: 3000, // 每条弹幕的发送间隔,单位毫秒
|
||||
defaultAvatar: 'static/default-avatar.png', // 默认头像
|
||||
defaultInfo: 'No comment', // 默认评论内容
|
||||
defaultLink: '#', // 默认用户链接
|
||||
speed: 10, // 弹幕速度,单位秒
|
||||
});
|
||||
|
||||
// 只有当 URL 包含 "post" 时才执行弹幕加载逻辑
|
||||
if (currentPath.includes("post") || currentPath.includes("says")) {
|
||||
// 调用封装的函数
|
||||
fetchCommentsAndCreateBarrager(currentPath, {
|
||||
looper_time: 3000, // 每条弹幕的发送间隔,单位毫秒
|
||||
defaultAvatar: 'static/default-avatar.png', // 默认头像
|
||||
defaultInfo: 'No comment', // 默认评论内容
|
||||
defaultLink: '#', // 默认用户链接
|
||||
speed: 10, // 弹幕速度,单位秒
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in new issue
Block a user