timeline
This commit is contained in:
parent
53b7078a2d
commit
f1e5b3ac46
|
@ -36,12 +36,12 @@ function layoutNodeContent(content) {
|
||||||
|
|
||||||
|
|
||||||
function postTimeline(args, content) {
|
function postTimeline(args, content) {
|
||||||
args = hexo.args.map(args, ['api']);
|
args = hexo.args.map(args, ['api', 'user']);
|
||||||
var el = '';
|
var el = '';
|
||||||
|
|
||||||
if (args.api && args.api.length > 0) {
|
if (args.api && args.api.length > 0) {
|
||||||
el += '<div class="tag-plugin timeline stellar-timeline-api"';
|
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 += '>';
|
el += '>';
|
||||||
} else {
|
} else {
|
||||||
el += '<div class="tag-plugin timeline">';
|
el += '<div class="tag-plugin timeline">';
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
margin: 1rem 0
|
margin: 1rem 0
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
background: var(--theme-bg)
|
|
||||||
border: 1px solid var(--theme-border)
|
border: 1px solid var(--theme-border)
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
.folder
|
.folder
|
||||||
display: block
|
display: block
|
||||||
font-size: $fs-14
|
font-size: $fs-14
|
||||||
background: var(--theme-bg)
|
background: var(--block)
|
||||||
&:last-child summary
|
&:last-child summary
|
||||||
border-bottom: none
|
border-bottom: none
|
||||||
summary
|
summary
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
position: relative
|
position: relative
|
||||||
line-height: 1.2
|
line-height: 1.2
|
||||||
outline: none
|
outline: none
|
||||||
padding: 1rem
|
padding: 0.75rem 1rem
|
||||||
border-bottom: 1px solid var(--theme-border)
|
border-bottom: 1px solid var(--theme-border)
|
||||||
&:last-child
|
&:last-child
|
||||||
border-bottom: none
|
border-bottom: none
|
||||||
|
@ -28,18 +27,20 @@
|
||||||
p,h1,h2,h3,h4,h5,h6
|
p,h1,h2,h3,h4,h5,h6
|
||||||
display: inline
|
display: inline
|
||||||
border-bottom: none !important
|
border-bottom: none !important
|
||||||
&:after
|
|
||||||
position: absolute
|
|
||||||
content: '+'
|
|
||||||
text-align: center
|
|
||||||
top: 50%
|
|
||||||
transform: translateY(-50%)
|
|
||||||
right: 1rem
|
|
||||||
&:hover
|
&:hover
|
||||||
color: var(--text-p0)
|
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]
|
.tag-plugin.folders details[open]
|
||||||
|
background: none
|
||||||
&:last-child
|
&:last-child
|
||||||
summary
|
summary
|
||||||
border-bottom: 1px solid var(--theme-border)
|
border-bottom: 1px solid var(--theme-border)
|
||||||
|
@ -47,11 +48,11 @@
|
||||||
border-bottom: none
|
border-bottom: none
|
||||||
>summary
|
>summary
|
||||||
color: var(--text-p1)
|
color: var(--text-p1)
|
||||||
font-weight: 700
|
background: var(--block-hover)
|
||||||
&:after
|
&:hover:after
|
||||||
content: '-'
|
content: '-'
|
||||||
|
|
||||||
>div.body
|
>div.body
|
||||||
background: var(--card)
|
|
||||||
padding: 1rem
|
padding: 1rem
|
||||||
border-bottom: 1px solid var(--theme-border)
|
border-bottom: 1px solid var(--theme-border)
|
||||||
font-size: $fs-15
|
font-size: $fs-15
|
||||||
|
|
|
@ -76,6 +76,8 @@
|
||||||
padding: 0.5rem 1rem
|
padding: 0.5rem 1rem
|
||||||
margin-top: 4px
|
margin-top: 4px
|
||||||
box-shadow: $boxshadow-block
|
box-shadow: $boxshadow-block
|
||||||
|
p
|
||||||
|
font-size: $fs-14
|
||||||
&:empty
|
&:empty
|
||||||
display: none
|
display: none
|
||||||
p,.highlight,ol,ul,.tag-plugin
|
p,.highlight,ol,ul,.tag-plugin
|
||||||
|
@ -87,8 +89,6 @@
|
||||||
.tag-plugin.timeline.stellar-timeline-api .body
|
.tag-plugin.timeline.stellar-timeline-api .body
|
||||||
max-height: convert(hexo-config('tag_plugins.timeline.max-height'))
|
max-height: convert(hexo-config('tag_plugins.timeline.max-height'))
|
||||||
overflow: scroll
|
overflow: scroll
|
||||||
p
|
|
||||||
font-size: $fs-14
|
|
||||||
p.title
|
p.title
|
||||||
font-size: 1rem
|
font-size: 1rem
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
|
@ -141,3 +141,14 @@
|
||||||
margin-right: 0
|
margin-right: 0
|
||||||
.reaction
|
.reaction
|
||||||
border-color: var(--block)
|
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
|
|
@ -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>');
|
$(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) {
|
StellarTimeline.requestAPI(cfg.api, function(data) {
|
||||||
$(el).find('.loading-wrap').remove();
|
$(el).find('.loading-wrap').remove();
|
||||||
|
const user = el.getAttribute('user');
|
||||||
const arr = data.content || data;
|
const arr = data.content || data;
|
||||||
arr.forEach((item, i) => {
|
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 + '">';
|
var cell = '<div class="timenode" index="' + i + '">';
|
||||||
cell += '<div class="header">';
|
cell += '<div class="header">';
|
||||||
let date = new Date(item.created_at);
|
let date = new Date(item.created_at);
|
||||||
|
@ -98,7 +104,7 @@ const StellarTimeline = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.comments != null) {
|
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 += '<span>💬 ' + (item.comments || 0) + '</span>';
|
||||||
cell += '</a>';
|
cell += '</a>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue