hexo-theme-solitude 1.3.0 → 1.4.0
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.
- package/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +107 -0
- package/.github/ISSUE_TEMPLATE/config.yml +13 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +14 -0
- package/.github/workflows/npm-publish.yml +21 -0
- package/CONTRIBUTING.md +0 -0
- package/LICENSE +0 -0
- package/README.md +60 -43
- package/README_EN.md +60 -42
- package/_config.yml +606 -444
- package/languages/en-US.yml +3 -23
- package/languages/zh-CN.yml +3 -23
- package/layout/404.pug +0 -0
- package/layout/archive.pug +2 -3
- package/layout/category.pug +0 -0
- package/layout/includes/body/mode.pug +35 -0
- package/layout/includes/console.pug +3 -3
- package/layout/includes/footer.pug +16 -15
- package/layout/includes/head/config.pug +38 -30
- package/layout/includes/head/opengraph.pug +0 -0
- package/layout/includes/head/pwa.pug +5 -44
- package/layout/includes/head.pug +3 -1
- package/layout/includes/header.pug +0 -0
- package/layout/includes/inject/body.pug +115 -63
- package/layout/includes/inject/head.pug +11 -46
- package/layout/includes/layout.pug +1 -1
- package/layout/includes/loading.pug +0 -0
- package/layout/includes/mixins/articleSort.pug +0 -0
- package/layout/includes/mixins/pagination.pug +0 -0
- package/layout/includes/nav.pug +1 -1
- package/layout/includes/page/about.pug +1 -1
- package/layout/includes/page/categories.pug +0 -0
- package/layout/includes/page/default.pug +0 -0
- package/layout/includes/page/equipment.pug +0 -0
- package/layout/includes/page/links.pug +2 -2
- package/layout/includes/page/music.pug +0 -0
- package/layout/includes/page/not_configured.pug +0 -0
- package/layout/includes/page/rss.pug +3 -3
- package/layout/includes/page/says.pug +15 -15
- package/layout/includes/page/tags.pug +0 -0
- package/layout/includes/page/tlink.pug +1 -0
- package/layout/includes/recent-posts.pug +0 -0
- package/layout/includes/sidebar.pug +0 -0
- package/layout/includes/widgets/aside/aside.pug +6 -6
- package/layout/includes/widgets/aside/asideAllInfo.pug +0 -0
- package/layout/includes/widgets/aside/asideArchive.pug +0 -0
- package/layout/includes/widgets/aside/asideCustom.pug +1 -1
- package/layout/includes/widgets/aside/asideFlipCard.pug +0 -0
- package/layout/includes/widgets/aside/asideInfoCard.pug +3 -3
- package/layout/includes/widgets/aside/asideNewestPost.pug +0 -0
- package/layout/includes/widgets/aside/asideSwitch.pug +0 -4
- package/layout/includes/widgets/aside/asideTag.pug +1 -1
- package/layout/includes/widgets/aside/asideToc.pug +0 -0
- package/layout/includes/widgets/aside/asideWebInfo.pug +2 -2
- package/layout/includes/widgets/home/banner.pug +0 -0
- package/layout/includes/widgets/home/bb/json.pug +22 -0
- package/layout/includes/widgets/home/bb/local.pug +17 -0
- package/layout/includes/widgets/home/bb/memos.pug +25 -0
- package/layout/includes/widgets/home/bbTimeList.pug +11 -7
- package/layout/includes/widgets/home/categoryBar.pug +0 -0
- package/layout/includes/widgets/home/categoryGroup.pug +1 -1
- package/layout/includes/widgets/home/hometop.pug +0 -0
- package/layout/includes/widgets/home/postList.pug +0 -0
- package/layout/includes/widgets/home/topGroup.pug +0 -0
- package/layout/includes/widgets/nav/left.pug +0 -0
- package/layout/includes/widgets/nav/menu.pug +1 -1
- package/layout/includes/widgets/nav/right.pug +6 -5
- package/layout/includes/widgets/page/about/authorinfo.pug +10 -9
- package/layout/includes/widgets/page/about/award.pug +0 -0
- package/layout/includes/widgets/page/about/contentinfo.pug +35 -34
- package/layout/includes/widgets/page/about/hobbies.pug +21 -17
- package/layout/includes/widgets/page/about/motto.pug +17 -16
- package/layout/includes/widgets/page/about/other.pug +16 -16
- package/layout/includes/widgets/page/about/personalities.pug +15 -14
- package/layout/includes/widgets/page/about/skillsinfo.pug +37 -36
- package/layout/includes/widgets/page/about/tenyear.pug +0 -0
- package/layout/includes/widgets/page/banner.pug +9 -3
- package/layout/includes/widgets/page/equipment/content.pug +0 -0
- package/layout/includes/widgets/page/links/banner.pug +14 -12
- package/layout/includes/widgets/page/links/linksCard.pug +4 -6
- package/layout/includes/widgets/page/links/linksDiscn.pug +8 -0
- package/layout/includes/widgets/page/links/linksItem.pug +4 -6
- package/layout/includes/widgets/page/says/json.pug +80 -0
- package/layout/includes/widgets/page/says/local.pug +48 -0
- package/layout/includes/widgets/page/says/memos.pug +109 -0
- package/layout/includes/widgets/post/award.pug +0 -0
- package/layout/includes/widgets/post/copyright.pug +2 -2
- package/layout/includes/widgets/post/post-ai.pug +12 -0
- package/layout/includes/widgets/post/postMeta.pug +2 -2
- package/layout/includes/widgets/post/postNav.pug +0 -0
- package/layout/includes/widgets/post/wave.pug +0 -0
- package/layout/includes/widgets/randomlink.pug +1 -1
- package/layout/includes/widgets/rightside/index.pug +6 -5
- package/layout/includes/widgets/third-party/comments/comment.pug +1 -5
- package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -1
- package/layout/includes/widgets/third-party/comments/waline.pug +9 -11
- package/layout/includes/widgets/third-party/music.pug +1 -1
- package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -0
- package/layout/includes/widgets/third-party/news-comment/twikoo.pug +70 -0
- package/layout/includes/widgets/third-party/news-comment/waline.pug +64 -0
- package/layout/includes/widgets/third-party/pjax.pug +0 -0
- package/layout/includes/widgets/third-party/search/algolia-search.pug +0 -0
- package/layout/includes/widgets/third-party/search/index.pug +8 -7
- package/layout/includes/widgets/third-party/search/local-search.pug +0 -0
- package/layout/index.pug +3 -3
- package/layout/page.pug +0 -4
- package/layout/post.pug +2 -2
- package/layout/tag.pug +0 -0
- package/package.json +18 -9
- package/plugins.yml +109 -0
- package/scripts/event/cdn.js +129 -0
- package/scripts/event/init.js +0 -0
- package/scripts/event/page.js +1 -21
- package/scripts/event/welcome.js +1 -1
- package/scripts/filter/checkThemeConfig.js +0 -0
- package/scripts/filter/default.js +0 -0
- package/scripts/filter/lazyload.js +1 -1
- package/scripts/filter/randomPosts.js +0 -0
- package/scripts/helper/cdn.js +0 -0
- package/scripts/helper/getArchiveLength.js +0 -0
- package/scripts/helper/page.js +0 -0
- package/scripts/helper/related_post.js +0 -0
- package/scripts/helper/stylus.js +0 -0
- package/scripts/tags/button.js +0 -0
- package/scripts/tags/bvideo.js +0 -0
- package/scripts/tags/card.js +0 -0
- package/scripts/tags/checkbox.js +0 -0
- package/scripts/tags/fold.js +0 -0
- package/scripts/tags/image.js +0 -0
- package/scripts/tags/inline-image.js +0 -0
- package/scripts/tags/label.js +0 -0
- package/scripts/tags/link.js +0 -0
- package/scripts/tags/media.js +0 -0
- package/scripts/tags/note.js +0 -0
- package/scripts/tags/span.js +0 -0
- package/scripts/tags/tabs.js +0 -0
- package/scripts/tags/timeline.js +0 -0
- package/scripts/tags/u.js +0 -0
- package/source/css/_global/animation.css +0 -0
- package/source/css/_global/function.styl +42 -42
- package/source/css/_global/index.styl +1 -1
- package/source/css/_global/var.styl +0 -0
- package/source/css/_layout/basic.styl +10 -12
- package/source/css/_layout/header.styl +8 -3
- package/source/css/_layout/index.styl +59 -5
- package/source/css/_mode/index.styl +0 -0
- package/source/css/_page/_home/category-bar.styl +0 -0
- package/source/css/_page/_home/home-top.styl +10 -31
- package/source/css/_page/_home/index.styl +0 -0
- package/source/css/_page/_home/pagination.styl +3 -0
- package/source/css/_page/_home/recent-post.styl +10 -3
- package/source/css/_page/about/index.styl +0 -0
- package/source/css/_page/about/tenyear.styl +0 -0
- package/source/css/_page/about.styl +9 -0
- package/source/css/_page/category.styl +0 -0
- package/source/css/_page/douban.styl +0 -1
- package/source/css/_page/equipment.styl +0 -0
- package/source/css/_page/error.styl +0 -0
- package/source/css/_page/home.styl +0 -0
- package/source/css/_page/index.styl +2 -3
- package/source/css/_page/links.styl +85 -49
- package/source/css/_page/moment.styl +0 -0
- package/source/css/_page/music.styl +1 -1
- package/source/css/_page/rss.styl +0 -0
- package/source/css/_page/says.styl +10 -0
- package/source/css/_page/tag.styl +0 -0
- package/source/css/_widgets/_aside/allinfo.styl +34 -0
- package/source/css/_widgets/_aside/flip.styl +0 -0
- package/source/css/_widgets/_aside/index.styl +1 -7
- package/source/css/_widgets/_aside/info.styl +0 -0
- package/source/css/_widgets/_aside/newPost.styl +0 -0
- package/source/css/_widgets/_aside/toc.styl +0 -0
- package/source/css/_widgets/_aside/welcome.styl +0 -0
- package/source/css/_widgets/_comment/index.styl +0 -0
- package/source/css/_widgets/_comment/twikoo.styl +0 -2
- package/source/css/_widgets/_comment/waline.styl +0 -0
- package/source/css/_widgets/_extra/console.styl +0 -0
- package/source/css/_widgets/_extra/fullpage.styl +0 -0
- package/source/css/_widgets/_extra/music.styl +1 -1
- package/source/css/_widgets/_extra/pace.styl +0 -0
- package/source/css/_widgets/_extra/rightmenu.styl +0 -0
- package/source/css/_widgets/_mixins/article-sort.styl +0 -0
- package/source/css/_widgets/_mixins/footer.styl +1 -2
- package/source/css/_widgets/_mixins/other.styl +0 -4
- package/source/css/_widgets/_mixins/sidebar.styl +0 -0
- package/source/css/_widgets/_post/_highlight/diff.styl +0 -0
- package/source/css/_widgets/_post/_highlight/index.styl +0 -1
- package/source/css/_widgets/_post/_highlight/theme/default.styl +0 -0
- package/source/css/_widgets/_post/_highlight/theme/mac.styl +0 -0
- package/source/css/_widgets/_post/_highlight/theme.styl +0 -0
- package/source/css/_widgets/_post/commentBarrage.styl +0 -0
- package/source/css/_widgets/_post/content.styl +42 -11
- package/source/css/_widgets/_post/copyright.styl +0 -0
- package/source/css/_widgets/_post/index.styl +1 -1
- package/source/css/_widgets/_post/meta.styl +0 -3
- package/source/css/_widgets/_post/pagination.styl +1 -1
- package/source/css/_widgets/_post/postAI.styl +0 -0
- package/source/css/_widgets/_post/relatedPost.styl +0 -0
- package/source/css/_widgets/_post/tools.styl +0 -0
- package/source/css/_widgets/_search/algolia-search.styl +0 -0
- package/source/css/_widgets/_search/local-search.styl +0 -0
- package/source/css/_widgets/_tags/button.styl +0 -0
- package/source/css/_widgets/_tags/bvideo.styl +0 -0
- package/source/css/_widgets/_tags/card.styl +0 -0
- package/source/css/_widgets/_tags/checkbox.styl +0 -0
- package/source/css/_widgets/_tags/fold.styl +0 -0
- package/source/css/_widgets/_tags/image.styl +0 -0
- package/source/css/_widgets/_tags/index.styl +0 -0
- package/source/css/_widgets/_tags/inline-image.styl +0 -0
- package/source/css/_widgets/_tags/label.styl +0 -0
- package/source/css/_widgets/_tags/link.styl +4 -2
- package/source/css/_widgets/_tags/note.styl +0 -0
- package/source/css/_widgets/_tags/span.styl +0 -0
- package/source/css/_widgets/_tags/tabs.styl +0 -0
- package/source/css/_widgets/_tags/timeline.styl +0 -1
- package/source/css/_widgets/index.styl +4 -4
- package/source/css/index.styl +0 -0
- package/source/img/avatar.png +0 -0
- package/source/img/default.png +0 -0
- package/source/img/error_load.png +0 -0
- package/source/js/{extend/comment/twikoo/commentBarrage.js → comment/twikoo_commentBarrage.js} +0 -0
- package/source/js/{extend/comment/waline/commentBarrage.js → comment/waline_commentBarrage.js} +0 -0
- package/source/js/covercolor/api.js +95 -0
- package/source/js/covercolor/local.js +154 -0
- package/source/js/main.js +28 -252
- package/source/js/music.js +0 -0
- package/source/js/rightside.js +404 -0
- package/source/js/{extend/search/algolia-search.js → search/algolia.js} +10 -0
- package/source/js/{extend/search/local-search.js → search/local.js} +24 -2
- package/source/js/utils.js +75 -1
- package/layout/includes/head/fest.pug +0 -22
- package/layout/includes/page/echarts.pug +0 -7
- package/layout/includes/page/moments.pug +0 -4
- package/layout/includes/widgets/aside/asideHistory.pug +0 -8
- package/layout/includes/widgets/aside/asideWelcome.pug +0 -12
- package/layout/includes/widgets/page/moments/angle.pug +0 -19
- package/layout/includes/widgets/page/moments/index.pug +0 -23
- package/layout/includes/widgets/page/says/saysBottom.pug +0 -11
- package/layout/includes/widgets/page/says/saysContent.pug +0 -6
- package/layout/includes/widgets/page/says/saysFunction.pug +0 -10
- package/layout/includes/widgets/page/says/saysMeta.pug +0 -7
- package/layout/includes/widgets/third-party/ai/index.pug +0 -12
- package/layout/includes/widgets/third-party/comments/gitalk.pug +0 -0
- package/layout/includes/widgets/third-party/comments/valine.pug +0 -0
- package/scripts/helper/echarts.js +0 -407
- package/source/css/_widgets/_aside/history.styl +0 -42
- package/source/js/extend/comment/twikoo/twikoo.js +0 -67
- package/source/js/extend/comment/waline/waline.js +0 -60
- package/source/lib/bundle.min.js +0 -27
- package/source/lib/circle.min.js +0 -1
- package/source/lib/cover-color.min.js +0 -7
- package/source/lib/friends_post.js +0 -4
- package/source/lib/lazyload.min.js +0 -1
- package/source/lib/rightside.min.js +0 -1
- package/source/lib/snackbar.min.css +0 -1
- package/source/lib/snackbar.min.js +0 -9
- package/source/lib/txmap.min.js +0 -1
- package/source/lib/view-image.min.js +0 -6
- package/source/lib/waterfall.min.js +0 -1
- /package/source/{lib → js}/sco-ai.min.js +0 -0
package/source/js/main.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* side menu
|
3
|
-
*/
|
4
1
|
const sidebarFn = () => {
|
5
2
|
const $toggleMenu = document.getElementById('toggle-menu')
|
6
3
|
const $mobileSidebarMenus = document.getElementById('sidebar-menus')
|
@@ -36,9 +33,6 @@ const sidebarFn = () => {
|
|
36
33
|
})
|
37
34
|
}
|
38
35
|
|
39
|
-
/**
|
40
|
-
* 滚动处理
|
41
|
-
*/
|
42
36
|
const scrollFn = function () {
|
43
37
|
const innerHeight = window.innerHeight;
|
44
38
|
const $header = document.getElementById('page-header');
|
@@ -70,9 +64,6 @@ const scrollFn = function () {
|
|
70
64
|
}
|
71
65
|
}
|
72
66
|
|
73
|
-
/**
|
74
|
-
* 滑动导航栏数字变化
|
75
|
-
*/
|
76
67
|
const percent = () => {
|
77
68
|
let scrollTop = document.documentElement.scrollTop || window.pageYOffset
|
78
69
|
let totalHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight
|
@@ -117,9 +108,6 @@ const showTodayCard = () => {
|
|
117
108
|
}
|
118
109
|
}
|
119
110
|
|
120
|
-
/**
|
121
|
-
* 修改时间格式
|
122
|
-
*/
|
123
111
|
const changeTimeFormat = () => {
|
124
112
|
const timeElements = document.getElementsByTagName("time"), lang = GLOBAL_CONFIG.lang.time
|
125
113
|
for (let i = 0; i < timeElements.length; i++) {
|
@@ -145,9 +133,6 @@ const changeTimeFormat = () => {
|
|
145
133
|
}
|
146
134
|
}
|
147
135
|
|
148
|
-
/*
|
149
|
-
* 文章页右下角下一篇
|
150
|
-
*/
|
151
136
|
const initObserver = () => {
|
152
137
|
let commentElement = document.getElementById("post-comment");
|
153
138
|
let paginationElement = document.getElementById("pagination");
|
@@ -192,6 +177,7 @@ class toc {
|
|
192
177
|
const $tocContent = document.getElementById('toc-content')
|
193
178
|
const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6')
|
194
179
|
let detectItem = ''
|
180
|
+
|
195
181
|
function autoScroll(el) {
|
196
182
|
const activePosition = el.getBoundingClientRect().top
|
197
183
|
const sidebarScrollTop = $tocContent.scrollTop
|
@@ -202,6 +188,7 @@ class toc {
|
|
202
188
|
$tocContent.scrollTop = sidebarScrollTop - 150
|
203
189
|
}
|
204
190
|
}
|
191
|
+
|
205
192
|
function findHeadPosition(top) {
|
206
193
|
if (top === 0) {
|
207
194
|
return false
|
@@ -230,6 +217,7 @@ class toc {
|
|
230
217
|
}
|
231
218
|
}
|
232
219
|
}
|
220
|
+
|
233
221
|
window.tocScrollFn = utils.throttle(function () {
|
234
222
|
const currentTop = window.scrollY || document.documentElement.scrollTop
|
235
223
|
findHeadPosition(currentTop)
|
@@ -243,94 +231,6 @@ let lastSayHello = "";
|
|
243
231
|
let wleelw_musicPlaying = false
|
244
232
|
|
245
233
|
let sco = {
|
246
|
-
/**
|
247
|
-
* 个性定位
|
248
|
-
*/
|
249
|
-
card_welcome: function () {
|
250
|
-
ipLoacation = window.saveToLocal.get('ipLocation');
|
251
|
-
if (!ipLoacation) {
|
252
|
-
// 数据已过期或不存在
|
253
|
-
let script = document.createElement('script');
|
254
|
-
let url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
|
255
|
-
script.src = url;
|
256
|
-
window.QQmap = function (data) {
|
257
|
-
ipLoacation = data;
|
258
|
-
// 将数据保存到 localStorage,过期时间设置为 1 天
|
259
|
-
window.saveToLocal.set('ipLocation', ipLoacation, 1);
|
260
|
-
document.body.removeChild(script);
|
261
|
-
delete window.QQmap;
|
262
|
-
};
|
263
|
-
document.body.appendChild(script);
|
264
|
-
}
|
265
|
-
showWelcome();
|
266
|
-
},
|
267
|
-
/**
|
268
|
-
* 那年今日
|
269
|
-
*/
|
270
|
-
card_history: function () {
|
271
|
-
if (document.getElementById('history-container')) {
|
272
|
-
async function fetchHistoryData() {
|
273
|
-
let myDate = new Date();
|
274
|
-
let myMonth = myDate.getMonth() + 1;
|
275
|
-
let getDate = myDate.getDate();
|
276
|
-
let getMonth = myMonth < 10 ? "0" + myMonth : "" + myMonth;
|
277
|
-
let getDay = getDate < 10 ? "0" + getDate : "" + getDate;
|
278
|
-
let getMonthDate = "S" + getMonth + getDay;
|
279
|
-
let history_data_url = `https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/${getMonth}.json`;
|
280
|
-
|
281
|
-
let response = await fetch(history_data_url);
|
282
|
-
let data = await response.json();
|
283
|
-
return data[getMonthDate];
|
284
|
-
}
|
285
|
-
|
286
|
-
function append(parent, text) {
|
287
|
-
let temp = document.createElement('div');
|
288
|
-
temp.innerHTML = text;
|
289
|
-
let frag = document.createDocumentFragment();
|
290
|
-
while (temp.firstChild) {
|
291
|
-
frag.appendChild(temp.firstChild);
|
292
|
-
}
|
293
|
-
parent.appendChild(frag);
|
294
|
-
}
|
295
|
-
|
296
|
-
fetchHistoryData().then(data => {
|
297
|
-
let html_item = data.map(item => `
|
298
|
-
<div class="swiper-slide history_slide">
|
299
|
-
<span class="history_slide_time">A.D.${item.year}</span>
|
300
|
-
<span class="history_slide_link">${item.title}</span>
|
301
|
-
</div>
|
302
|
-
`).join('');
|
303
|
-
let history_container_wrapper = document.getElementById('history_container_wrapper');
|
304
|
-
append(history_container_wrapper, html_item);
|
305
|
-
let swiper_history = new Swiper('.history_swiper-container', {
|
306
|
-
passiveListeners: true,
|
307
|
-
spaceBetween: 30,
|
308
|
-
effect: 'coverflow',
|
309
|
-
coverflowEffect: {
|
310
|
-
rotate: 30,
|
311
|
-
slideShadows: false,
|
312
|
-
},
|
313
|
-
loop: true,
|
314
|
-
direction: 'vertical',
|
315
|
-
autoplay: {
|
316
|
-
disableOnInteraction: true,
|
317
|
-
delay: 5000
|
318
|
-
},
|
319
|
-
mousewheel: false,
|
320
|
-
});
|
321
|
-
let history_container = document.getElementById('history-container');
|
322
|
-
history_container.onmouseenter = function () {
|
323
|
-
swiper_history.autoplay.stop();
|
324
|
-
};
|
325
|
-
history_container.onmouseleave = function () {
|
326
|
-
swiper_history.autoplay.start();
|
327
|
-
}
|
328
|
-
});
|
329
|
-
}
|
330
|
-
},
|
331
|
-
/**
|
332
|
-
* 隐藏协议小助手
|
333
|
-
*/
|
334
234
|
hideCookie: function () {
|
335
235
|
setTimeout(() => {
|
336
236
|
const cookiesWindow = document.getElementById("cookies-window");
|
@@ -342,10 +242,6 @@ let sco = {
|
|
342
242
|
}
|
343
243
|
}, 3000);
|
344
244
|
},
|
345
|
-
/**
|
346
|
-
* 平滑滚动处理
|
347
|
-
* @param elementId
|
348
|
-
*/
|
349
245
|
scrollTo: function (elementId) {
|
350
246
|
const targetElement = document.getElementById(elementId);
|
351
247
|
if (targetElement) {
|
@@ -363,9 +259,6 @@ let sco = {
|
|
363
259
|
}));
|
364
260
|
}
|
365
261
|
},
|
366
|
-
/**
|
367
|
-
* 控制台热评隐藏显示切换
|
368
|
-
*/
|
369
262
|
switchCommentBarrage: function () {
|
370
263
|
let commentBarrageElement = document.querySelector(".comment-barrage");
|
371
264
|
if (commentBarrageElement) {
|
@@ -382,9 +275,6 @@ let sco = {
|
|
382
275
|
}
|
383
276
|
}
|
384
277
|
},
|
385
|
-
/**
|
386
|
-
* 控制台侧边栏隐藏显示切换
|
387
|
-
*/
|
388
278
|
switchHideAside: function () {
|
389
279
|
const htmlClassList = document.documentElement.classList;
|
390
280
|
htmlClassList.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 1) : saveToLocal.set("aside-status", "hide", 1)
|
@@ -394,11 +284,8 @@ let sco = {
|
|
394
284
|
initConsoleState: function () {
|
395
285
|
document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
|
396
286
|
},
|
397
|
-
/**
|
398
|
-
* 个人信息顶部
|
399
|
-
*/
|
400
287
|
changeSayHelloText: function () {
|
401
|
-
const greetings =
|
288
|
+
const greetings = GLOBAL_CONFIG.aside.sayhello2;
|
402
289
|
const greetingElement = document.getElementById("author-info__sayhi");
|
403
290
|
let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
|
404
291
|
while (randomGreeting === lastSayHello) {
|
@@ -407,9 +294,6 @@ let sco = {
|
|
407
294
|
greetingElement.textContent = randomGreeting;
|
408
295
|
lastSayHello = randomGreeting;
|
409
296
|
},
|
410
|
-
/**
|
411
|
-
* 昼夜切换
|
412
|
-
*/
|
413
297
|
switchDarkMode: function () {
|
414
298
|
let nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' :
|
415
299
|
'light'
|
@@ -417,65 +301,32 @@ let sco = {
|
|
417
301
|
document.documentElement.setAttribute('data-theme', 'dark')
|
418
302
|
saveToLocal.set('theme', 'dark', 0.02);
|
419
303
|
utils.snackbarShow(GLOBAL_CONFIG.lang.theme.dark, false, 2000)
|
420
|
-
document.querySelector(".menu-darkmode-text").textContent = "
|
304
|
+
GLOBAL_CONFIG.rightside && (document.querySelector(".menu-darkmode-text").textContent = "浅色模式");
|
421
305
|
} else {
|
422
306
|
document.documentElement.setAttribute('data-theme', 'light')
|
423
307
|
saveToLocal.set('theme', 'light', 0.02);
|
424
308
|
utils.snackbarShow(GLOBAL_CONFIG.lang.theme.light, false, 2000)
|
425
|
-
document.querySelector(".menu-darkmode-text").textContent = "
|
309
|
+
GLOBAL_CONFIG.rightside && (document.querySelector(".menu-darkmode-text").textContent = "深色模式");
|
426
310
|
}
|
427
311
|
},
|
428
312
|
hideTodayCard: function () {
|
429
313
|
document.getElementById('todayCard').classList.add('hide')
|
430
314
|
},
|
431
|
-
/**
|
432
|
-
* 返回顶部
|
433
|
-
*/
|
434
315
|
toTop: function () {
|
435
316
|
utils.scrollToDest(0)
|
436
317
|
},
|
437
|
-
/**
|
438
|
-
* 显示控制台
|
439
|
-
*/
|
440
318
|
showConsole: function () {
|
441
319
|
let el = document.getElementById('console')
|
442
320
|
if (!el.classList.contains('show')) {
|
443
321
|
el.classList.add('show')
|
444
322
|
}
|
445
323
|
},
|
446
|
-
/**
|
447
|
-
* 隐藏控制台
|
448
|
-
*/
|
449
324
|
hideConsole: function () {
|
450
325
|
const el = document.getElementById('console')
|
451
326
|
if (el.classList.contains('show')) {
|
452
327
|
el.classList.remove('show')
|
453
328
|
}
|
454
329
|
},
|
455
|
-
/**
|
456
|
-
* 灯箱使用
|
457
|
-
*/
|
458
|
-
lightbox: function () {
|
459
|
-
window.ViewImage && window.ViewImage.init("#article-container img:not(.flink-avatar), .bber-content-img img, #album_detail img, #equipment img, #twikoo .tk-content img:not(.tk-owo-emotion)");
|
460
|
-
},
|
461
|
-
/**
|
462
|
-
* 初始化
|
463
|
-
*/
|
464
|
-
initTheme: function () {
|
465
|
-
let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
|
466
|
-
const cachedMode = saveToLocal.get('theme');
|
467
|
-
if (cachedMode === undefined) {
|
468
|
-
const nowMode =
|
469
|
-
isDarkMode ? 'dark' : 'light'
|
470
|
-
document.documentElement.setAttribute('data-theme', nowMode);
|
471
|
-
saveToLocal.set('theme', nowMode, 0.2);
|
472
|
-
} else {
|
473
|
-
document.documentElement.setAttribute('data-theme', cachedMode);
|
474
|
-
}
|
475
|
-
},
|
476
|
-
/**
|
477
|
-
*
|
478
|
-
*/
|
479
330
|
reflashEssayWaterFall: function () {
|
480
331
|
if (document.getElementById('waterfall')) {
|
481
332
|
setTimeout(function () {
|
@@ -484,38 +335,18 @@ let sco = {
|
|
484
335
|
}, 500);
|
485
336
|
}
|
486
337
|
},
|
487
|
-
/**
|
488
|
-
* 更新站点运行时间
|
489
|
-
*/
|
490
338
|
addRuntime: function () {
|
491
339
|
let el = document.getElementById('runtimeshow')
|
492
340
|
if (el && GLOBAL_CONFIG.runtime) {
|
493
341
|
el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.runtime
|
494
342
|
}
|
495
343
|
},
|
496
|
-
/**
|
497
|
-
* 懒加载图片
|
498
|
-
*/
|
499
|
-
lazyloadImg: function () {
|
500
|
-
window.lazyLoadInstance = new LazyLoad({
|
501
|
-
elements_selector: 'img',
|
502
|
-
threshold: 0,
|
503
|
-
data_src: 'lazy-src',
|
504
|
-
callback_error: (img) => {
|
505
|
-
img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
|
506
|
-
}
|
507
|
-
})
|
508
|
-
},
|
509
|
-
/**
|
510
|
-
* 跳转到输评论
|
511
|
-
* @param txt
|
512
|
-
*/
|
513
344
|
toTalk: function (txt) {
|
514
345
|
const inputs = ["#wl-edit", ".el-textarea__inner"]
|
515
346
|
for (let i = 0; i < inputs.length; i++) {
|
516
347
|
let el = document.querySelector(inputs[i])
|
517
348
|
if (el != null) {
|
518
|
-
el.dispatchEvent(new Event('input', {
|
349
|
+
el.dispatchEvent(new Event('input', {bubble: true, cancelable: true}))
|
519
350
|
el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n'
|
520
351
|
utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
|
521
352
|
el.focus()
|
@@ -527,9 +358,6 @@ let sco = {
|
|
527
358
|
commentTips.classList.add("show");
|
528
359
|
}
|
529
360
|
},
|
530
|
-
/**
|
531
|
-
* 初始化即刻mini
|
532
|
-
*/
|
533
361
|
initbbtalk: function () {
|
534
362
|
if (document.querySelector('#bber-talk')) {
|
535
363
|
let swiper = new Swiper('.swiper-container', {
|
@@ -542,9 +370,6 @@ let sco = {
|
|
542
370
|
});
|
543
371
|
}
|
544
372
|
},
|
545
|
-
/**
|
546
|
-
* 图片添加底部展示信息
|
547
|
-
*/
|
548
373
|
addPhotoFigcaption: function () {
|
549
374
|
let images = document.querySelectorAll('#article-container img');
|
550
375
|
images.forEach((image) => {
|
@@ -560,9 +385,6 @@ let sco = {
|
|
560
385
|
}
|
561
386
|
});
|
562
387
|
},
|
563
|
-
/**
|
564
|
-
* 下载图片并添加水印
|
565
|
-
*/
|
566
388
|
downloadImage: function (imageUrl, filename = 'photo') {
|
567
389
|
if (rm.downloadimging) {
|
568
390
|
utils.snackbarShow("有正在进行中的下载,请稍后再试");
|
@@ -595,10 +417,6 @@ let sco = {
|
|
595
417
|
};
|
596
418
|
img.src = imageUrl;
|
597
419
|
},
|
598
|
-
|
599
|
-
/**
|
600
|
-
* 音乐播放暂停
|
601
|
-
*/
|
602
420
|
musicToggle: function () {
|
603
421
|
const $music = document.querySelector('#nav-music');
|
604
422
|
const $meting = document.querySelector('meting-js');
|
@@ -616,48 +434,33 @@ let sco = {
|
|
616
434
|
}
|
617
435
|
rm.hideRightMenu();
|
618
436
|
},
|
619
|
-
/**
|
620
|
-
* 音乐上一首
|
621
|
-
*/
|
622
437
|
musicSkipBack: function () {
|
623
438
|
document.querySelector('meting-js').aplayer.skipBack()
|
624
439
|
rm.hideRightMenu()
|
625
440
|
},
|
626
|
-
/**
|
627
|
-
* 音乐下一首
|
628
|
-
*/
|
629
441
|
musicSkipForward: function () {
|
630
442
|
document.querySelector('meting-js').aplayer.skipForward()
|
631
443
|
rm.hideRightMenu()
|
632
444
|
},
|
633
|
-
/**
|
634
|
-
* 获取歌曲名称
|
635
|
-
*/
|
636
445
|
musicGetName: function () {
|
637
446
|
const titles = Array.from(document.querySelectorAll('.aplayer-title')).map(e => e.innerText);
|
638
447
|
return titles[0];
|
639
448
|
},
|
640
|
-
/**
|
641
|
-
* 跳转到评论
|
642
|
-
*/
|
643
449
|
scrollToComment: function () {
|
644
450
|
utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
|
645
451
|
},
|
646
|
-
/**
|
647
|
-
* 个人信息顶部文字更新
|
648
|
-
*/
|
649
452
|
setTimeState: function () {
|
650
453
|
const el = document.getElementById('author-info__sayhi');
|
651
454
|
if (el) {
|
652
455
|
const timeNow = new Date();
|
653
456
|
const hours = timeNow.getHours();
|
654
|
-
const lang = GLOBAL_CONFIG.
|
457
|
+
const lang = GLOBAL_CONFIG.aside.sayhello;
|
655
458
|
const greetings = [
|
656
|
-
{
|
657
|
-
{
|
658
|
-
{
|
659
|
-
{
|
660
|
-
{
|
459
|
+
{start: 0, end: 5, text: lang.goodnight},
|
460
|
+
{start: 6, end: 10, text: lang.morning},
|
461
|
+
{start: 11, end: 14, text: lang.noon},
|
462
|
+
{start: 15, end: 18, text: lang.afternoon},
|
463
|
+
{start: 19, end: 24, text: lang.night},
|
661
464
|
];
|
662
465
|
for (let greeting of greetings) {
|
663
466
|
if (hours >= greeting.start && hours <= greeting.end) {
|
@@ -667,9 +470,6 @@ let sco = {
|
|
667
470
|
}
|
668
471
|
}
|
669
472
|
},
|
670
|
-
/**
|
671
|
-
* tagPageActive
|
672
|
-
*/
|
673
473
|
tagPageActive: function () {
|
674
474
|
const currentPath = window.location.pathname;
|
675
475
|
const decodedPath = decodeURIComponent(currentPath);
|
@@ -692,9 +492,6 @@ let sco = {
|
|
692
492
|
}
|
693
493
|
}
|
694
494
|
},
|
695
|
-
/**
|
696
|
-
* categoryBarActive
|
697
|
-
*/
|
698
495
|
categoriesBarActive: function () {
|
699
496
|
const categoryBar = document.querySelector("#category-bar");
|
700
497
|
const currentPath = window.location.pathname;
|
@@ -724,9 +521,6 @@ let sco = {
|
|
724
521
|
}
|
725
522
|
}
|
726
523
|
},
|
727
|
-
/**
|
728
|
-
* categoryBarRightButton
|
729
|
-
*/
|
730
524
|
scrollCategoryBarToRight: function () {
|
731
525
|
let timeoutId;
|
732
526
|
let scrollBar = document.getElementById("category-bar-items");
|
@@ -757,9 +551,6 @@ let sco = {
|
|
757
551
|
});
|
758
552
|
}
|
759
553
|
},
|
760
|
-
/**
|
761
|
-
* 打开侧边栏标签隐藏
|
762
|
-
*/
|
763
554
|
openAllTags: function () {
|
764
555
|
let tagCloudElements = document.querySelectorAll(".card-allinfo .card-tag-cloud");
|
765
556
|
tagCloudElements.forEach(function (tagCloudElement) {
|
@@ -770,9 +561,6 @@ let sco = {
|
|
770
561
|
moreTagsButton.parentNode.removeChild(moreTagsButton);
|
771
562
|
}
|
772
563
|
},
|
773
|
-
/**
|
774
|
-
* 监听底部分页输入框
|
775
|
-
*/
|
776
564
|
listenToPageInputPress: function () {
|
777
565
|
const pageText = document.getElementById("toPageText");
|
778
566
|
const pageButton = document.getElementById("toPageButton");
|
@@ -809,9 +597,6 @@ let sco = {
|
|
809
597
|
}
|
810
598
|
});
|
811
599
|
},
|
812
|
-
/**
|
813
|
-
* 初始化Nav背景
|
814
|
-
*/
|
815
600
|
addNavBackgroundInit: function () {
|
816
601
|
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
817
602
|
if (scrollTop !== 0) {
|
@@ -825,10 +610,6 @@ let sco = {
|
|
825
610
|
}
|
826
611
|
}
|
827
612
|
},
|
828
|
-
/**
|
829
|
-
* 初始化Header
|
830
|
-
* @param change
|
831
|
-
*/
|
832
613
|
initAdjust: function (change = false) {
|
833
614
|
const $blogName = document.getElementById('site-name')
|
834
615
|
let blogNameWidth = $blogName && $blogName.offsetWidth
|
@@ -854,9 +635,6 @@ let sco = {
|
|
854
635
|
|
855
636
|
document.getElementById('nav')?.classList.add('show')
|
856
637
|
},
|
857
|
-
/**
|
858
|
-
* 首页分页跳转
|
859
|
-
*/
|
860
638
|
toPage: function () {
|
861
639
|
const pageNumbers = document.querySelectorAll(".page-number");
|
862
640
|
const maxPageNumber = parseInt(pageNumbers[pageNumbers.length - 1].innerHTML);
|
@@ -897,9 +675,6 @@ let sco = {
|
|
897
675
|
}
|
898
676
|
}
|
899
677
|
|
900
|
-
/*
|
901
|
-
* 代码高亮显示
|
902
|
-
*/
|
903
678
|
class hightlight {
|
904
679
|
static createEle(langEl, item) {
|
905
680
|
const fragment = document.createDocumentFragment()
|
@@ -923,11 +698,10 @@ class hightlight {
|
|
923
698
|
if ($expand.length !== 0) {
|
924
699
|
$expand[0].setAttribute('style', 'display:block')
|
925
700
|
}
|
926
|
-
if (itemHeight
|
927
|
-
$table.setAttribute('style',
|
701
|
+
if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
|
702
|
+
$table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
|
928
703
|
} else {
|
929
|
-
$table.setAttribute('style',
|
930
|
-
ele.classList.remove("expand-done")
|
704
|
+
$table.setAttribute('style', `height: auto`)
|
931
705
|
}
|
932
706
|
}
|
933
707
|
expand = !expand
|
@@ -939,10 +713,10 @@ class hightlight {
|
|
939
713
|
fragment.appendChild(hlTools)
|
940
714
|
const itemHeight = item.clientHeight, $table = item.querySelector('table'),
|
941
715
|
$expand = item.getElementsByClassName('code-expand-btn')
|
942
|
-
if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit
|
716
|
+
if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
|
943
717
|
$table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
|
944
718
|
ele.className = 'code-expand-btn'
|
945
|
-
ele.innerHTML = '<i class="scoicon sco-show-line"
|
719
|
+
ele.innerHTML = '<i class="scoicon sco-show-line"></i>'
|
946
720
|
ele.addEventListener('click', (e) => {
|
947
721
|
$table.setAttribute('style', `height: ${itemHeight}px`)
|
948
722
|
e.target.classList.add('expand-done')
|
@@ -951,7 +725,13 @@ class hightlight {
|
|
951
725
|
fragment.appendChild(ele)
|
952
726
|
}
|
953
727
|
item.insertBefore(fragment, item.firstChild)
|
954
|
-
|
728
|
+
if (!expand) {
|
729
|
+
hlTools.children[0].classList.add('closed')
|
730
|
+
$table.setAttribute('style', 'display:none')
|
731
|
+
if ($expand.length !== 0) {
|
732
|
+
$expand[0].setAttribute('style', 'display:none')
|
733
|
+
}
|
734
|
+
}
|
955
735
|
}
|
956
736
|
|
957
737
|
static init() {
|
@@ -1017,17 +797,15 @@ window.refreshFn = () => {
|
|
1017
797
|
sco.listenToPageInputPress()
|
1018
798
|
sco.addNavBackgroundInit()
|
1019
799
|
GLOBAL_CONFIG.rightside.enable && addRightMenuClickEvent()
|
1020
|
-
GLOBAL_CONFIG.lazyload.enable &&
|
1021
|
-
GLOBAL_CONFIG.lightbox &&
|
800
|
+
GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg()
|
801
|
+
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar)"))
|
1022
802
|
GLOBAL_CONFIG.randomlinks && randomLinksList()
|
1023
803
|
PAGE_CONFIG.comment && initComment()
|
1024
804
|
PAGE_CONFIG.toc && toc.init();
|
1025
805
|
(PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) && ((GLOBAL_CONFIG.hightlight.enable && hightlight.init()) || tabs.init())
|
1026
|
-
PAGE_CONFIG.is_home &&
|
806
|
+
PAGE_CONFIG.is_home && showTodayCard()
|
1027
807
|
GLOBAL_CONFIG.covercolor.enable && coverColor()
|
1028
808
|
sco.initConsoleState()
|
1029
|
-
document.getElementById('history-baidu') && sco.card_history()
|
1030
|
-
document.getElementById('welcome-info') && sco.card_welcome()
|
1031
809
|
GLOBAL_CONFIG.comment.commentBarrage && PAGE_CONFIG.comment && initializeCommentBarrage()
|
1032
810
|
document.body.setAttribute('data-type', PAGE_CONFIG.page)
|
1033
811
|
PAGE_CONFIG.page === "music" && scoMusic.init()
|
@@ -1035,8 +813,6 @@ window.refreshFn = () => {
|
|
1035
813
|
GLOBAL_CONFIG.ai.enable && PAGE_CONFIG.page === "post" && ScoAI.init()
|
1036
814
|
}
|
1037
815
|
|
1038
|
-
sco.initTheme()
|
1039
|
-
|
1040
816
|
document.addEventListener('DOMContentLoaded', function () {
|
1041
817
|
window.refreshFn()
|
1042
818
|
})
|
package/source/js/music.js
CHANGED
File without changes
|