update
This commit is contained in:
parent
a285e517ee
commit
7a742d61fe
|
@ -28,7 +28,7 @@ sidebar:
|
||||||
index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
|
index: [welcome, recent] # for home/wiki/categories/tags/archives/404 pages
|
||||||
page: [welcome, toc] # for pages using 'layout:page'
|
page: [welcome, toc] # for pages using 'layout:page'
|
||||||
post: [toc, ghrepo] # for pages using 'layout:post'
|
post: [toc, ghrepo] # for pages using 'layout:post'
|
||||||
wiki: [ghrepo, toc, wiki_more] # for pages using 'layout:wiki'
|
wiki: [toc, ghrepo, wiki_more] # for pages using 'layout:wiki'
|
||||||
|
|
||||||
|
|
||||||
######## Main ########
|
######## Main ########
|
||||||
|
|
|
@ -28,7 +28,8 @@ ghuser:
|
||||||
layout: ghuser
|
layout: ghuser
|
||||||
api: https://api.github.com
|
api: https://api.github.com
|
||||||
username: github # your github login username
|
username: github # your github login username
|
||||||
avatar: true # true / false
|
avatar: true # show avatar or not
|
||||||
|
menu: true # show menu or not
|
||||||
|
|
||||||
|
|
||||||
welcome:
|
welcome:
|
||||||
|
|
|
@ -1,27 +1,4 @@
|
||||||
<%
|
<%
|
||||||
function layoutMenu() {
|
|
||||||
var el = '';
|
|
||||||
el += '<nav class="menu dis-select';
|
|
||||||
if (where == 'main') {
|
|
||||||
el += ' mobile-hidden';
|
|
||||||
}
|
|
||||||
el += '">';
|
|
||||||
for (let id of Object.keys(theme.sidebar.menu)) {
|
|
||||||
let item = theme.sidebar.menu[id];
|
|
||||||
if (item == undefined || item.length == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
el += '<a class="nav-item';
|
|
||||||
if (id == page.menu_id) {
|
|
||||||
el += ' active';
|
|
||||||
}
|
|
||||||
el += '" href="' + url_for(md_link(item)) + '">';
|
|
||||||
el += __(md_text(item));
|
|
||||||
el += '</a>';
|
|
||||||
}
|
|
||||||
el += '</nav>';
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<header class="header';
|
el += '<header class="header';
|
||||||
|
@ -33,13 +10,12 @@ function layoutDiv() {
|
||||||
if (where != 'main') {
|
if (where != 'main') {
|
||||||
if (page.layout === 'wiki' && page.wiki) {
|
if (page.layout === 'wiki' && page.wiki) {
|
||||||
if (page.menu_id !== 'wiki') {
|
if (page.menu_id !== 'wiki') {
|
||||||
el += layoutMenu();
|
el += partial('menu', {where: where});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
el += layoutMenu();
|
el += partial('menu', {where: where});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
el += '</header>';
|
el += '</header>';
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<%
|
||||||
|
function layoutDiv() {
|
||||||
|
var el = '';
|
||||||
|
el += '<nav class="menu dis-select';
|
||||||
|
if (where == 'main') {
|
||||||
|
el += ' mobile-hidden';
|
||||||
|
}
|
||||||
|
el += '">';
|
||||||
|
for (let id of Object.keys(theme.sidebar.menu)) {
|
||||||
|
let item = theme.sidebar.menu[id];
|
||||||
|
if (item == undefined || item.length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
el += '<a class="nav-item';
|
||||||
|
if (id == page.menu_id) {
|
||||||
|
el += ' active';
|
||||||
|
}
|
||||||
|
el += '" href="' + url_for(md_link(item)) + '">';
|
||||||
|
el += __(md_text(item));
|
||||||
|
el += '</a>';
|
||||||
|
}
|
||||||
|
el += '</nav>';
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
|
<%- layoutDiv() %>
|
|
@ -38,9 +38,9 @@ function layoutDiv() {
|
||||||
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>';
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>';
|
||||||
el += '<span type="text" id="forks_count"></span>';
|
el += '<span type="text" id="forks_count"></span>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '<div class="flex-row stellar-ghinfo-api" api="https://api.github.xaoxuu.com/repos/' + repo + '/releases/latest">';
|
el += '<div class="flex-row stellar-ghinfo-api" index="0" api="https://api.github.xaoxuu.com/repos/' + repo + '/tags">';
|
||||||
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>';
|
el += '<svg aria-hidden="true" role="img" class="color-icon-primary" viewBox="0 0 16 16" width="1em" height="1em" fill="currentColor" style="user-select:none;overflow:visible"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>';
|
||||||
el += '<span type="text" id="tag_name"></span>';
|
el += '<span type="text" id="latest-tag-name">0</span>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
|
|
|
@ -45,6 +45,10 @@ function layoutDiv() {
|
||||||
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 += '<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 += 'Follow';
|
el += 'Follow';
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
|
// menu
|
||||||
|
if (item.menu) {
|
||||||
|
el += partial('../menu', {where: 'sidebar'});
|
||||||
|
}
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
return el;
|
return el;
|
||||||
|
|
|
@ -15,11 +15,7 @@ function layoutToc() {
|
||||||
function layoutTocHeader(title) {
|
function layoutTocHeader(title) {
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<div class="widget-header cap dis-select">';
|
el += '<div class="widget-header cap dis-select">';
|
||||||
if (title) {
|
el += '<span class="name">' + (title || page.title || __("meta.toc")) + '</span>';
|
||||||
el += '<span class="name">' + title + '</span>';
|
|
||||||
} else {
|
|
||||||
el += '<span class="name">' + __("meta.toc") + '</span>';
|
|
||||||
}
|
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
// list
|
// list
|
||||||
.post-list
|
.post-list
|
||||||
margin: 1rem
|
margin: 1rem
|
||||||
|
.post-title
|
||||||
|
margin-top: 1.5rem
|
||||||
|
.post-title:first-child
|
||||||
|
margin-top: .5rem
|
||||||
|
|
||||||
// card
|
// card
|
||||||
.post-list .post-card
|
.post-list .post-card
|
||||||
|
@ -51,6 +55,7 @@
|
||||||
margin-left: -1rem
|
margin-left: -1rem
|
||||||
margin-top: -1rem
|
margin-top: -1rem
|
||||||
margin-right: -1rem
|
margin-right: -1rem
|
||||||
|
background: var(--block)
|
||||||
&:not(.lazy)
|
&:not(.lazy)
|
||||||
trans1: transform 1s
|
trans1: transform 1s
|
||||||
img
|
img
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
display: block
|
display: block
|
||||||
border: 1px solid var(--block-border)
|
border: 1px solid var(--block-border)
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
background: var(--block)
|
background: var(--card)
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
>div
|
>div
|
||||||
margin: 0.75rem 0.5rem
|
margin: 0.5rem
|
||||||
span
|
span
|
||||||
color: var(--text-p2)
|
color: var(--text-p2)
|
||||||
&:hover
|
&:hover
|
||||||
background: var(--block-hover)
|
background: var(--block)
|
||||||
a.repo
|
a.repo
|
||||||
svg
|
svg
|
||||||
margin-right: 4px
|
margin-right: 4px
|
||||||
|
@ -21,8 +21,10 @@
|
||||||
.repo-name
|
.repo-name
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
|
margin: 0.75rem 0.5rem
|
||||||
.repo-desc
|
.repo-desc
|
||||||
font-size: $fs-13
|
font-size: $fs-13
|
||||||
|
margin: 0.75rem 0.5rem
|
||||||
.grid
|
.grid
|
||||||
font-size: $fs-13
|
font-size: $fs-13
|
||||||
display: grid
|
display: grid
|
||||||
|
|
|
@ -47,7 +47,21 @@
|
||||||
&:hover
|
&:hover
|
||||||
background: $color-hover
|
background: $color-hover
|
||||||
|
|
||||||
|
.widget-wrap#github-user .widget-body .menu
|
||||||
|
margin-bottom: 0
|
||||||
|
background: none
|
||||||
|
a.active
|
||||||
|
box-shadow: none
|
||||||
|
position: relative
|
||||||
|
&:after
|
||||||
|
content: ''
|
||||||
|
position: absolute
|
||||||
|
height: 3px
|
||||||
|
bottom: 0
|
||||||
|
width: 32px
|
||||||
|
left: 'calc(50% - 0.5 * %s)' % @width
|
||||||
|
border-radius: 4px
|
||||||
|
background: $color-theme
|
||||||
|
|
||||||
.widget-wrap#github-user .widget-body .buttons
|
.widget-wrap#github-user .widget-body .buttons
|
||||||
margin: 1rem 0
|
margin: 1rem 0
|
||||||
|
|
|
@ -134,7 +134,7 @@ nav.menu
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
font-weight: 500
|
font-weight: 500
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
padding: 0.375rem 0.75rem
|
padding: 0.375rem 0.5rem
|
||||||
color: var(--text-p3)
|
color: var(--text-p3)
|
||||||
text-align: center
|
text-align: center
|
||||||
&.active, &:hover
|
&.active, &:hover
|
||||||
|
@ -151,6 +151,7 @@ nav.menu
|
||||||
scrollbar-width: none
|
scrollbar-width: none
|
||||||
scrollbar(0, 0)
|
scrollbar(0, 0)
|
||||||
z-index: 1
|
z-index: 1
|
||||||
|
line-height: 1.2
|
||||||
.widget-wrap
|
.widget-wrap
|
||||||
margin: 1rem 0 3rem 0
|
margin: 1rem 0 3rem 0
|
||||||
.widget-header
|
.widget-header
|
||||||
|
@ -159,14 +160,15 @@ nav.menu
|
||||||
align-items: center
|
align-items: center
|
||||||
font-weight: 500
|
font-weight: 500
|
||||||
position: sticky
|
position: sticky
|
||||||
position: -webkit-sticky
|
|
||||||
top: -2px
|
top: -2px
|
||||||
background: var(--site-bg)
|
background: var(--site-bg)
|
||||||
padding-top: 2px
|
padding-top: 2px
|
||||||
z-index 1
|
z-index 1
|
||||||
line-height: 2
|
color: var(--text-p3)
|
||||||
color: var(--text-p4)
|
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
|
>span
|
||||||
|
margin: 0.25rem 0
|
||||||
|
text-align: left
|
||||||
&:empty
|
&:empty
|
||||||
display: none
|
display: none
|
||||||
.cap-action
|
.cap-action
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
.widget-wrap#toc .widget-header
|
.widget-wrap.single#toc .widget-header
|
||||||
line-height: 2.4
|
font-weight: 500
|
||||||
|
font-size: $fs-12
|
||||||
|
>span
|
||||||
|
margin: 0.5rem 0
|
||||||
|
|
||||||
#toc .widget-body
|
#toc .widget-body
|
||||||
line-height: 1.2
|
|
||||||
margin-top: 0
|
margin-top: 0
|
||||||
ul ul, ul ol
|
ul ul, ul ol
|
||||||
padding-left: 0
|
padding-left: 0
|
||||||
|
|
|
@ -44,13 +44,25 @@ const GitHubInfo = {
|
||||||
},
|
},
|
||||||
layout: (cfg) => {
|
layout: (cfg) => {
|
||||||
const el = $(cfg.el)[0];
|
const el = $(cfg.el)[0];
|
||||||
GitHubInfo.requestAPI(cfg.api, function(data) {
|
function fill(data) {
|
||||||
const arr = data.content || data;
|
|
||||||
for (let key of Object.keys(data)) {
|
for (let key of Object.keys(data)) {
|
||||||
$(el).find("[type=text]#" + key).text(data[key]);
|
$(el).find("[type=text]#" + key).text(data[key]);
|
||||||
$(el).find("[type=link]#" + key).attr("href", data[key]);
|
$(el).find("[type=link]#" + key).attr("href", data[key]);
|
||||||
$(el).find("[type=img]#" + key).attr("src", data[key]);
|
$(el).find("[type=img]#" + key).attr("src", data[key]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
GitHubInfo.requestAPI(cfg.api, function(data) {
|
||||||
|
const idx = el.getAttribute('index');
|
||||||
|
if (idx != undefined) {
|
||||||
|
const arr = data.content || data;
|
||||||
|
if (arr && arr.length > idx) {
|
||||||
|
let obj = arr[idx];
|
||||||
|
obj['latest-tag-name'] = obj['name'];
|
||||||
|
fill(arr[idx]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fill(data);
|
||||||
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue