hexo-theme-stellar 1.24.1 → 1.26.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/_config.yml +122 -50
- package/_data/icons.yml +33 -0
- package/_data/widgets.yml +2 -16
- package/languages/en.yml +2 -1
- package/languages/zh-CN.yml +3 -2
- package/languages/zh-TW.yml +3 -2
- package/layout/404.ejs +2 -4
- package/layout/_partial/cover/index.ejs +5 -5
- package/layout/_partial/cover/post_cover.ejs +1 -1
- package/layout/_partial/cover/wiki_cover.ejs +2 -2
- package/layout/_partial/head.ejs +6 -9
- package/layout/_partial/main/article/article_footer.ejs +16 -24
- package/layout/_partial/main/article/read_next.ejs +13 -13
- package/layout/_partial/main/article/related_posts.ejs +1 -1
- package/layout/_partial/main/footer.ejs +1 -1
- package/layout/_partial/main/navbar/article_top_area.ejs +35 -0
- package/layout/_partial/main/navbar/author_banner.ejs +1 -3
- package/layout/_partial/main/navbar/breadcrumb/blog.ejs +34 -0
- package/layout/_partial/main/navbar/breadcrumb/page.ejs +10 -0
- package/layout/_partial/main/navbar/breadcrumb/wiki.ejs +20 -0
- package/layout/_partial/main/navbar/dateinfo.ejs +32 -0
- package/layout/_partial/main/navbar/ghinfo.ejs +25 -0
- package/layout/_partial/main/navbar/{list_post.ejs → nav_tabs_blog.ejs} +15 -7
- package/layout/_partial/main/navbar/{list_wiki.ejs → nav_tabs_wiki.ejs} +15 -1
- package/layout/_partial/main/post_list/paginator.ejs +1 -1
- package/layout/_partial/main/post_list/post_card.ejs +4 -15
- package/layout/_partial/main/post_list/topic_card.ejs +16 -0
- package/layout/_partial/menubtn.ejs +1 -1
- package/layout/_partial/plugins/ai/tianli_gpt.ejs +4 -3
- package/layout/_partial/plugins/comments/artalk/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/artalk/script.ejs +1 -1
- package/layout/_partial/plugins/comments/beaudar/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/giscus/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/layout.ejs +3 -3
- package/layout/_partial/plugins/comments/twikoo/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/utterances/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/waline/layout.ejs +1 -1
- package/layout/_partial/sidebar/index.ejs +92 -83
- package/layout/_partial/sidebar/logo.ejs +87 -0
- package/layout/_partial/sidebar/menu.ejs +23 -18
- package/layout/_partial/sidebar/search.ejs +42 -0
- package/layout/_partial/widgets/components/link.ejs +21 -0
- package/layout/_partial/widgets/components/linklist.ejs +27 -0
- package/layout/_partial/widgets/ghissues.ejs +7 -9
- package/layout/_partial/widgets/ghrepo.ejs +10 -12
- package/layout/_partial/widgets/ghuser.ejs +2 -6
- package/layout/_partial/widgets/linklist.ejs +17 -0
- package/layout/_partial/widgets/markdown.ejs +5 -2
- package/layout/_partial/widgets/recent.ejs +12 -8
- package/layout/_partial/widgets/related.ejs +51 -20
- package/layout/_partial/widgets/search.ejs +0 -40
- package/layout/_partial/widgets/tagcloud.ejs +2 -2
- package/layout/_partial/widgets/timeline.ejs +2 -2
- package/layout/_partial/widgets/toc.ejs +61 -53
- package/layout/archive.ejs +3 -3
- package/layout/categories.ejs +2 -2
- package/layout/index.ejs +10 -62
- package/layout/index_topic.ejs +28 -0
- package/layout/index_wiki.ejs +42 -0
- package/layout/layout.ejs +53 -21
- package/layout/page.ejs +60 -13
- package/layout/tags.ejs +2 -2
- package/package.json +2 -2
- package/scripts/events/index.js +5 -0
- package/scripts/events/lib/authors.js +1 -1
- package/scripts/events/lib/config.js +28 -24
- package/scripts/events/lib/doc_tree.js +27 -19
- package/scripts/events/lib/merge_posts.js +46 -0
- package/scripts/events/lib/topic_tree.js +45 -0
- package/scripts/generators/404.js +8 -3
- package/scripts/generators/author.js +4 -2
- package/scripts/generators/categories.js +4 -4
- package/scripts/generators/tags.js +4 -4
- package/scripts/generators/topic.js +21 -0
- package/scripts/generators/wiki.js +30 -28
- package/scripts/helpers/category_color.js +1 -1
- package/scripts/helpers/icon.js +16 -0
- package/scripts/helpers/parse_config.js +20 -18
- package/scripts/helpers/scrollreveal.js +6 -6
- package/scripts/tags/lib/audio.js +9 -4
- package/scripts/tags/lib/navbar.js +1 -1
- package/scripts/tags/lib/toc.js +1 -1
- package/scripts/tags/lib/video.js +8 -8
- package/source/css/_common/blur.styl +5 -9
- package/source/css/_common/cap.styl +1 -1
- package/source/css/_common/device.styl +2 -2
- package/source/css/_common/highlight.styl +3 -2
- package/source/css/_common/layout.styl +6 -0
- package/source/css/_common/svg.styl +3 -0
- package/source/css/_custom.styl +9 -2
- package/source/css/_defines/theme.styl +10 -0
- package/source/css/_layout/layout.styl +17 -4
- package/source/css/_layout/list.styl +5 -2
- package/source/css/_layout/main.styl +5 -4
- package/source/css/_layout/md.styl +12 -11
- package/source/css/_layout/partial/paginator.styl +2 -2
- package/source/css/_layout/partial/related.styl +3 -0
- package/source/css/_layout/sidebar/footer.styl +4 -31
- package/source/css/_layout/sidebar/{header.styl → logo.styl} +11 -41
- package/source/css/_layout/sidebar/menu.styl +53 -0
- package/source/css/_layout/sidebar/nav-area.styl +2 -0
- package/source/css/_layout/sidebar/search.styl +106 -0
- package/source/css/_layout/sidebar/sidebar.styl +21 -31
- package/source/css/_layout/tag-plugins/banner.styl +9 -7
- package/source/css/_layout/tag-plugins/frame.styl +1 -1
- package/source/css/_layout/tag-plugins/okr.styl +0 -1
- package/source/css/_layout/tag-plugins/tabs.styl +2 -2
- package/source/css/_layout/tag-plugins/toc.styl +1 -1
- package/source/css/_layout/widgets/components.styl +49 -0
- package/source/css/_layout/widgets/ghrepo.styl +0 -1
- package/source/css/_layout/widgets/ghuser.styl +0 -23
- package/source/css/_layout/widgets/list.styl +28 -0
- package/source/css/_layout/widgets/markdown.styl +20 -0
- package/source/css/_layout/widgets/related.styl +36 -5
- package/source/css/_layout/widgets/timeline.styl +21 -2
- package/source/css/_layout/widgets/toc_blog.styl +1 -1
- package/source/css/_layout/widgets/toc_common.styl +12 -12
- package/source/css/_layout/widgets/toc_wiki.styl +38 -25
- package/source/css/_layout/widgets/widgets.styl +25 -20
- package/source/css/_plugins/comments/twikoo.styl +9 -9
- package/source/css/_plugins/scrollreveal.styl +1 -1
- package/source/css/_plugins/tianli_gpt.styl +12 -14
- package/source/js/main.js +5 -2
- package/source/js/plugins/copycode.js +3 -3
- package/source/js/plugins/fcircle.js +1 -1
- package/source/js/plugins/friends.js +1 -1
- package/source/js/plugins/memos.js +1 -1
- package/source/js/plugins/sites.js +2 -2
- package/source/js/plugins/weibo.js +1 -1
- package/layout/_partial/main/header/index.ejs +0 -3
- package/layout/_partial/main/navbar/breadcrumb.ejs +0 -139
- package/layout/_partial/sidebar/header.ejs +0 -59
- package/layout/post.ejs +0 -33
- package/layout/wiki.ejs +0 -43
- package/source/css/_layout/widgets/recent.styl +0 -15
- package/source/css/_layout/widgets/search.styl +0 -102
|
@@ -1,34 +1,48 @@
|
|
|
1
1
|
<%
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let proj = theme.wiki.tree[page.wiki];
|
|
12
|
-
if (proj?.sidebar) {
|
|
13
|
-
page.sidebar = proj.sidebar;
|
|
14
|
-
} else {
|
|
15
|
-
page.sidebar = theme.sidebar.widgets.wiki;
|
|
16
|
-
}
|
|
17
|
-
} else if (is_home()) {
|
|
18
|
-
page.sidebar = theme.sidebar.widgets.home;
|
|
2
|
+
|
|
3
|
+
const wiki = theme.wiki.tree[page.wiki]
|
|
4
|
+
const topic = theme.topic.tree[page.topic]
|
|
5
|
+
|
|
6
|
+
if (page.sidebar == null) {
|
|
7
|
+
const { site_tree } = theme
|
|
8
|
+
var sidebar
|
|
9
|
+
if (is_home()) {
|
|
10
|
+
sidebar = site_tree.home.sidebar
|
|
19
11
|
} else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
|
|
20
|
-
|
|
21
|
-
} else if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
sidebar = site_tree.index_blog.sidebar
|
|
13
|
+
} else if (page.layout === 'index_topic') {
|
|
14
|
+
// 专栏列表页等同于博客列表页
|
|
15
|
+
sidebar = site_tree.index_blog.sidebar
|
|
16
|
+
} else if (page.topic?.length > 0) {
|
|
17
|
+
// 专栏文章内页等同于普通文章内页
|
|
18
|
+
sidebar = site_tree.post.sidebar
|
|
19
|
+
} else if (page.layout === 'index_wiki') {
|
|
20
|
+
sidebar = site_tree.index_wiki.sidebar
|
|
21
|
+
} else if (page.wiki?.length > 0) {
|
|
22
|
+
sidebar = site_tree.wiki.sidebar
|
|
23
|
+
} else if (page.layout === '404') {
|
|
24
|
+
sidebar = site_tree.error_page.sidebar
|
|
25
|
+
} else if (page.layout === 'page') {
|
|
26
|
+
sidebar = site_tree.page.sidebar
|
|
27
|
+
} else if (page.layout === 'post') {
|
|
28
|
+
sidebar = site_tree.post.sidebar
|
|
29
|
+
} else if (page.layout == null) {
|
|
30
|
+
sidebar = site_tree.page.sidebar
|
|
27
31
|
} else {
|
|
28
|
-
|
|
32
|
+
sidebar = []
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (topic?.sidebar) {
|
|
36
|
+
sidebar = topic.sidebar
|
|
29
37
|
}
|
|
38
|
+
if (wiki?.sidebar) {
|
|
39
|
+
sidebar = wiki.sidebar
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
page.sidebar = sidebar
|
|
30
43
|
}
|
|
31
44
|
|
|
45
|
+
|
|
32
46
|
// parse array string
|
|
33
47
|
if (typeof page.sidebar == 'string') {
|
|
34
48
|
page.sidebar = page.sidebar.replace(/ /g, '').split(',');
|
|
@@ -52,31 +66,6 @@ function layoutTitle(main, url, sub) {
|
|
|
52
66
|
function layoutWidgets() {
|
|
53
67
|
var el = '';
|
|
54
68
|
el += '<div class="widgets">';
|
|
55
|
-
if (page.layout == 'wiki' && proj && page.menu_id == 'wiki') {
|
|
56
|
-
el += '<widget class="widget-wrapper logo-wrap wiki"><div class="widget-body">';
|
|
57
|
-
// all products
|
|
58
|
-
el += '<a style="filter: grayscale(100%)" class="wiki-home cap" href="' + url_for(config.wiki_dir) + '">';
|
|
59
|
-
el += '<svg aria-hidden="true" viewBox="0 0 16 16" width="1.2em" height="1.2em" fill="currentColor"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>';
|
|
60
|
-
el += __('btn.all_wiki');
|
|
61
|
-
el += '</a>';
|
|
62
|
-
// this product
|
|
63
|
-
if (proj == undefined) {
|
|
64
|
-
// 如果没有项目名,则使用menu中显示的名字
|
|
65
|
-
if (page.menu_id && theme.sidebar.menu[page.menu_id] && md_link(theme.sidebar.menu[page.menu_id])) {
|
|
66
|
-
proj = {
|
|
67
|
-
path: md_link(theme.sidebar.menu[page.menu_id]),
|
|
68
|
-
wiki: __(md_text(theme.sidebar.menu[page.menu_id]))
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (proj != undefined) {
|
|
73
|
-
let main = proj.name || proj.title || page.wiki || page.title;
|
|
74
|
-
let url = proj.homepage.path;
|
|
75
|
-
let sub = proj.subtitle;
|
|
76
|
-
el += layoutTitle(main, url, sub);
|
|
77
|
-
}
|
|
78
|
-
el += '</div></widget>';
|
|
79
|
-
}
|
|
80
69
|
if (page.sidebar) {
|
|
81
70
|
page.sidebar.forEach((w, i) => {
|
|
82
71
|
let name = ''
|
|
@@ -86,8 +75,8 @@ function layoutWidgets() {
|
|
|
86
75
|
} else if (typeof w == 'object' && w.override) {
|
|
87
76
|
name = w.override
|
|
88
77
|
}
|
|
89
|
-
if (name in theme.
|
|
90
|
-
Object.assign(widget, theme.
|
|
78
|
+
if (name in theme.widgets) {
|
|
79
|
+
Object.assign(widget, theme.widgets[name])
|
|
91
80
|
}
|
|
92
81
|
if (typeof w == 'object' && (w.override || w.layout)) {
|
|
93
82
|
Object.assign(widget, w)
|
|
@@ -101,42 +90,62 @@ function layoutWidgets() {
|
|
|
101
90
|
return el;
|
|
102
91
|
}
|
|
103
92
|
function layoutFooterDiv() {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
} else
|
|
122
|
-
|
|
123
|
-
el += ' onclick="' + item.onclick + '"';
|
|
93
|
+
const { social } = theme.footer
|
|
94
|
+
if (social == null) {
|
|
95
|
+
return ''
|
|
96
|
+
}
|
|
97
|
+
var el = '<footer class="footer dis-select">';
|
|
98
|
+
el += '<div class="social-wrap">';
|
|
99
|
+
for (let id of Object.keys(social)) {
|
|
100
|
+
let item = social[id];
|
|
101
|
+
if (item.icon && (item.url || item.onclick)) {
|
|
102
|
+
el += '<a class="social"';
|
|
103
|
+
if (item.title) {
|
|
104
|
+
el += ' title="' + item.title + '"';
|
|
105
|
+
}
|
|
106
|
+
if (item.url) {
|
|
107
|
+
el += ' href="' + url_for(item.url) + '"';
|
|
108
|
+
if (item.url.includes('://')) {
|
|
109
|
+
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
110
|
+
} else {
|
|
111
|
+
el += ' rel="noopener noreferrer"';
|
|
124
112
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
el += '
|
|
113
|
+
} else if (item.onclick) {
|
|
114
|
+
item.onclick = item.onclick.replace(/"|\'/g, '"');
|
|
115
|
+
el += ' onclick="' + item.onclick + '"';
|
|
128
116
|
}
|
|
117
|
+
el += '>';
|
|
118
|
+
el += item.icon;
|
|
119
|
+
el += '</a>';
|
|
129
120
|
}
|
|
130
|
-
el += '</div>';
|
|
131
|
-
el += '</footer>';
|
|
132
|
-
return el;
|
|
133
|
-
} else {
|
|
134
|
-
return '';
|
|
135
121
|
}
|
|
122
|
+
el += '</div>';
|
|
123
|
+
el += '</footer>';
|
|
124
|
+
return el;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function layoutLogo() {
|
|
128
|
+
return partial('logo', {where: 'sidebar'})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function layoutNavArea() {
|
|
132
|
+
var search = {}
|
|
133
|
+
if (page.search) {
|
|
134
|
+
search = page.search
|
|
135
|
+
} else if (wiki?.search) {
|
|
136
|
+
search = wiki.search
|
|
137
|
+
} else if (topic?.search) {
|
|
138
|
+
search = topic.search
|
|
139
|
+
}
|
|
140
|
+
var el = ''
|
|
141
|
+
el += `<div class="nav-area">`
|
|
142
|
+
el += partial('search', {item: search})
|
|
143
|
+
el += partial('menu', {where: 'sidebar'})
|
|
144
|
+
el += `</div>`
|
|
145
|
+
return el
|
|
136
146
|
}
|
|
137
147
|
%>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<% } %>
|
|
148
|
+
<%- layoutLogo() %>
|
|
149
|
+
<%- layoutNavArea() %>
|
|
141
150
|
<%- layoutWidgets() %>
|
|
142
151
|
<%- layoutFooterDiv() %>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<%
|
|
2
|
+
var logo = theme.logo
|
|
3
|
+
if (page.logo) {
|
|
4
|
+
logo = Object.assign({}, logo, page.logo)
|
|
5
|
+
} else if (theme.wiki.tree[page.wiki]) {
|
|
6
|
+
const proj = theme.wiki.tree[page.wiki]
|
|
7
|
+
var l = proj.logo
|
|
8
|
+
if (l) {
|
|
9
|
+
logo = l
|
|
10
|
+
} else if (proj.name || proj.icon) {
|
|
11
|
+
logo = {
|
|
12
|
+
icon: proj.icon || theme.default.project,
|
|
13
|
+
title: `[${proj.name || proj.title}](${url_for(proj.homepage?.path || '')})`,
|
|
14
|
+
subtitle: proj.subtitle
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} else if (theme.topic.tree[page.topic]) {
|
|
18
|
+
const topic = theme.topic.tree[page.topic]
|
|
19
|
+
var l = topic.logo
|
|
20
|
+
if (l) {
|
|
21
|
+
logo = l
|
|
22
|
+
} else if (topic.name || topic.icon) {
|
|
23
|
+
logo = {
|
|
24
|
+
icon: topic.icon || theme.default.topic,
|
|
25
|
+
title: `[${topic.name || topic.title}](${url_for(topic.homepage?.path || '')})`,
|
|
26
|
+
subtitle: topic.subtitle
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// logo.icon, logo.title, logo.subtitle, logo.url
|
|
32
|
+
function layoutTitle(main, url, sub) {
|
|
33
|
+
var el = ''
|
|
34
|
+
el += `<a class="title" href="${url_for(url || "/")}">`
|
|
35
|
+
el += `<div class="main" ff="title">${main}</div>`
|
|
36
|
+
if (sub) {
|
|
37
|
+
const arr = sub.split('|')
|
|
38
|
+
if (arr.length > 1) {
|
|
39
|
+
el += `<div class="sub normal cap">${arr.shift().trim()}</div>`
|
|
40
|
+
el += `<div class="sub hover cap" style="opacity:0">${arr.join('|')}</div>`
|
|
41
|
+
} else {
|
|
42
|
+
el += `<div class="sub cap">${sub}</div>`
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
el += `</a>`
|
|
46
|
+
return el
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function layoutDiv() {
|
|
50
|
+
if (where == 'main') {
|
|
51
|
+
if (page.header == false) {
|
|
52
|
+
return ''
|
|
53
|
+
}
|
|
54
|
+
// 内容页如果未设置 header 则不显示
|
|
55
|
+
if (page.header == null) {
|
|
56
|
+
if (!page.nav_tabs) { // 如果有 nav_tabs 就代表是列表页
|
|
57
|
+
if (page.layout === 'post' || page.layout === 'page' || page.wiki) {
|
|
58
|
+
return ''
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
var el = ''
|
|
64
|
+
el += `<header class="header${where == 'main' ? ' mobile-only' : ''}">`
|
|
65
|
+
el += `<div class="logo-wrap">`
|
|
66
|
+
if (logo.icon) {
|
|
67
|
+
el += `<div class="icon"><img no-lazy class="icon" src="${md_text(logo.icon)}"></div>`
|
|
68
|
+
} else if (md_text(logo.avatar)) {
|
|
69
|
+
el += `<a class="avatar" href="${url_for(md_link(logo.avatar) || '/')}">`
|
|
70
|
+
if (theme.style.animated_avatar.animate) {
|
|
71
|
+
el += `<div class="bg" style="opacity:0;background-image:url(${theme.style.animated_avatar.background});"></div>`
|
|
72
|
+
}
|
|
73
|
+
el += `<img no-lazy class="avatar" src="${md_text(logo.avatar)}">`
|
|
74
|
+
el += `</a>`
|
|
75
|
+
}
|
|
76
|
+
const main = md_text(logo.title)
|
|
77
|
+
if (main) {
|
|
78
|
+
let url = md_link(logo.title)
|
|
79
|
+
el += layoutTitle(main, url, logo.subtitle)
|
|
80
|
+
}
|
|
81
|
+
el += `</div>`
|
|
82
|
+
el += '</header>'
|
|
83
|
+
return el
|
|
84
|
+
}
|
|
85
|
+
%>
|
|
86
|
+
|
|
87
|
+
<%- layoutDiv() %>
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function layoutDiv() {
|
|
3
|
-
var el = ''
|
|
4
|
-
el +=
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
continue;
|
|
3
|
+
var el = ''
|
|
4
|
+
el += `<nav class="menu dis-select${where == 'main' ? ' mobile-hidden' : ''}">`
|
|
5
|
+
for (let item of theme.menubar.items) {
|
|
6
|
+
if (item == undefined || item.id == null || item.url == null) {
|
|
7
|
+
continue
|
|
8
|
+
}
|
|
9
|
+
el += `<a class="nav-item${item.id == page.menu_id ? ' active' : ''}" title="${item.title}" href="${url_for(item.url)}"`
|
|
10
|
+
if (item.theme?.length > 0) {
|
|
11
|
+
el += ` style="color:${item.theme}"`
|
|
13
12
|
}
|
|
14
|
-
el +=
|
|
15
|
-
if (
|
|
16
|
-
|
|
13
|
+
el += `>`
|
|
14
|
+
if (item.icon?.length > 0) {
|
|
15
|
+
if (item.icon.startsWith('<')) {
|
|
16
|
+
el += item.icon
|
|
17
|
+
} else if (theme.icons[item.icon]) {
|
|
18
|
+
el += theme.icons[item.icon]
|
|
19
|
+
} else {
|
|
20
|
+
el += `<img no-lazy src="${item.icon}">`
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
el += `<span>${__(item.title)}</span>`
|
|
17
24
|
}
|
|
18
|
-
el +=
|
|
19
|
-
el += __(md_text(item));
|
|
20
|
-
el += '</a>';
|
|
25
|
+
el += `</a>`
|
|
21
26
|
}
|
|
22
|
-
el +=
|
|
23
|
-
return el
|
|
27
|
+
el += `</nav>`
|
|
28
|
+
return el
|
|
24
29
|
}
|
|
25
30
|
%>
|
|
26
31
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<%
|
|
2
|
+
if (item.filter == null) {
|
|
3
|
+
item.filter = 'auto'
|
|
4
|
+
}
|
|
5
|
+
function layoutDiv() {
|
|
6
|
+
var el = ''
|
|
7
|
+
el += `<div class="search-wrapper" id="search-wrapper">`
|
|
8
|
+
el += `<form class="search-form">`
|
|
9
|
+
var filter = ''
|
|
10
|
+
if (item.filter == 'auto') {
|
|
11
|
+
if (page.wiki) {
|
|
12
|
+
let matches = page.path.match(/(.*?)\/(.*?)\//i)
|
|
13
|
+
if (matches?.length > 0) {
|
|
14
|
+
filter = matches[0]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (item.filter?.length > 0) {
|
|
19
|
+
filter = item.filter
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
el += `<a class="search-button" onclick="document.getElementById("search-input").focus();">`
|
|
23
|
+
el += icon('default:search')
|
|
24
|
+
el += `</a>`
|
|
25
|
+
el += `<input type="text" class="search-input" id="search-input"`
|
|
26
|
+
if (filter.length > 0) {
|
|
27
|
+
if (!filter.startsWith('/')) {
|
|
28
|
+
filter = '/' + filter
|
|
29
|
+
}
|
|
30
|
+
el += ` data-filter="${filter}"`
|
|
31
|
+
el += ` placeholder="${item.placeholder || __('search.search_in', filter)}">`
|
|
32
|
+
} else {
|
|
33
|
+
el += ` placeholder="${item.placeholder || __('search.search')}">`
|
|
34
|
+
}
|
|
35
|
+
el += `</form>`
|
|
36
|
+
el += `<div id="search-result"></div>`
|
|
37
|
+
el += `<div class="search-no-result">${__('search.no_results')}</div>`
|
|
38
|
+
el += `</div>`
|
|
39
|
+
return el
|
|
40
|
+
}
|
|
41
|
+
%>
|
|
42
|
+
<%- layoutDiv() %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
var el = ''
|
|
4
|
+
const isActive = url_for(item.url) == url_for(page.path)
|
|
5
|
+
el += `<a class="link${isActive ? ' active' : ''}" title="${item.title}" href="${item.url}">`
|
|
6
|
+
el += `<div class="flex">`
|
|
7
|
+
if (item.icon) {
|
|
8
|
+
el += icon(item.icon)
|
|
9
|
+
}
|
|
10
|
+
if (columns <= 2) {
|
|
11
|
+
el += `<span>${item.title}</span>`
|
|
12
|
+
}
|
|
13
|
+
el += `</div>`
|
|
14
|
+
if (columns == 1 && isActive) {
|
|
15
|
+
el += icon('default:bookmark.active')
|
|
16
|
+
}
|
|
17
|
+
el += `</a>`
|
|
18
|
+
return el
|
|
19
|
+
}
|
|
20
|
+
%>
|
|
21
|
+
<%- layoutDiv() %>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv(linklist) {
|
|
3
|
+
var links = linklist.items || []
|
|
4
|
+
if (links.length == 0) {
|
|
5
|
+
return ''
|
|
6
|
+
}
|
|
7
|
+
var el = ''
|
|
8
|
+
var style = ''
|
|
9
|
+
var columns = linklist.columns || links.length
|
|
10
|
+
if (links.length == 1) {
|
|
11
|
+
style += `style="grid-template-columns:repeat(1,1fr);"`
|
|
12
|
+
} else {
|
|
13
|
+
style += `style="grid-template-columns:repeat(${columns},1fr);"`
|
|
14
|
+
}
|
|
15
|
+
var align = 'center'
|
|
16
|
+
if (columns == 1 && links.length > 1) {
|
|
17
|
+
align = 'left'
|
|
18
|
+
}
|
|
19
|
+
el += `<div class="linklist ${align}" ${style}>`
|
|
20
|
+
for (let link of links) {
|
|
21
|
+
el += partial('link', {item: link, columns: columns})
|
|
22
|
+
}
|
|
23
|
+
el += `</div>`
|
|
24
|
+
return el
|
|
25
|
+
}
|
|
26
|
+
%>
|
|
27
|
+
<%- layoutDiv(item) %>
|
|
@@ -5,13 +5,11 @@ function layoutDiv() {
|
|
|
5
5
|
var branch = 'main';
|
|
6
6
|
if (page.repo) {
|
|
7
7
|
repo = page.repo
|
|
8
|
-
} else if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
branch = proj.branch;
|
|
14
|
-
}
|
|
8
|
+
} else if (theme.wiki.tree[page.wiki]?.repo) {
|
|
9
|
+
const proj = theme.wiki.tree[page.wiki]
|
|
10
|
+
repo = proj.repo
|
|
11
|
+
if (proj.branch != undefined) {
|
|
12
|
+
branch = proj.branch
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
if (repo == undefined) {
|
|
@@ -21,9 +19,9 @@ function layoutDiv() {
|
|
|
21
19
|
if (item.labels) {
|
|
22
20
|
item.api += '&labels=' + item.labels;
|
|
23
21
|
}
|
|
24
|
-
el +=
|
|
22
|
+
el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
|
|
25
23
|
if (item.title) {
|
|
26
|
-
el += '<div class="widget-header
|
|
24
|
+
el += '<div class="widget-header dis-select">';
|
|
27
25
|
el += '<span class="name">' + item.title + '</span>';
|
|
28
26
|
el += '</div>';
|
|
29
27
|
}
|
|
@@ -5,40 +5,38 @@ function layoutDiv() {
|
|
|
5
5
|
var branch = 'main';
|
|
6
6
|
if (page.repo) {
|
|
7
7
|
repo = page.repo
|
|
8
|
-
} else if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
branch = proj.branch;
|
|
14
|
-
}
|
|
8
|
+
} else if (theme.wiki.tree[page.wiki]?.repo) {
|
|
9
|
+
const proj = theme.wiki.tree[page.wiki]
|
|
10
|
+
repo = proj.repo
|
|
11
|
+
if (proj.branch != undefined) {
|
|
12
|
+
branch = proj.branch
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
if (repo == undefined) {
|
|
18
16
|
return el;
|
|
19
17
|
}
|
|
20
18
|
// 布局
|
|
21
|
-
el +=
|
|
19
|
+
el += `<widget class="widget-wrapper${scrollreveal(' ')} ghrepo">`
|
|
22
20
|
// body
|
|
23
21
|
el += '<div class="widget-body">';
|
|
24
22
|
el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
|
|
25
23
|
el += '<a class="repo" href="https://github.com/' + repo + '" target="_blank" rel="external nofollow noopener noreferrer">';
|
|
26
24
|
el += '<div class="repo-name flex-row">';
|
|
27
|
-
el += '
|
|
25
|
+
el += icon('github:repo')
|
|
28
26
|
el += repo;
|
|
29
27
|
el += '</div>';
|
|
30
28
|
el += '<div class="repo-desc"><span type="text" id="description"> </span></div>';
|
|
31
29
|
el += '<div class="grid">';
|
|
32
30
|
el += '<div class="flex-row">';
|
|
33
|
-
el += '
|
|
31
|
+
el += icon('github:star')
|
|
34
32
|
el += '<span type="text" id="stargazers_count"></span>';
|
|
35
33
|
el += '</div>';
|
|
36
34
|
el += '<div class="flex-row">';
|
|
37
|
-
el += '
|
|
35
|
+
el += icon('github:fork')
|
|
38
36
|
el += '<span type="text" id="forks_count"></span>';
|
|
39
37
|
el += '</div>';
|
|
40
38
|
el += '<div class="flex-row stellar-ghinfo-api" index="0" api="' + theme.api_host.ghapi + '/repos/' + repo + '/tags">';
|
|
41
|
-
el += '
|
|
39
|
+
el += icon('github:tag')
|
|
42
40
|
el += '<span type="text" id="latest-tag-name">0</span>';
|
|
43
41
|
el += '</div>';
|
|
44
42
|
el += '</div>';
|
|
@@ -22,7 +22,7 @@ function layoutDiv() {
|
|
|
22
22
|
return el;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
el +=
|
|
25
|
+
el += `<widget class="widget-wrapper${scrollreveal(' ')} ghuser">`
|
|
26
26
|
// body
|
|
27
27
|
el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
|
|
28
28
|
if (item.avatar) {
|
|
@@ -42,13 +42,9 @@ function layoutDiv() {
|
|
|
42
42
|
el += '</div>';
|
|
43
43
|
// follow
|
|
44
44
|
el += '<a class="follow" href="https://github.com/' + item.username + '">';
|
|
45
|
-
el += '
|
|
45
|
+
el += icon('github:logo')
|
|
46
46
|
el += 'Follow';
|
|
47
47
|
el += '</a>';
|
|
48
|
-
// menu
|
|
49
|
-
if (item.menu) {
|
|
50
|
-
el += partial('../sidebar/menu', {where: 'sidebar'});
|
|
51
|
-
}
|
|
52
48
|
el += '</div>';
|
|
53
49
|
el += '</widget>';
|
|
54
50
|
return el;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%
|
|
2
|
+
function layoutDiv() {
|
|
3
|
+
var el = '';
|
|
4
|
+
el += `<widget class="widget-wrapper${scrollreveal(' ')} linklist">`
|
|
5
|
+
if (item.title?.length > 0) {
|
|
6
|
+
el += '<div class="widget-header dis-select">';
|
|
7
|
+
el += '<span class="name">' + item.title + '</span>';
|
|
8
|
+
el += '</div>';
|
|
9
|
+
}
|
|
10
|
+
el += '<div class="widget-body fs14">';
|
|
11
|
+
el += partial('components/linklist', {item: item})
|
|
12
|
+
el += '</div>';
|
|
13
|
+
el += '</widget>';
|
|
14
|
+
return el;
|
|
15
|
+
}
|
|
16
|
+
%>
|
|
17
|
+
<%- layoutDiv() %>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
function layoutDiv() {
|
|
3
3
|
if (!item.content?.length && !item.src?.length) return ''
|
|
4
4
|
var el = '';
|
|
5
|
-
el +=
|
|
5
|
+
el += `<widget class="widget-wrapper${scrollreveal(' ')} markdown">`
|
|
6
6
|
if (item.title?.length > 0) {
|
|
7
|
-
el += '<div class="widget-header
|
|
7
|
+
el += '<div class="widget-header dis-select">';
|
|
8
8
|
el += '<span class="name">' + item.title + '</span>';
|
|
9
9
|
el += '</div>';
|
|
10
10
|
}
|
|
@@ -15,6 +15,9 @@ function layoutDiv() {
|
|
|
15
15
|
if (item.src) {
|
|
16
16
|
el += `<div class="stellar-marked-api md-marked" src="${item.src}"></div>`
|
|
17
17
|
}
|
|
18
|
+
if (item.linklist) {
|
|
19
|
+
el += partial('components/linklist', {item: item.linklist})
|
|
20
|
+
}
|
|
18
21
|
el += '</div>';
|
|
19
22
|
el += '</widget>';
|
|
20
23
|
return el;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<%
|
|
2
2
|
function layoutDiv() {
|
|
3
|
-
var el =
|
|
3
|
+
var el = `<widget class="widget-wrapper${scrollreveal(' ')} post-list">`
|
|
4
4
|
// header
|
|
5
|
-
el += '<div class="widget-header
|
|
5
|
+
el += '<div class="widget-header dis-select">';
|
|
6
6
|
el += '<span class="name">' + __("meta.recent_update") + '</span>';
|
|
7
7
|
if (item.rss) {
|
|
8
8
|
el += '<a class="cap-action" id="rss" title="Subscribe" href="' + item.rss + '">';
|
|
9
|
-
el +=
|
|
9
|
+
el += icon('default:rss')
|
|
10
10
|
el += '</a>';
|
|
11
11
|
}
|
|
12
12
|
el += '</div>';
|
|
@@ -25,20 +25,24 @@ function layoutDiv() {
|
|
|
25
25
|
arr = site.posts.filter( p => p.title && p.title.length > 0)
|
|
26
26
|
arr = arr.sort("updated", -1)
|
|
27
27
|
}
|
|
28
|
-
el += '<div class="widget-body
|
|
28
|
+
el += '<div class="widget-body fs14">';
|
|
29
29
|
arr.length = item.limit
|
|
30
30
|
arr.forEach(post => {
|
|
31
31
|
if (!post) { return }
|
|
32
|
-
|
|
32
|
+
const isActive = post.path == page.path
|
|
33
|
+
el += `<a class="item title${post.path == page.path ? ' active' : ''}" href="${url_for(post.link || post.path)}">`
|
|
33
34
|
el += '<span class="title">'
|
|
34
|
-
if (post.
|
|
35
|
-
|
|
35
|
+
if (post.wiki) {
|
|
36
|
+
const proj = theme.wiki.tree[post.wiki];
|
|
36
37
|
let name = proj?.name || post?.wiki;
|
|
37
38
|
if (name) {
|
|
38
39
|
el += '<strong>' + name + '</strong>' + '<span class="dot"></span>';
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
el += (post.title || post.
|
|
42
|
+
el += (post.title || post.wiki) + '</span>';
|
|
43
|
+
if (isActive) {
|
|
44
|
+
el += icon('default:bookmark.active')
|
|
45
|
+
}
|
|
42
46
|
el += '</a>';
|
|
43
47
|
el += '';
|
|
44
48
|
});
|