This commit is contained in:
xaoxuu 2022-10-19 23:38:29 +08:00
parent 53b7078a2d
commit f1e5b3ac46
4 changed files with 37 additions and 19 deletions

View File

@ -36,12 +36,12 @@ function layoutNodeContent(content) {
function postTimeline(args, content) {
args = hexo.args.map(args, ['api']);
args = hexo.args.map(args, ['api', 'user']);
var el = '';
if (args.api && args.api.length > 0) {
el += '<div class="tag-plugin timeline stellar-timeline-api"';
el += ' ' + hexo.args.joinTags(args, ['api']).join(' ');
el += ' ' + hexo.args.joinTags(args, ['api', 'user']).join(' ');
el += '>';
} else {
el += '<div class="tag-plugin timeline">';

View File

@ -3,13 +3,12 @@
margin: 1rem 0
border-radius: $border-block
font-size: $fs-14
background: var(--theme-bg)
border: 1px solid var(--theme-border)
overflow: hidden
.folder
display: block
font-size: $fs-14
background: var(--theme-bg)
background: var(--block)
&:last-child summary
border-bottom: none
summary
@ -20,7 +19,7 @@
position: relative
line-height: 1.2
outline: none
padding: 1rem
padding: 0.75rem 1rem
border-bottom: 1px solid var(--theme-border)
&:last-child
border-bottom: none
@ -28,18 +27,20 @@
p,h1,h2,h3,h4,h5,h6
display: inline
border-bottom: none !important
&:after
position: absolute
content: '+'
text-align: center
top: 50%
transform: translateY(-50%)
right: 1rem
&:hover
color: var(--text-p0)
background: var(--block-hover)
&:after
position: absolute
content: '+'
text-align: center
top: 50%
transform: translateY(-50%)
right: 1rem
.tag-plugin.folders details[open]
background: none
&:last-child
summary
border-bottom: 1px solid var(--theme-border)
@ -47,11 +48,11 @@
border-bottom: none
>summary
color: var(--text-p1)
font-weight: 700
&:after
background: var(--block-hover)
&:hover:after
content: '-'
>div.body
background: var(--card)
padding: 1rem
border-bottom: 1px solid var(--theme-border)
font-size: $fs-15

View File

@ -76,6 +76,8 @@
padding: 0.5rem 1rem
margin-top: 4px
box-shadow: $boxshadow-block
p
font-size: $fs-14
&:empty
display: none
p,.highlight,ol,ul,.tag-plugin
@ -87,8 +89,6 @@
.tag-plugin.timeline.stellar-timeline-api .body
max-height: convert(hexo-config('tag_plugins.timeline.max-height'))
overflow: scroll
p
font-size: $fs-14
p.title
font-size: 1rem
font-weight: 700
@ -141,3 +141,14 @@
margin-right: 0
.reaction
border-color: var(--block)
.tag-plugin.timeline .body blockquote
padding: 0 0.5rem
box-shadow: none
border-left: 4px solid var(--block-border)
border-radius: 0
display: block
margin: 0.5rem 0
p
font-size: $fs-13
margin: 4px

View File

@ -57,8 +57,14 @@ const StellarTimeline = {
$(el).append('<div class="loading-wrap"><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg><p></p></div>');
StellarTimeline.requestAPI(cfg.api, function(data) {
$(el).find('.loading-wrap').remove();
const user = el.getAttribute('user');
const arr = data.content || data;
arr.forEach((item, i) => {
if (item.user && item.user.login && user && user.length > 0) {
if (!user.includes(item.user.login)) {
return;
}
}
var cell = '<div class="timenode" index="' + i + '">';
cell += '<div class="header">';
let date = new Date(item.created_at);
@ -98,7 +104,7 @@ const StellarTimeline = {
}
}
if (item.comments != null) {
cell += '<a class="item comments last" href="' + item.html_url + '" target="_blank" rel="external nofollow noopener noreferrer">';
cell += '<a class="item comments last" href="' + item.html_url + '#issuecomment-new" target="_blank" rel="external nofollow noopener noreferrer">';
cell += '<span>💬 ' + (item.comments || 0) + '</span>';
cell += '</a>';
}