This commit is contained in:
xaoxuu 2021-07-14 14:54:06 +08:00
parent aa9c2a089b
commit 907f669bf6
11 changed files with 80 additions and 76 deletions

View File

@ -29,6 +29,7 @@ meta:
updated: 'Updated on'
license: License
share: Share
repo_info: Repo Info
date_suffix:
just: Just
min: minutes ago

View File

@ -29,6 +29,7 @@ meta:
updated: 更新于
license: 许可协议
share: 分享文章
repo_info: 项目仓库
date_suffix:
just: 刚刚
min: 分钟前

View File

@ -29,6 +29,7 @@ meta:
updated: 更新於
license: 授權條款
share: 分享文章
repo_info: 項目倉庫
date_suffix:
just: 剛剛
min: 分鐘前

View File

@ -24,23 +24,8 @@ function layoutWidgets() {
return el;
}
function layoutFooterDiv() {
if (theme.footer.social && theme.footer.social.length > 0) {
if (page.layout !== 'wiki' && theme.footer.social && theme.footer.social.length > 0) {
var el = '<footer class="footer dis-select">';
if (page.layout === 'wiki' && page.wiki && page.menu_id === 'wiki') {
const proj = theme.wiki.projects[page.wiki];
if (proj.repo) {
el += '<div class="proj-wrap">';
el += '<a class="item"';
el += ' title="GitHub"';
el += ' href="' + url_for("https://github.com/" + proj.repo) + '"';
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
el += '>';
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>';
el += 'GitHub';
el += '</a>';
el += '</div>';
}
} else {
el += '<div class="social-wrap">';
theme.footer.social.forEach(item => {
if (item.icon && (item.url || item.onclick)) {
@ -65,7 +50,6 @@ function layoutFooterDiv() {
}
});
el += '</div>';
}
el += '</footer>';
return el;
} else {

View File

@ -20,13 +20,18 @@ function layoutDiv() {
}
// 布局
el += '<div class="widget-wrap" id="repo-info">';
// header
el += '<div class="widget-header cap dis-select">';
el += '<span class="name">' + __("meta.repo_info") + '</span>';
el += '</div>';
// body
el += '<div class="widget-body fs14">';
var items = [];
// Readme
// GitHub
items.push({
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg>',
text: 'Readme',
href: 'https://github.com/' + repo + '#readme'
icon: '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1rem" height="1rem" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>',
text: 'GitHub',
href: 'https://github.com/' + repo
});
// Releases
items.push({
@ -47,14 +52,15 @@ function layoutDiv() {
href: 'https://github.com/' + repo + '/issues'
});
items.forEach((item, i) => {
el += '<div class="item"><a class="item-link"';
el += '<div class="line"></div>';
el += '<a class="item-link"';
el += ' title="' + item.href + '"';
el += ' href="' + url_for(item.href) + '"';
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
el += '>';
el += item.icon;
el += '<span>' + item.text + '</span>';
el += '</a></div>';
el += '</a>';
});
el += '</div>';
el += '</div>';

View File

@ -20,7 +20,6 @@ function layoutDiv() {
projects.forEach((p, i) => {
if (p.title !== proj.title) {
// 同一个分组中的其它项目
el += '<div class="line"></div>'
el += '<a class="more-item wiki" href="' + url_for(p.path) + '">';
el += p.title;
el += '<div class="excerpt">';

View File

@ -1,5 +1,5 @@
.page-footer
margin: 4rem 1rem
margin: 4rem 1rem 3rem
color: var(--text-p3)
a
color: var(--text-p3)

View File

@ -1,5 +1,6 @@
.l_left .footer
margin-top: 0
margin-top: .5rem
@media screen and (max-width: $device-tablet)
margin-bottom: 1rem
.social-wrap

View File

@ -1,19 +1,27 @@
.widget-wrap#repo-info
.widget-body
.item
margin: 4px 0
a
border: 1px solid var(--block-border)
border-radius: $border-block
background: var(--block)
overflow: hidden
.line
margin: 0
height: 1px
background: var(--block-border)
&+.line,&:first-child,&:last-child
display: none
a.item-link
color: var(--text-p2)
font-weight: 500
display: inline-flex
display: flex
align-items: center
padding: 0.25rem .5rem
border-radius: 4px
padding: 0.5rem .5rem
font-size: $fs-13
justify-content: space-between
flex-direction: row-reverse
svg
margin-right: .5rem
width: 1em
height: 1em
a:hover
color: var(--text-p1)
background: var(--block-hover)
color: $color-hover
background: var(--card)

View File

@ -10,6 +10,15 @@
padding-top: "calc(1 * %s)" % var(--gap-l)
height: "calc(100% - 2 * %s)" % var(--gap-l)
.l_left[layout=wiki]
padding-bottom: 0
height: "calc(100vh - 2 * %s)" % var(--gap-l)
@media screen and (max-width: $device-tablet)
height: "calc(100% - 1 * %s)" % var(--gap-l)
.widgets >:last-child
margin-bottom: 6rem
.logo-wrap
margin: 1rem 0 .5rem
display: flex
@ -98,8 +107,11 @@
color: $color-hover
filter: unset !important
.l_left nav.menu
margin-bottom: 1.5rem
nav.menu
margin: 1rem 0 .5rem
margin: 1rem 0
background: var(--block)
border-radius: 6px
display: flex
@ -131,7 +143,6 @@ nav.menu
flex-grow: 1
.l_left .widgets
margin: 1rem 0
overflow: scroll
flex-grow: 1
scrollbar(0, 0)
@ -172,30 +183,23 @@ nav.menu
>a:hover
text-decoration: underline
.widget-wrap#recent .widget-body, .widget-wrap#related .widget-body
border: 1px solid var(--block-border)
border-radius: $border-block
background: var(--block)
overflow: hidden
.line
margin: 0
height: 1px
background: var(--block-border)
&+.line,&:first-child,&:last-child
display: none
>a
padding 0.5rem
display: block
line-height: 1.2
color: var(--text-p2)
font-weight: 500
border: 1px solid var(--block-border)
border-radius: $border-block
margin: 4px 0
background: var(--block)
div.cap
margin-bottom: 0.25rem
color: var(--text-p4)
display: flex
justify-content: space-between
&:hover
color: $color-hover
background: var(--card)
background: var(--block-hover)
&.wiki
font-weight: 700
div.excerpt
@ -207,6 +211,3 @@ nav.menu
-webkit-box-orient: vertical
overflow: hidden
-webkit-line-clamp: 3
.l_left[layout='wiki'] .widgets
margin-top: 0

View File

@ -10,6 +10,8 @@
background: var(--block)
overflow: hidden
border: 1px solid var(--block-border)
&:first-child
margin-top: 0
a.doc-tree-link
color: var(--text-p2)
padding: 0.5rem