mirror of
https://github.com/MCKero6423/fuwari.git
synced 2026-10-02 03:15:35 +00:00
feat: 文章页集成洪墨AI摘要插件 (适配 Swup 延迟加载)
- 在文章详情页底部引入 TianliGPT 脚本与样式 - 配置选择器为 .markdown-content 并将摘要字数提升至 700 - 引入 300ms 延时与脚本重载逻辑,解决 Swup 页面切换后新文章摘要无法加载的问题 - 优化代码结构与缩进格式
This commit is contained in:
1 parent
5ecbf97c49
commit
bf8b8c8c19
1 file changed
+5
-5
@@ -136,18 +136,18 @@ const jsonLd = {
|
||||
</div>}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="hongmo-ai-container mt-4">
|
||||
<link rel="stylesheet" href="https://ai.zhheo.com/static/public/tianli_gpt.min.css">
|
||||
|
||||
<script is:inline>
|
||||
// 1. 设置参数
|
||||
var tianliGPT_postSelector = '.markdown-content';
|
||||
var tianliGPT_wordLimit = 700; // 已调整为 700,摘要内容会更丰富
|
||||
var tianliGPT_wordLimit = 700;
|
||||
var tianliGPT_Title = '智能摘要';
|
||||
var tianliGPT_key = 'S-HMJ7UXQGBIAZ0U8Q';
|
||||
|
||||
// 2. 暴力重载脚本 (解决 Swup 切换不显示的问题)
|
||||
(function() {
|
||||
// 延迟 300ms 执行,确保 Swup 切换后新内容已就绪
|
||||
setTimeout(function() {
|
||||
var oldScript = document.getElementById('tianli-gpt-script');
|
||||
if (oldScript) { oldScript.remove(); }
|
||||
|
||||
@@ -157,7 +157,7 @@ const jsonLd = {
|
||||
script.async = true;
|
||||
|
||||
document.body.appendChild(script);
|
||||
})();
|
||||
}, 300);
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user