hexo-theme-solitude 1.9.2 → 1.10.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/ISSUE_TEMPLATE/config.yml +5 -1
- package/CODE_OF_CONDUCT.md +53 -93
- package/_config.yml +19 -0
- package/languages/default.yml +12 -7
- package/languages/en.yml +12 -7
- package/languages/zh-CN.yml +8 -3
- package/languages/zh-TW.yml +7 -4
- package/layout/includes/footer.pug +12 -11
- package/layout/includes/head/opengraph.pug +1 -0
- package/layout/includes/inject/head.pug +3 -3
- package/layout/includes/page/message.pug +5 -0
- package/layout/includes/page/music.pug +2 -2
- package/layout/includes/widgets/aside/asideArchive.pug +1 -1
- package/layout/includes/widgets/page/message/content.pug +9 -0
- package/layout/includes/widgets/page/message/js.pug +8 -0
- package/layout/includes/widgets/page/message/twikoo.pug +44 -0
- package/layout/includes/widgets/page/message/valine.pug +48 -0
- package/layout/includes/widgets/page/message/waline.pug +0 -0
- package/layout/includes/widgets/randomlink.pug +10 -4
- package/layout/includes/widgets/third-party/news-comment/artalk.pug +3 -3
- package/layout/includes/widgets/third-party/news-comment/twikoo.pug +3 -3
- package/layout/includes/widgets/third-party/news-comment/valine.pug +3 -3
- package/layout/includes/widgets/third-party/news-comment/waline.pug +3 -3
- package/layout/page.pug +2 -0
- package/package.json +2 -2
- package/plugins.yml +6 -6
- package/scripts/event/cdn.js +6 -1
- package/source/css/_global/index.styl +8 -13
- package/source/css/_highlight/highlight/diff.styl +6 -2
- package/source/css/_highlight/highlight/index.styl +1 -0
- package/source/css/_layout/article-container.styl +9 -3
- package/source/css/_layout/aside.styl +1 -0
- package/source/css/_layout/console.styl +3 -1
- package/source/css/_layout/footer.styl +27 -28
- package/source/css/_page/_home/category-bar.styl +16 -1
- package/source/css/_page/index.styl +1 -1
- package/source/css/_page/message.styl +63 -0
- package/source/css/_page/music.styl +55 -72
- package/source/css/_page/tag.styl +1 -0
- package/source/css/_tags/mermaid.styl +4 -1
- package/source/css/_tags/note.styl +5 -0
- package/source/css/third_party/snackbar.min.css +1 -1
- package/source/js/main.js +1 -1
- package/source/js/music.js +1 -0
- package/source/js/third_party/barrage.min.js +6 -0
- package/source/js/third_party/efu_ai.min.js +4 -4
- package/source/js/third_party/envelope.min.js +5 -0
- package/source/js/third_party/universe.min.js +1 -1
- package/source/css/_page/douban.styl +0 -127
- package/source/js/barrage_comment.js +0 -77
@@ -1,77 +0,0 @@
|
|
1
|
-
class Barrage {
|
2
|
-
constructor(comments) {
|
3
|
-
this.comments = comments;
|
4
|
-
this.dom = document.querySelector(".comment-barrage");
|
5
|
-
this.barrageList = [];
|
6
|
-
this.barrageIndex = 0;
|
7
|
-
this.barrageTimer = [];
|
8
|
-
this.hoverOnCommentBarrage = false;
|
9
|
-
this.init();
|
10
|
-
}
|
11
|
-
|
12
|
-
filterAndFlatten = (comments) => {
|
13
|
-
return (comments.flatMap(comment => comment.replies ? [comment, ...this.filterAndFlatten(comment.replies)] : [comment]))
|
14
|
-
}
|
15
|
-
|
16
|
-
sanitizeContent(content) {
|
17
|
-
return content.replace(/(<([^>]+)>)/ig, '').trim();
|
18
|
-
}
|
19
|
-
|
20
|
-
createBarrageItem(comment) {
|
21
|
-
const content = this.sanitizeContent(comment.content);
|
22
|
-
if (!content) return false;
|
23
|
-
const element = document.createElement("div");
|
24
|
-
element.className = "comment-barrage-item";
|
25
|
-
element.innerHTML = `<div class="barrageHead"><a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">${GLOBAL_CONFIG.lang.barrage.title}</a><div class="barrageNick">${comment.nick}</div><img class="barrageAvatar" src="${GLOBAL_CONFIG.comment.avatar}/avatar/${comment.mailMd5}"/><a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="solitude st-close-fill"></i></a></div><a class="barrageContent" href="${comment.id ? `javascript:sco.scrollTo(\'${comment.id}\')` : 'javascript:sco.scrollTo(\'post-comment\')'}">${content}</a>`;
|
26
|
-
this.dom.appendChild(element);
|
27
|
-
this.barrageTimer.push(element);
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
|
31
|
-
removeBarrageItem(element) {
|
32
|
-
element.classList.add("out");
|
33
|
-
setTimeout(() => this.dom.removeChild(element), 1000);
|
34
|
-
}
|
35
|
-
|
36
|
-
manageBarrage() {
|
37
|
-
if (this.barrageList.length && !this.hoverOnCommentBarrage) {
|
38
|
-
if (!this.createBarrageItem(this.barrageList[this.barrageIndex])) {
|
39
|
-
this.barrageIndex = (this.barrageIndex + 1) % this.barrageList.length;
|
40
|
-
return this.manageBarrage();
|
41
|
-
}
|
42
|
-
this.barrageIndex = (this.barrageIndex + 1) % this.barrageList.length;
|
43
|
-
}
|
44
|
-
if (this.barrageTimer.length > Math.min(1, this.barrageList.length) && !this.hoverOnCommentBarrage) {
|
45
|
-
this.removeBarrageItem(this.barrageTimer.shift());
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
initBarrage() {
|
50
|
-
const storageSwitch = utils.saveToLocal.get("commentBarrageSwitch");
|
51
|
-
this.dom.style.display = storageSwitch ? "flex" : "none";
|
52
|
-
this.barrageList = this.filterAndFlatten(this.comments);
|
53
|
-
this.dom.innerHTML = "";
|
54
|
-
clearInterval(this.commentInterval);
|
55
|
-
this.commentInterval = setInterval(() => this.manageBarrage(), 5000);
|
56
|
-
}
|
57
|
-
|
58
|
-
init() {
|
59
|
-
this.initBarrage();
|
60
|
-
this.dom.addEventListener('mouseover', () => this.hoverOnCommentBarrage = true);
|
61
|
-
this.dom.addEventListener('mouseout', () => this.hoverOnCommentBarrage = false);
|
62
|
-
}
|
63
|
-
|
64
|
-
destroy() {
|
65
|
-
clearInterval(this.commentInterval);
|
66
|
-
this.dom.removeEventListener('mouseover', () => this.hoverOnCommentBarrage = true)
|
67
|
-
this.dom.removeEventListener('mouseout', () => this.hoverOnCommentBarrage = false)
|
68
|
-
this.dom.innerHTML = ""
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
function initializeCommentBarrage(array) {
|
73
|
-
if (array.length === 0) return;
|
74
|
-
let existingBarrage = window.currentBarrage;
|
75
|
-
if (existingBarrage) existingBarrage.destroy();
|
76
|
-
window.currentBarrage = new Barrage(array);
|
77
|
-
}
|