hexo-theme-solitude 1.8.4 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ case theme.display_mode.type
11
11
  } else {
12
12
  document.documentElement.setAttribute('data-theme', cachedMode);
13
13
  }
14
- right_menu && rm.mode(cachedMode === 'dark' && isDarkMode)
14
+ is_rm && rm.mode(cachedMode === 'dark' && isDarkMode)
15
15
  }
16
16
  initTheme()
17
17
  when "dark"
@@ -22,7 +22,7 @@ case theme.display_mode.type
22
22
  document.documentElement.setAttribute('data-theme', 'dark');
23
23
  else
24
24
  document.documentElement.setAttribute('data-theme', cachedMode);
25
- right_menu && rm.mode(cachedMode === undefined || cachedMode === 'dark')
25
+ is_rm && rm.mode(cachedMode === undefined || cachedMode === 'dark')
26
26
  }
27
27
  initTheme()
28
28
  when "light"
@@ -33,6 +33,6 @@ case theme.display_mode.type
33
33
  document.documentElement.setAttribute('data-theme', 'light');
34
34
  else
35
35
  document.documentElement.setAttribute('data-theme', cachedMode);
36
- right_menu && rm.mode(cachedMode === 'dark')
36
+ is_rm && rm.mode(cachedMode === 'dark')
37
37
  }
38
38
  initTheme()
@@ -26,7 +26,7 @@
26
26
 
27
27
  let comment = false
28
28
 
29
- if (theme.comment.use) {
29
+ if (theme.comment.use && theme.comment.commentBarrage) {
30
30
  comment = {
31
31
  avatar: theme.comment.avatar,
32
32
  commentBarrage: theme.comment.commentBarrage,
@@ -6,4 +6,5 @@ script#config-diff.
6
6
  page: '!{page.type}',
7
7
  toc: !{!!page.toc},
8
8
  comment: !{!!page.comment},
9
+ ai_text: !{is_post && page.ai_text ? "'"+ page.ai_text+"'" : false},
9
10
  }
@@ -24,7 +24,7 @@ div
24
24
  script.
25
25
  dark()
26
26
 
27
- if theme.right_menu.translate.enable
27
+ if theme.right_menu.enable && theme.right_menu.translate.enable
28
28
  script(src=url_for(theme.cdn.translate_js))
29
29
 
30
30
  if theme.katex && theme.katex.enable
@@ -93,8 +93,12 @@ div
93
93
  carousel_swiper()
94
94
  if page.type === 'says' && theme.says.enable
95
95
  script.
96
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
97
- sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time'))
96
+ setTimeout(() => {
97
+ sco.refreshWaterFall();
98
+ GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
99
+ GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
100
+ sco.changeTimeFormat(document.querySelectorAll('.info time'));
101
+ }, 500)
98
102
  if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv)
99
103
  script(async src=url_for(theme.cdn.busuanzi_js))
100
104
 
@@ -28,7 +28,7 @@ if theme.pwa.enable
28
28
 
29
29
  script.
30
30
  console.log(
31
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.4",
31
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.8.5",
32
32
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
33
33
  "padding: 5px 10px;color:white;background:#3e9f50;",
34
34
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -59,7 +59,7 @@ div#rightMenu
59
59
  if theme.right_menu.commentBarrage && theme.comment.use && theme.comment.commentBarrage
60
60
  div.rightMenu-item#menu-commentBarrage(onclick="sco.switchCommentBarrage()")
61
61
  i.solitude.st-chat-fill
62
- span.menu-commentBarrage-text= _p('right_menu.barrage.open')
62
+ span.menu-commentBarrage-text= _p('right_menu.barrage.close')
63
63
  div.rightMenu-item#menu-darkmode(onclick="sco.switchDarkMode()")
64
64
  i.solitude.st-moon-clear-fill
65
65
  case theme.display_mode.type
@@ -1,3 +1,4 @@
1
+ - const {copyright} = theme.post.default
1
2
  .post-copyright
2
3
  .post-copyright__author_group
3
4
  a.post-copyright__author_img(href=url_for("/about/"))
@@ -14,7 +15,7 @@
14
15
  a.reward-link-button(href=url_for(theme.post.rss))
15
16
  i.solitude.st-plant-fill
16
17
  = _p('footer.rss')
17
- if theme.post.default.copyright.enable || page.copyright
18
+ if copyright.enable || page.copyright
18
19
  .post-copyright__notice
19
20
  span.post-copyright-info
20
21
  if page.reprint
@@ -24,4 +25,4 @@
24
25
  a(href=url_for(theme.post.default.copyright.licenurl))
25
26
  | #{theme.post.default.copyright.license}
26
27
  = _p('post.copyright.original_end')
27
- a(href=url_for("/")) #{config.title}
28
+ a(href=url_for("/")) #{config.title}
@@ -33,6 +33,8 @@ script().
33
33
  body: '.OwO-body',
34
34
  item: '.OwO-items li'
35
35
  })
36
+
37
+ barrageTwikoo()
36
38
  }
37
39
 
38
40
  const loadTwikoo = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the efu.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -100,7 +100,6 @@
100
100
  user-select none
101
101
 
102
102
  +maxWidth768()
103
- background linear-gradient(to top, var(--efu-main-none) 0, var(--efu-main) 100%)
104
103
  transition 0s
105
104
 
106
105
  +maxWidth1400()
@@ -131,6 +131,9 @@ if hexo-config('index_post_list.direction') == "column"
131
131
  font-size 14px
132
132
  line-height 1.8
133
133
 
134
+ +maxWidth600()
135
+ -webkit-line-clamp 1
136
+
134
137
  span.tags-punctuation
135
138
  transition .3s
136
139
 
@@ -353,6 +356,8 @@ else if hexo-config('index_post_list.direction') == "row"
353
356
  line-height 1.8
354
357
  +maxWidth768()
355
358
  -webkit-line-clamp 2
359
+ +maxWidth600()
360
+ -webkit-line-clamp 1
356
361
 
357
362
  span.tags-punctuation
358
363
  transition .3s
@@ -3,7 +3,7 @@
3
3
  bottom 0
4
4
  right 20px
5
5
  padding 0 0 20px 10px
6
- display flex
6
+ display none
7
7
  flex-direction column
8
8
  justify-content flex-end
9
9
  z-index 999
package/source/js/main.js CHANGED
@@ -36,10 +36,10 @@ const sidebarFn = () => {
36
36
 
37
37
  const scrollFn = function () {
38
38
  const innerHeight = window.innerHeight;
39
- const $header = document.getElementById('page-header');
40
- if (!$header || document.body.scrollHeight <= innerHeight) return;
39
+ if (document.body.scrollHeight <= innerHeight) return;
41
40
 
42
41
  let initTop = 0;
42
+ const $header = document.getElementById('page-header');
43
43
  window.addEventListener('scroll', utils.throttle(function (e) {
44
44
  const currentTop = window.scrollY || document.documentElement.scrollTop;
45
45
  const isDown = scrollDirection(currentTop);
@@ -52,7 +52,9 @@ const scrollFn = function () {
52
52
  }
53
53
  $header.classList.add('nav-fixed');
54
54
  } else {
55
+ if (currentTop ===0){
55
56
  $header.classList.remove('nav-fixed', 'nav-visible');
57
+ }
56
58
  }
57
59
  }, 200));
58
60
 
@@ -215,7 +217,7 @@ class toc {
215
217
 
216
218
  let lastSayHello = "";
217
219
  let wleelw_musicPlaying = false
218
- let right_menu = false
220
+ let is_rm = typeof rm !== 'undefined'
219
221
 
220
222
  let sco = {
221
223
  hideCookie: function () {
@@ -257,10 +259,10 @@ let sco = {
257
259
  $console.classList.toggle("on", wleelw_musicPlaying);
258
260
  if (wleelw_musicPlaying) {
259
261
  $meting.aplayer.play();
260
- right_menu && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.stop) && ($rm_icon.className = 'solitude st-pause-fill')
262
+ rm?.menuItems.music[0] && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.stop) && ($rm_icon.className = 'solitude st-pause-fill')
261
263
  } else {
262
264
  $meting.aplayer.pause();
263
- right_menu && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.start) && ($rm_icon.className = 'solitude st-play-fill')
265
+ rm?.menuItems.music[0] && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.start) && ($rm_icon.className = 'solitude st-play-fill')
264
266
  }
265
267
  },
266
268
  switchCommentBarrage: function () {
@@ -270,18 +272,18 @@ let sco = {
270
272
  commentBarrageElement.style.display = "none";
271
273
  document.querySelector("#consoleCommentBarrage").classList.remove("on");
272
274
  utils.saveToLocal.set("commentBarrageSwitch", false, .2);
273
- right_menu && rm.barrage(true)
275
+ rm?.menuItems.barrage && rm.barrage(true)
274
276
  } else {
275
277
  commentBarrageElement.style.display = "flex";
276
278
  document.querySelector("#consoleCommentBarrage").classList.add("on");
277
279
  utils.saveToLocal.set("commentBarrageSwitch", true, .2);
278
- right_menu && rm.barrage(false)
280
+ rm?.menuItems.barrage && rm.barrage(false)
279
281
  }
280
282
  }
281
283
  },
282
284
  switchHideAside: function () {
283
285
  const htmlClassList = document.documentElement.classList;
284
- htmlClassList.contains("hide-aside") ? utils.saveToLocal.set("aside-status", "show", 1) : saveToLocal.set("aside-status", "hide", 1)
286
+ htmlClassList.contains("hide-aside") ? utils.saveToLocal.set("aside-status", "show", 1) : utils.saveToLocal.set("aside-status", "hide", 1)
285
287
  htmlClassList.toggle("hide-aside");
286
288
  htmlClassList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on");
287
289
  },
@@ -319,12 +321,12 @@ let sco = {
319
321
  document.documentElement.setAttribute('data-theme', 'dark')
320
322
  utils.saveToLocal.set('theme', 'dark', 0.02);
321
323
  utils.snackbarShow(GLOBAL_CONFIG.lang.theme.dark, false, 2000)
322
- right_menu && rm.mode(true)
324
+ is_rm && rm.mode(true)
323
325
  } else {
324
326
  document.documentElement.setAttribute('data-theme', 'light')
325
327
  utils.saveToLocal.set('theme', 'light', 0.02);
326
328
  utils.snackbarShow(GLOBAL_CONFIG.lang.theme.light, false, 2000)
327
- right_menu && rm.mode(false)
329
+ is_rm && rm.mode(false)
328
330
  }
329
331
  handleThemeChange(nowMode)
330
332
  },
@@ -351,7 +353,7 @@ let sco = {
351
353
  el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.day)
352
354
  },
353
355
  toTalk: function (txt) {
354
- const inputs = ["#wl-edit", ".el-textarea__inner", "#veditor",".atk-textarea"]
356
+ const inputs = ["#wl-edit", ".el-textarea__inner", "#veditor", ".atk-textarea"]
355
357
  for (let i = 0; i < inputs.length; i++) {
356
358
  let el = document.querySelector(inputs[i])
357
359
  if (el != null) {
@@ -561,16 +563,14 @@ let sco = {
561
563
  });
562
564
  },
563
565
  addNavBackgroundInit: function () {
564
- const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
565
- if (scrollTop !== 0) {
566
- const pageHeader = document.getElementById("page-header");
567
- if (pageHeader) {
568
- pageHeader.classList.add("nav-fixed", "nav-visible");
569
- }
570
- const cookiesWindow = document.getElementById("cookies-window");
571
- if (cookiesWindow) {
572
- cookiesWindow.style.display = 'none';
573
- }
566
+ let e = 0
567
+ , t = 0;
568
+ document.body && (e = document.body.scrollTop),
569
+ document.documentElement && (t = document.documentElement.scrollTop),
570
+ 0 !== (e - t > 0 ? e : t) && (document.getElementById("page-header").classList.add("nav-fixed"), document.getElementById("page-header").classList.add("nav-visible"))
571
+ const cookiesWindow = document.getElementById("cookies-window");
572
+ if (cookiesWindow) {
573
+ cookiesWindow.style.display = 'none';
574
574
  }
575
575
  },
576
576
  initAdjust: function (change = false) {
@@ -811,7 +811,7 @@ const addCopyright = () => {
811
811
  document.body.addEventListener('copy', handleCopy)
812
812
  }
813
813
 
814
- const asideStatus = () =>{
814
+ const asideStatus = () => {
815
815
  const asideStatus = utils.saveToLocal.get('aside-status')
816
816
  if (asideStatus !== undefined) {
817
817
  if (asideStatus === 'hide') {
@@ -883,14 +883,12 @@ window.refreshFn = () => {
883
883
  PAGE_CONFIG.toc && toc.init();
884
884
  (PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) && ((addHighlight()) || tabs.init())
885
885
  PAGE_CONFIG.is_home && showTodayCard()
886
- GLOBAL_CONFIG.covercolor.enable && coverColor()
886
+ GLOBAL_CONFIG.covercolor.enable && setTimeout(coverColor, 0)
887
887
  PAGE_CONFIG.page === "music" && scoMusic.init()
888
888
  GLOBAL_CONFIG.post_ai && PAGE_CONFIG.is_post && efu_ai.init()
889
889
  sco.switchComments()
890
890
  }
891
891
 
892
- utils.addGlobalFn('pjaxComplete', refreshFn, 'refreshFn')
893
-
894
892
  document.addEventListener('DOMContentLoaded', function () {
895
893
  sco.initAdjust()
896
894
  percent()
@@ -26,6 +26,8 @@ const rm = {
26
26
  downloadImg: document.getElementById('menu-downloadimg'),
27
27
  search: document.getElementById('menu-search'),
28
28
  barrage: document.getElementById('menu-commentBarrage'),
29
+ mode: document.getElementById('menu-darkmode'),
30
+ translate: document.getElementById('menu-translate'),
29
31
  music: [
30
32
  toggle = document.getElementById('menu-music-toggle'),
31
33
  back = document.getElementById('menu-music-back'),
@@ -131,11 +133,11 @@ window.oncontextmenu = (ele) => {
131
133
  display = true;
132
134
  rm.menuItems.copy.style.display = 'block';
133
135
  GLOBAL_CONFIG.comment && (rm.menuItems.comment.style.display = 'block');
134
- rm.menuItems.search.style.display = 'block';
136
+ rm.menuItems.search && (rm.menuItems.search.style.display = 'block');
135
137
  } else {
136
138
  rm.menuItems.copy.style.display = 'none';
137
139
  GLOBAL_CONFIG.comment && (rm.menuItems.comment.style.display = 'none');
138
- rm.menuItems.search.style.display = 'none';
140
+ rm.menuItems.search && (rm.menuItems.search.style.display = 'none');
139
141
  }
140
142
 
141
143
  if (link) {
@@ -170,7 +172,7 @@ window.oncontextmenu = (ele) => {
170
172
  display = true;
171
173
  rm.menuItems.music.forEach(item => item.style.display = 'block');
172
174
  } else {
173
- rm.menuItems.music.forEach(item => item.style.display = 'none');
175
+ rm.menuItems.music[0] && rm.menuItems.music.forEach(item => item.style.display = 'none');
174
176
  }
175
177
 
176
178
  Array.from(display ? rm.menuItems.other : rm.menuItems.plugin).forEach(item => item.style.display = 'none');
@@ -219,8 +221,8 @@ window.oncontextmenu = (ele) => {
219
221
  rm.hideRightMenu()
220
222
  })
221
223
 
222
- if(GLOBAL_CONFIG.comment.commentBarrage){
223
- rm.barrage(!utils.saveToLocal.get('commentBarrageSwitch'))
224
+ if(utils.saveToLocal.get('commentBarrageSwitch')!==null){
225
+ rm.menuItems.barrage && rm.barrage(!utils.saveToLocal.get('commentBarrageSwitch'))
224
226
  }
225
227
 
226
228
  rm.menuItems.paste.addEventListener('click', () => rm.pasteText() && rm.hideRightMenu())
@@ -230,4 +232,4 @@ window.oncontextmenu = (ele) => {
230
232
  rm.menuItems.copyImg.addEventListener('click', () => rm.copyImage() && rm.hideRightMenu())
231
233
  }()
232
234
 
233
- right_menu = true
235
+ is_rm = true
@@ -3,4 +3,4 @@
3
3
  * email: o@efu.me
4
4
  * website: https://efu.me
5
5
  */
6
- class efuAI{constructor(){this.root="https://summary.tianli0.top",this.aiTalkMode=!1,this.aiPostExplanation="",this.config=GLOBAL_CONFIG.post_ai,this.scoGPTIsRunning=!1}init(){this.scoGPTIsRunning=!1,this.generate(),this.AIEngine()}getTitleAndContent(){const e=document.getElementById("article-container"),t=document.title,n=e.getElementsByTagName("p"),i=e.querySelectorAll("h1, h2, h3, h4, h5");return(t+" "+Array.from(i).concat(Array.from(n)).map((e=>e.innerText.replace(/https?:\/\/[^\s]+/g,""))).join(" ")).slice(0,1e3)}async generate(){this.aiShowAnimation(this.fetch(document.title,this.getTitleAndContent(),this.config.key))}async fetch(e,t,n){const i=`${this.root}/?content=${encodeURIComponent(t)}&title=${e}&key=${encodeURIComponent(n)}&url=${encodeURIComponent(window.location.href)}`,s=await fetch(i),o=await s.json();return s.ok?(this.aiPostExplanation=o.summary,o.summary):(console.error("Request failed:",o.err_msg),o.err_msg)}aiShowAnimation(e,t=!1){const n=document.querySelector(".ai-explanation"),i=document.querySelector(".ai-tag");if(!n||this.scoGPTIsRunning)return;this.scoGPTIsRunning=!0,this.cleanSuggestions(),i.classList.add("loadingAI"),n.style.display="block",n.innerHTML='生成中...<span class="blinking-cursor"></span>';let s,o,a=!0,c=0,r=!0;const l=new IntersectionObserver((e=>{a=e[0].isIntersecting,a&&requestAnimationFrame(o)}),{threshold:0});e.then((e=>{s=performance.now(),o=()=>{if(c<e.length&&a){const r=performance.now(),g=r-s,h=e.slice(c,c+1),u=/[,。!、?,.!?]/.test(h),m=/[a-zA-Z0-9]/.test(h);g>=(u?100*Math.random()+100:m?10:25)&&(n.innerText=e.slice(0,c+1),s=r,c++,c<e.length?n.innerHTML=e.slice(0,c)+'<span class="blinking-cursor"></span>':(n.innerHTML=e,n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect(),t&&this.createSuggestions())),a&&requestAnimationFrame(o)}},a&&r&&setTimeout((()=>{requestAnimationFrame(o),r=!1}),3e3),l.observe(n)})).catch((e=>{console.error("检索信息失败:",e),n.innerHTML="检索信息失败",n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect()}))}AIEngine(){const e=document.querySelector(".ai-tag");e&&e.addEventListener("click",(()=>{this.scoGPTIsRunning||(this.aiTalkMode=!0,this.aiShowAnimation(Promise.resolve(this.config.talk),!0))}))}cleanSuggestions(){const e=document.querySelector(".ai-suggestions");e?e.innerHTML="":console.error("没有这个元素:'ai-suggestions'")}createSuggestions(){this.aiTalkMode&&(this.cleanSuggestions(),this.createSuggestionItemWithAction("这篇文章讲了什么?",(()=>{""===this.aiPostExplanation?this.generate():this.aiShowAnimation(Promise.resolve(this.aiPostExplanation),!0)})),this.config.randomPost&&this.createSuggestionItemWithAction("带我去看看其他文章",(()=>toRandomPost())),this.aiTalkMode=!0)}createSuggestionItemWithAction(e,t){const n=document.querySelector(".ai-suggestions");if(!n)return void console.error("无法找到具有class为ai-suggestions的元素");const i=document.createElement("div");i.classList.add("ai-suggestions-item"),i.textContent=e,i.addEventListener("click",t),n.appendChild(i)}}const efu_ai=new efuAI;
6
+ class efuAI{constructor(){this.root="https://summary.tianli0.top",this.aiTalkMode=!1,this.aiPostExplanation='',this.config=GLOBAL_CONFIG.post_ai,this.scoGPTIsRunning=!1}init(){this.scoGPTIsRunning=!1;this.aiPostExplanation=PAGE_CONFIG.ai_text?PAGE_CONFIG.ai_text+"":false;if(!this.aiPostExplanation){this.generate()}else{this.aiShowAnimation(Promise.resolve(this.aiPostExplanation))}this.AIEngine()}getTitleAndContent(){const e=document.getElementById("article-container"),t=document.title,n=e.getElementsByTagName("p"),i=e.querySelectorAll("h1, h2, h3, h4, h5");return(t+" "+Array.from(i).concat(Array.from(n)).map((e=>e.innerText.replace(/https?:\/\/[^\s]+/g,""))).join(" ")).slice(0,1e3)}async generate(){this.aiShowAnimation(this.fetch(document.title,this.getTitleAndContent(),this.config.key))}async fetch(e,t,n){const i=`${this.root}/?content=${encodeURIComponent(t)}&title=${e}&key=${encodeURIComponent(n)}&url=${encodeURIComponent(window.location.href)}`,s=await fetch(i),o=await s.json();return s.ok?(this.aiPostExplanation=o.summary,o.summary):(console.error("Request failed:",o.err_msg),o.err_msg)}aiShowAnimation(e,t=!1){const n=document.querySelector(".ai-explanation"),i=document.querySelector(".ai-tag");if(!n||this.scoGPTIsRunning)return;this.scoGPTIsRunning=!0,this.cleanSuggestions(),i.classList.add("loadingAI"),n.style.display="block",n.innerHTML='生成中...<span class="blinking-cursor"></span>';let s,o,a=!0,c=0,r=!0;const l=new IntersectionObserver((e=>{a=e[0].isIntersecting,a&&requestAnimationFrame(o)}),{threshold:0});e.then((e=>{s=performance.now(),o=()=>{if(c<e.length&&a){const r=performance.now(),g=r-s,h=e.slice(c,c+1),u=/[,。!、?,.!?]/.test(h),m=/[a-zA-Z0-9]/.test(h);g>=(u?100*Math.random()+100:m?10:25)&&(n.innerText=e.slice(0,c+1),s=r,c++,c<e.length?n.innerHTML=e.slice(0,c)+'<span class="blinking-cursor"></span>':(n.innerHTML=e,n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect(),t&&this.createSuggestions())),a&&requestAnimationFrame(o)}},a&&r&&setTimeout((()=>{requestAnimationFrame(o),r=!1}),3e3),l.observe(n)})).catch((e=>{console.error("检索信息失败:",e),n.innerHTML="检索信息失败",n.style.display="block",this.scoGPTIsRunning=!1,i.classList.remove("loadingAI"),l.disconnect()}))}AIEngine(){const e=document.querySelector(".ai-tag");e&&e.addEventListener("click",(()=>{this.scoGPTIsRunning||(this.aiTalkMode=!0,this.aiShowAnimation(Promise.resolve(this.config.talk),!0))}))}cleanSuggestions(){const e=document.querySelector(".ai-suggestions");e?e.innerHTML="":console.error("没有这个元素:'ai-suggestions'")}createSuggestions(){this.aiTalkMode&&(this.cleanSuggestions(),this.createSuggestionItemWithAction("这篇文章讲了什么?",(()=>{""===this.aiPostExplanation?this.generate():this.aiShowAnimation(Promise.resolve(this.aiPostExplanation),!0)})),this.config.randomPost&&this.createSuggestionItemWithAction("带我去看看其他文章",(()=>toRandomPost())),this.aiTalkMode=!0)}createSuggestionItemWithAction(e,t){const n=document.querySelector(".ai-suggestions");if(!n)return void console.error("无法找到具有class为ai-suggestions的元素");const i=document.createElement("div");i.classList.add("ai-suggestions-item"),i.textContent=e,i.addEventListener("click",t),n.appendChild(i)}}const efu_ai=new efuAI;