hexo-theme-solitude 1.4.6 → 1.4.7

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.
Files changed (37) hide show
  1. package/_config.yml +211 -215
  2. package/languages/en-US.yml +5 -2
  3. package/languages/zh-CN.yml +5 -2
  4. package/languages/zh-TW.yml +5 -2
  5. package/layout/404.pug +2 -2
  6. package/layout/includes/head/config.pug +7 -7
  7. package/layout/includes/head/opengraph.pug +5 -4
  8. package/layout/includes/head/pwa.pug +2 -3
  9. package/layout/includes/inject/body.pug +17 -17
  10. package/layout/includes/inject/head.pug +3 -2
  11. package/layout/includes/mixins/pagination.pug +1 -1
  12. package/layout/includes/page/says.pug +44 -7
  13. package/layout/includes/widgets/home/bbTimeList.pug +13 -7
  14. package/layout/includes/widgets/page/banner.pug +8 -13
  15. package/layout/page.pug +0 -2
  16. package/package.json +1 -1
  17. package/scripts/event/init.js +18 -17
  18. package/scripts/event/welcome.js +1 -1
  19. package/scripts/generator/gallery.js +29 -27
  20. package/scripts/helper/getArchiveLength.js +5 -9
  21. package/scripts/helper/related_post.js +28 -39
  22. package/scripts/helper/stylus.js +5 -9
  23. package/source/css/_global/animation.styl +307 -0
  24. package/source/css/_page/index.styl +0 -2
  25. package/source/css/index.styl +0 -1
  26. package/source/js/comment/twikoo_commentBarrage.js +76 -75
  27. package/source/js/covercolor/local.js +11 -10
  28. package/source/js/music.js +89 -49
  29. package/layout/includes/page/rss.pug +0 -20
  30. package/layout/includes/widgets/home/bb/json.pug +0 -25
  31. package/layout/includes/widgets/home/bb/local.pug +0 -20
  32. package/layout/includes/widgets/home/bb/memos.pug +0 -28
  33. package/layout/includes/widgets/page/says/json.pug +0 -82
  34. package/layout/includes/widgets/page/says/local.pug +0 -44
  35. package/layout/includes/widgets/page/says/memos.pug +0 -111
  36. package/source/css/_global/animation.css +0 -813
  37. package/source/css/_page/rss.styl +0 -82
@@ -1,93 +1,135 @@
1
- var vh = window.innerHeight * 1;
2
- var scoMusic = {
3
- // 获取地址栏参数
4
- // 创建URLSearchParams对象并传入URL中的查询字符串
1
+ const scoMusic = {
5
2
  params: new URLSearchParams(window.location.search),
6
- extractValue: function (input) {
7
- var valueRegex = /\("([^\s]+)"\)/g;
8
- var match = valueRegex.exec(input);
3
+ extractValue: (input) => {
4
+ const valueRegex = /\("([^\s]+)"\)/g;
5
+ const match = valueRegex.exec(input);
9
6
  return match[1];
10
7
  },
11
- changeMusicBg: function (isChangeBg = true) {
12
- const MusicBg = document.getElementById("Music-bg")
13
- const MusicLoading = document.getElementsByClassName("Music-loading")
8
+ changeMusicBg: (isChangeBg = true) => {
9
+ const MusicBg = document.getElementById("Music-bg");
10
+ const MusicLoading = document.getElementsByClassName("Music-loading");
14
11
 
15
12
  if (isChangeBg) {
16
13
  const musiccover = document.querySelector("#Music-page .aplayer-pic");
17
- var img = new Image();
14
+ const img = new Image();
18
15
  img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
19
- img.onload = function () {
16
+ img.onload = () => {
20
17
  MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
21
18
  };
22
19
  } else {
23
- let timer = setInterval(() => {
20
+ const timer = setInterval(() => {
24
21
  const musiccover = document.querySelector("#Music-page .aplayer-pic");
25
- // 确保player加载完成
26
22
  if (musiccover) {
27
23
  MusicLoading[0].style.display = "none";
28
- clearInterval(timer)
29
- document.querySelector('meting-js')
30
- .aplayer.volume(0.8, true);
24
+ clearInterval(timer);
25
+ document.querySelector('meting-js').aplayer.volume(0.8, true);
31
26
 
32
27
  scoMusic.addEventListenerChangeMusicBg();
33
28
  MusicBg.style.display = "block";
34
29
  }
35
- }, 100)
30
+ }, 100);
36
31
  }
37
32
  },
38
- lrcupdate: function () {
39
- var aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
40
- var currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
33
+ lrcupdate: () => {
34
+ const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
35
+ const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
41
36
 
42
37
  if (currentLrc) {
43
- var currentIndex = Array.from(aplayerLrcContents.children)
44
- .indexOf(currentLrc);
45
- var translateYValue = -currentIndex * 80;
38
+ const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
39
+ const translateYValue = -currentIndex * 80;
46
40
 
47
- aplayerLrcContents.style.transform = 'translateY(' + translateYValue + 'px)';
41
+ aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
48
42
  }
49
43
  },
50
- buttonlist: function () {
51
- document.querySelector(".aplayer-lrc")
52
- .addEventListener("click", function () {
53
- const aplayerList = document.querySelector(".aplayer-list");
44
+ buttonlist: () => {
45
+ const aplayerList = document.querySelector(".aplayer-list");
46
+ if (aplayerList) {
47
+ document.querySelector(".aplayer-lrc").addEventListener("click", () => {
48
+ if (aplayerList.classList.contains("aplayer-list-hide")) {
49
+ aplayerList.classList.remove("aplayer-list-hide");
50
+ } else {
51
+ aplayerList.classList.add("aplayer-list-hide");
52
+ }
53
+ });
54
+ }
55
+ },
56
+ extractValue: (input) => {
57
+ const valueRegex = /\("([^\s]+)"\)/g;
58
+ const match = valueRegex.exec(input);
59
+ return match[1];
60
+ },
61
+ changeMusicBg: (isChangeBg = true) => {
62
+ const MusicBg = document.getElementById("Music-bg");
63
+ const MusicLoading = document.getElementsByClassName("Music-loading");
64
+
65
+ if (isChangeBg) {
66
+ const musiccover = document.querySelector("#Music-page .aplayer-pic");
67
+ const img = new Image();
68
+ img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
69
+ img.onload = () => {
70
+ MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
71
+ };
72
+ } else {
73
+ const timer = setInterval(() => {
74
+ const musiccover = document.querySelector("#Music-page .aplayer-pic");
75
+ if (musiccover) {
76
+ MusicLoading[0].style.display = "none";
77
+ clearInterval(timer);
78
+ document.querySelector('meting-js').aplayer.volume(0.8, true);
79
+
80
+ scoMusic.addEventListenerChangeMusicBg();
81
+ MusicBg.style.display = "block";
82
+ }
83
+ }, 100);
84
+ }
85
+ },
86
+ lrcupdate: () => {
87
+ const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
88
+ const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
89
+
90
+ if (currentLrc) {
91
+ const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
92
+ const translateYValue = -currentIndex * 80;
54
93
 
94
+ aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
95
+ }
96
+ },
97
+ buttonlist: () => {
98
+ const aplayerList = document.querySelector(".aplayer-list");
99
+ if (aplayerList) {
100
+ document.querySelector(".aplayer-lrc").addEventListener("click", () => {
55
101
  if (aplayerList.classList.contains("aplayer-list-hide")) {
56
102
  aplayerList.classList.remove("aplayer-list-hide");
57
103
  } else {
58
104
  aplayerList.classList.add("aplayer-list-hide");
59
105
  }
60
106
  });
107
+ }
61
108
  },
62
- addEventListenerChangeMusicBg: function () {
63
- const aplayer = document.getElementById("Music-page").querySelector("meting-js").aplayer
64
- aplayer.on('loadeddata', function () {
109
+ addEventListenerChangeMusicBg: () => {
110
+ const aplayer = document.getElementById("Music-page").querySelector("meting-js").aplayer;
111
+ aplayer.on('loadeddata', () => {
65
112
  scoMusic.changeMusicBg();
66
113
  });
67
- aplayer.on('timeupdate', function () {
114
+ aplayer.on('timeupdate', () => {
68
115
  scoMusic.lrcupdate();
69
116
  });
70
- scoMusic.buttonlist();
71
117
  },
72
- getCustomPlayList: function () {
118
+ getCustomPlayList: () => {
73
119
  const MusicPage = document.getElementById("Music-page");
74
120
  const playlistType = scoMusic.params.get("type") || "playlist";
75
121
 
76
122
  if (scoMusic.params.get("id") && params.get("server")) {
77
- var id = scoMusic.params.get("id")
78
- var server = scoMusic.params.get("server")
123
+ const id = scoMusic.params.get("id");
124
+ const server = scoMusic.params.get("server");
79
125
  MusicPage.innerHTML = `<meting-js id="${id}" server="${server}" type="${playlistType}" preload="auto" order="random"></meting-js>`;
80
126
  } else {
81
127
  MusicPage.innerHTML = `<meting-js id="${musicConfig.userId}" server="${musicConfig.userServer}" type="${musicConfig.userType}" preload="auto" order="random"></meting-js>`;
82
128
  }
83
129
  scoMusic.changeMusicBg(false);
84
130
  },
85
- /**
86
- * 绑定键盘事件
87
- * @param event
88
- */
89
- setKeydown: function (event) {
90
- const aplayer = document.querySelector('meting-js').aplayer
131
+ setKeydown: (event) => {
132
+ const aplayer = document.querySelector('meting-js').aplayer;
91
133
  if (event.code === "Space") {
92
134
  event.preventDefault();
93
135
  aplayer.toggle();
@@ -113,15 +155,13 @@ var scoMusic = {
113
155
  }
114
156
  }
115
157
  },
116
- init: function () {
158
+ init: () => {
159
+ let vh = window.innerHeight * 1;
117
160
  document.documentElement.style.setProperty('--vh', `${vh}px`);
118
- // 初始化
119
- this.getCustomPlayList();
120
-
121
- //热键控制音乐
161
+ scoMusic.getCustomPlayList();
122
162
  document.addEventListener("keydown", scoMusic.setKeydown);
123
163
  }
124
- }
164
+ };
125
165
 
126
166
  window.addEventListener('resize', () => {
127
167
  let vh = window.innerHeight * 1;
@@ -1,20 +0,0 @@
1
- .rss-plan-list
2
- a.rss-plan-item.rss-plan-wechat(href=page.wechatOA, title="公众号")
3
- .rss-plan-description 推送精选文章<br>推送全文
4
- .rss-plan-info-group
5
- .rss-plan-title 公众号订阅
6
- .rss-plan-info 推荐的订阅方式
7
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d14a4de78.png", alt="wechat")
8
- a.rss-plan-item.rss-plan-mail(href=page.emailOA, title="email")
9
- .rss-plan-description 推送全部文章<br>推送封面与简介
10
- .rss-plan-info-group
11
- .rss-plan-title 邮件订阅
12
- .rss-plan-info 推荐的订阅方式
13
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d16c3ea22.png", alt="email")
14
- a.rss-plan-item.rss-plan-rss(href=page.rssOA, title="rss")
15
- .rss-plan-description 推送全部文章<br>推送简介
16
- .rss-plan-info-group
17
- .rss-plan-title RSS
18
- .rss-plan-info 备用订阅方式
19
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d184e2a09.png", alt="rss")
20
- != page.content
@@ -1,25 +0,0 @@
1
- script.
2
- async function getSays () {
3
- document.addEventListener('DOMContentLoaded', this)
4
- document.addEventListener('pjax:complete', this)
5
- const htmlTagRegex = /<[^>]+>/g;
6
- document.querySelector('#bber-talk').innerHTML = '<div class="li-style swiper-slide"><i class="scoicon sco-loading-line"></i></div>';
7
- await fetch('!{theme.says.mode_link}')
8
- .then(res => res.json())
9
- .then(res => {
10
- let list = res.filter(item => item.content).slice(0, 10);
11
-
12
- document.querySelector('#bber-talk').innerHTML = list.map(item => {
13
- let content = item.content ? item.content.replace(htmlTagRegex, '') : '';
14
- content += item.image ? '<i class="scoicon scp-image-fill"></i>' : '';
15
- content += item.aplayer ? '<i class="scoicon sco-disc-fill"></i>' : '';
16
- content += item.video ? '<i class="scoicon sco-video-fill"></i>' : '';
17
- content += item.bilibili ? '<i class="scoicon sco-bilibili-line"></i>' : '';
18
- content += item.link ? `<i class="scoicon sco-link"></i>` : '';
19
- return `<div class="li-style swiper-slide">${content}</div>`;
20
- }).join('');
21
- sco.initbbtalk();
22
- }).catch(err => console.log('bbtime |', err));
23
- }
24
- document.addEventListener('DOMContentLoaded', getSays)
25
- document.addEventListener('pjax:complete', getSays)
@@ -1,20 +0,0 @@
1
- each item, i in site.data.essay.essay_list.slice(0, 10)
2
- .li-style.swiper-slide
3
- | #{item.content}
4
- if item.image
5
- i.scoicon.sco-image-fill
6
- if item.aplayer
7
- i.scoicon.sco-disc-fill
8
- if item.video
9
- i.scoicon.sco-video-fill
10
- if item.bilibili
11
- i.scoicon.sco-bilibili-line
12
- if item.link
13
- i.scoicon.sco-links
14
- script.
15
- document.addEventListener('DOMContentLoaded',()=>{
16
- sco.initbbtalk();
17
- })
18
- document.addEventListener('pjax:complete',()=>{
19
- sco.initbbtalk();
20
- })
@@ -1,28 +0,0 @@
1
- script.
2
- async function getSays() {
3
- document.querySelector('#bber-talk').innerHTML = '<div class="li-style swiper-slide"><i class="scoicon sco-loading-line"></i></div>'
4
- await fetch('!{theme.says.mode_link}')
5
- .then(response => response.json())
6
- .then(data => {
7
- let aplayerRegex = /{aplayer,(.*?),(.*?)}/g;
8
- let bilibiliRegex = /{bilibili,(.*?)}/g;
9
- let playerRegex = /{player,(.*?)}/g;
10
- let linkRegex = /(?<!\!)\[([^\]]*)\]\(([^\)]*)\)/g;
11
- let imageRegex = /!\[\]\((.*?)\)/g;
12
- let contentRegex = /#.*?\s([^{\n]*)/g
13
- const list = data.slice(0, 10)
14
- document.querySelector('#bber-talk').innerHTML = list.map(item => {
15
- let content = item.content.match(contentRegex, '$1').map(item => item.replace(contentRegex, '$1'));
16
- let imageBox = item.content.match(imageRegex) ? '<i class="scoicon sco-image-fill"></i>' : '';
17
- let aplayer = item.content.match(aplayerRegex) ? '<i class="scoicon sco-disc-fill"></i>' : '';
18
- let video = item.content.match(playerRegex) ? '<i class="scoicon sco-video-fill"></i>' : item.content.match(bilibiliRegex) ? '<i class="scoicon sco-bilibili-line"></i>' : '';
19
- let link = item.content.match(linkRegex) ? `<i class="scoicon sco-link"></i>` : '';
20
-
21
- return `<div class="li-style swiper-slide">${content + aplayer + video + imageBox + link}</div>`
22
- }).join(' ')
23
- sco.initbbtalk();
24
- })
25
- .catch(error => console.error('bbtime | ', error));
26
- }
27
- document.addEventListener('DOMContentLoaded', getSays)
28
- document.addEventListener('pjax:complete', getSays)
@@ -1,82 +0,0 @@
1
- case theme.says.style
2
- when 1
3
- script.
4
- !async function () {
5
- document.querySelector('#waterfall').innerHTML = '<li class="item"><div class="bber-content"><p class="datacont"><i class="scoicon sco-loading-line"></i></p></div></li>'
6
- await fetch('!{url_for(theme.says.mode_link)}')
7
- .then(res => res.json())
8
- .then(res => {
9
- let list = res.slice(0, !{theme.says.strip})
10
- let aplayer = null
11
- let video = null
12
- let imageBox = null
13
-
14
- document.querySelector('#waterfall').innerHTML = list.map(item => {
15
- aplayer = item.aplayer ? `<div class="bber-music"><meting-js server="${item.aplayer.server}" type="song" id="${item.aplayer.id}" mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0"></meting-js></div>` : null
16
- video = item.player ? `<div class="bber-video"><video src="${item.player}" controls="controls" style="objectfit: cover;"></video></div>` : item.bilibili ? `<div class="bber-video"><iframe src="//player.bilibili.com/player.html?autop-lay=0&bvid=${item.bilibili}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe></div>` : null
17
- imageBox = item.images ? `<div class="bber-content-img">${item.images.map(img => `<img src="${img}" title="即刻短文配图" />`).join('')}</div>` : null
18
- return `<li class="item">
19
- <div id="bber-content">
20
- <p class="datacont">${item.content || ''}</p>
21
- ${imageBox || ''}
22
- </div>
23
- ${video || ''}
24
- ${aplayer || ''}
25
- <hr>
26
- <div class="bber-bottom">
27
- <div class="bber-info">
28
- <div class="bber-info-time">
29
- <i class="scoicon sco-calendar-todo-fill"></i>
30
- <time class="datetime" datetime="${item.date}"></time>
31
- </div>
32
- ${item.link ? `<a class="bber-content-link" href="${item.link}" title="跳转到短文指引的链接" target="_blank"><i class="scoicon sco-link-m-line"></i>链接</a>` : ''}
33
- </div>
34
- ${item.content ? `<a class="bber-reply goComment" onclick="sco.toTalk('${item.content}')"><i class="scoicon sco-chat-fill" style="font-size: 1rem;"></i></a>` : ''}
35
- </div>
36
- </li>`
37
- }).join('')
38
- sco.reflashEssayWaterFall();
39
- GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
40
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
41
- changeTimeFormat();
42
- })
43
- }()
44
- when 2
45
- script.
46
- !async function () {
47
- document.querySelector('#waterfall').innerHTML = '<li class="item"><div class="bber-content"><p class="datacont"><i class="scoicon sco-loading-line"></i></p></div></li>'
48
- await fetch('!{url_for(theme.says.mode_link)}')
49
- .then(res => res.json())
50
- .then(res => {
51
- let list = res.slice(0, !{theme.says.strip})
52
- let aplayer = null
53
- let video = null
54
- let imageBox = null
55
-
56
- document.querySelector('#waterfall').innerHTML = list.map(item => {
57
- aplayer = item.aplayer ? `<div class="bber-music"><meting-js server="${item.aplayer.server}" type="song" id="${item.aplayer.id}" mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0"></meting-js></div>` : null
58
- video = item.player ? `<div class="bber-video"><video src="${item.player}" controls="controls" style="object-fit: cover;"></video></div>` : item.bilibili ? `<div class="bber-video"><iframe src="//player.bilibili.com/player.html?autoplay=0&bvid=${item.bilibili}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe></div>` : null
59
- imageBox = item.images ? `<div class="bber-content-img">${item.images.map(img => `<img src="${img}" title="即刻短文配图" />`).join('')}</div>` : null
60
- return `<li class="item">
61
- <div class="meta">
62
- <img class="no-lightbox nolazyload avatar" src="!{theme.aside.card.author.img}">
63
- <div class="info">
64
- <span class="bber_nick">#{config.author}</span>
65
- <time class="datetime bber_date" datetime="${item.date}"></time>
66
- </div>
67
- ${item.content ? `<a class="bber-reply goComment" onclick="sco.toTalk('${item.content}')"><i class="scoicon sco-chat-fill" style="font-size: 1rem;"></i></a>` : ''}
68
- </div>
69
- <div id="bber-content">
70
- <p class="datacont">${item.content || ''}</p>
71
- ${imageBox || ''}
72
- </div>
73
- ${video || ''}
74
- ${aplayer || ''}
75
- </li>`
76
- }).join('')
77
- sco.reflashEssayWaterFall();
78
- GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
79
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
80
- changeTimeFormat();
81
- })
82
- }()
@@ -1,44 +0,0 @@
1
- each item in site.data.essay.essay_list.slice(0, theme.says.strip)
2
- li.item
3
- if theme.says.style === 2
4
- .meta
5
- img.avatar(src=theme.aside.card.author.img)
6
- .info
7
- span.bber_nick= config.author
8
- time.datetime.bber_date(datetime=moment(item.date).format())
9
- if item.content
10
- a.bber-reply.goComment(onclick=`sco.toTalk('${item.content}')`)
11
- i.scoicon.sco-chat-fill
12
-
13
- #bber-content
14
- p.datacont= item.content
15
- if item.image
16
- .bber-content-img
17
- each img in item.image
18
- img(src=img title="即刻短文配图")
19
-
20
- if item.aplayer
21
- .bber-music
22
- meting-js(server=item.aplayer.server type="song" id=item.aplayer.id mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0")
23
-
24
- if item.video
25
- .bber-video
26
- if item.video.player
27
- video(src=item.video.player controls="controls" style="object-fit: cover;")
28
- if item.video.bilibili
29
- iframe(src='//player.bilibili.com/player.html?auto-play=0&bvid=' + item.video.bilibili scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true")
30
-
31
- if theme.says.style === 1
32
- hr
33
- .bber-bottom
34
- .bber-info
35
- .bber-info-time
36
- i.scoicon.sco-calendar-todo-fill
37
- time.datetime(datetime=moment(item.date).format())
38
- if item.link
39
- a.bber-content-link(href=url_for(item.link) title="跳转到短文指引的链接" target="_blank")
40
- i.scoicon.sco-link-m-line
41
- | 链接
42
- if item.content
43
- a.bber-reply(onclick=`sco.toTalk('${item.content}')`)
44
- i.scoicon.sco-chat-fill
@@ -1,111 +0,0 @@
1
- case theme.says.style
2
- when 1
3
- script.
4
- !async function () {
5
- let aplayerRegex = /{aplayer,(.*?),(.*?)}/g;
6
- let linkRegex = /(?<!\!)\[([^\]]*)\]\(([^\)]*)\)/g;
7
- let bilibiliRegex = /{bilibili,(.*?)}/g;
8
- let playerRegex = /{player,(.*?)}/g;
9
- let imageRegex = /!\[\]\((.*?)\)/g;
10
- let contentRegex = /#.*?\s([^{\n]*)/g;
11
-
12
- document.querySelector('#waterfall').innerHTML = '<i class="scoicon sco-loading-line"></i>'
13
-
14
- await fetch("!{url_for(theme.says.mode_link)}")
15
- .then(res => res.json())
16
- .then(data => {
17
- let list = data.slice(0, !{theme.says.strip});
18
- let aplayer = null;
19
- let video = null;
20
- let imageBox = null;
21
-
22
- document.querySelector('#waterfall').innerHTML = list.map(item => {
23
- aplayer = item.content.match(aplayerRegex);
24
- aplayer = aplayer ? `<div class="bber-music"><meting-js server="${aplayer[0].replace(aplayerRegex, '$1')}" type="song" id="${aplayer[0].replace(aplayerRegex, '$2')}" mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0"></meting-js></div>` : null;
25
- video = item.content.match(playerRegex);
26
- video = video ? `<div class="bber-video"><video src="${video[0].replace(playerRegex, '$1')}" controls="controls" style="object-fit: cover;"></video></div>` : item.content.match(bilibiliRegex);
27
- video = item.content.match(bilibiliRegex) ? `<div class="bber-video"><iframe src="//player.bilibili.com/player.html?autoplay=0&bvid=${video[0].replace(bilibiliRegex, '$1')}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe></div>` : video;
28
- imageBox = item.content.match(imageRegex);
29
- imageBox = imageBox ? `<div class="bber-content-img">${imageBox.map(img => `<img src="${img.replace(imageRegex, '$1')}" title="即刻短文配图" />`).join('')}</div>` : '';
30
- let time = new Date(item.createdTs * 1000).toISOString().replace('Z', '+08:00');
31
- let content = item.content.match(contentRegex).map(item => item.replace(contentRegex, '$1'));
32
- let link = item.content.match(linkRegex);
33
- link = link ? `<a class="bber-content-link" href='${link[0].replace(linkRegex, '$2')}' title="${link[0].replace(linkRegex, '$1')}" target="_blank"><i class="scoicon sco-link-m-line"></i>链接</a>` : '';
34
- return `<li class="item">
35
- <div id="bber-content">
36
- <p class="datacont">${content}</p>
37
- ${imageBox || ''}
38
- </div>
39
- ${video || ''}
40
- ${aplayer || ''}
41
- <hr>
42
- <div class="bber-bottom">
43
- <div class="bber-info">
44
- <div class="bber-info-time">
45
- <i class="scoicon sco-calendar-todo-fill"></i>
46
- <time class="datetime" datetime="${time}"></time>
47
- </div>
48
- ${link}
49
- </div>
50
- ${content ? `<a class="bber-reply goComment" onclick="sco.toTalk('${content}')"><i class="scoicon sco-chat-fill" style="font-size: 1rem;"></i></a>` : ''}
51
- </div>
52
- </li>`;
53
- }).join('');
54
- sco.reflashEssayWaterFall();
55
- GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
56
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
57
- changeTimeFormat();
58
- }).catch(error => console.log(error));
59
- }();
60
- when 2
61
- script.
62
- !async function () {
63
- let aplayerRegex = /{aplayer,(.*?),(.*?)}/g;
64
- let bilibiliRegex = /{bilibili,(.*?)}/g;
65
- let playerRegex = /{player,(.*?)}/g;
66
- let imageRegex = /!\[\]\((.*?)\)/g;
67
- let contentRegex = /#.*?\s([^{\n]*)/g
68
-
69
- document.querySelector('#waterfall').innerHTML = '<i class="scoicon sco-loading-line"></i>'
70
-
71
- await fetch("!{url_for(theme.says.mode_link)}")
72
- .then(res => res.json())
73
- .then(data => {
74
- let list = data.slice(0, !{theme.says.strip})
75
- let aplayer = null;
76
- let video = null;
77
- let imageBox = null;
78
-
79
- document.querySelector('#waterfall').innerHTML = list.map(item => {
80
- aplayer = item.content.match(aplayerRegex);
81
- aplayer = aplayer ? `<div class="bber-music"><meting-js server="${aplayer[0].replace(aplayerRegex, '$1')}" type="song" id="${aplayer[0].replace(aplayerRegex, '$2')}" mutex="true" preload="none" theme="var(--sco-main)" data-lrctype="0"></meting-js></div>` : null;
82
- video = item.content.match(playerRegex);
83
- video = video ? `<div class="bber-video"><video src="${video[0].replace(playerRegex, '$1')}" controls="controls" style="object-fit: cover;"></video></div>` : item.content.match(bilibiliRegex);
84
- video = item.content.match(bilibiliRegex) ? `<div class="bber-video"><iframe src="//player.bilibili.com/player.html?autoplay=0&bvid=${video[0].replace(bilibiliRegex, '$1')}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe></div>` : video;
85
- imageBox = item.content.match(imageRegex);
86
- imageBox = imageBox ? `<div class="bber-content-img">${imageBox.map(img => `<img src="${img.replace(imageRegex, '$1')}" title="即刻短文配图" />`).join('')}</div>` : '';
87
- let time = new Date(item.createdTs * 1000).toISOString().replace('Z', '+08:00');
88
- let content = item.content.match(contentRegex).map(item => item.replace(contentRegex, '$1'));
89
- return `<li class="item">
90
- <div class="meta">
91
- <img class="no-lightbox nolazyload avatar" src="!{theme.aside.card.author.img}">
92
- <div class="info">
93
- <span class="bber_nick">#{config.author}</span>
94
- <time class="datetime bber_date" datetime="${time}"></time>
95
- </div>
96
- ${content ? `<a class="bber-reply goComment" onclick="sco.toTalk('${content}')"><i class="scoicon sco-chat-fill" style="font-size: 1rem;"></i></a>` : ''}
97
- </div>
98
- <div id="bber-content">
99
- <p class="datacont">${content}</p>
100
- ${imageBox || ''}
101
- </div>
102
- ${video || ''}
103
- ${aplayer || ''}
104
- </li>`;
105
- }).join('');
106
- sco.reflashEssayWaterFall();
107
- GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
108
- GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img"));
109
- changeTimeFormat();
110
- }).catch(error => console.log(error));
111
- }();