From cbc16f9a88d4a39785b62ddd94c474545a603526 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 7 Oct 2022 22:23:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/css/_layout/tag-plugins/timeline.styl | 76 +++++++++++++++++++- source/js/main.js | 1 - source/js/plugins/timeline.js | 58 ++++++++++++--- 3 files changed, 124 insertions(+), 11 deletions(-) diff --git a/source/css/_layout/tag-plugins/timeline.styl b/source/css/_layout/tag-plugins/timeline.styl index 3f34351..d3182da 100644 --- a/source/css/_layout/tag-plugins/timeline.styl +++ b/source/css/_layout/tag-plugins/timeline.styl @@ -45,6 +45,7 @@ color: var(--text-p3) font-family: $ff-code trans1 color + opacity: 0.75 a color: inherit font-weight: inherit @@ -79,5 +80,78 @@ .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: 500 + margin: 0 + padding: 0.5rem 0 0.75rem + line-height: 1.25 + border-bottom: 1px dashed var(--block-border) pre code - font-size: $fs-12 \ No newline at end of file + font-size: $fs-12 + +.tag-plugin.timeline.stellar-timeline-api .body .footer + padding: 0.5rem 0 1rem + margin-bottom: -0.5rem + user-select: none + font-weight: 500 + display: flex + flex-wrap: wrap + justify-content: space-between + align-items: center + position: sticky + position: -webkit-sticky + bottom: -0.5rem + background: var(--card) + &:empty + display: none + .label:first-child + margin-left: 0 + a.comments + margin-right: 0 + + + + +.tag-plugin.timeline.stellar-timeline-api .body .footer .labels + display: flex + flex-wrap: wrap + font-size: $fs-12 + +.tag-plugin.timeline.stellar-timeline-api .body .footer .reactions + display: flex + flex-wrap: wrap + font-size: $fs-13 + .reaction + border: 1px dashed var(--block-border) + + +.tag-plugin.timeline.stellar-timeline-api .body .footer .label + color: white + text-shadow: 0 0 2px rgba(0, 0, 0, 0.3) + +.tag-plugin.timeline.stellar-timeline-api .body .footer a.comments + border-radius: 64px + border: 1px solid var(--block-border) + padding: 0 0.5rem + color: inherit + trans1: all + .key + margin-right: 4px + &:hover + background: $color-theme + border: 1px solid $color-theme + color: var(--card) + background: var(--text-p1) + border: 1px solid var(--text-p1) + + +.tag-plugin.timeline.stellar-timeline-api .body .footer .label, +.tag-plugin.timeline.stellar-timeline-api .body .footer .reaction + margin: 0 0.25rem + border-radius: 64px + padding: 0 0.5rem + .key + margin-right: 4px \ No newline at end of file diff --git a/source/js/main.js b/source/js/main.js index 775379e..b976efe 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -217,7 +217,6 @@ if (stellar.plugins.lazyload) { if (stellar.plugins.stellar) { for (let key of Object.keys(stellar.plugins.stellar)) { let js = stellar.plugins.stellar[key]; - console.log(key, js); const els = document.getElementsByClassName('stellar-' + key + '-api'); if (els != undefined && els.length > 0) { stellar.jQuery(() => { diff --git a/source/js/plugins/timeline.js b/source/js/plugins/timeline.js index 1c17c35..e2815db 100644 --- a/source/js/plugins/timeline.js +++ b/source/js/plugins/timeline.js @@ -1,4 +1,14 @@ const StellarTimeline = { + reactions: { + '+1': '👍', + '-1': '👎', + 'laugh': '😀', + 'hooray': '🎉', + 'confused': '😕', + 'heart': '❤️', + 'rocket': '🚀', + 'eyes': '👀' + }, requestAPI: (url, callback, timeout) => { let retryTimes = 5; function request() { @@ -53,15 +63,45 @@ const StellarTimeline = { arr.reverse(); } arr.forEach((item, i) => { - var cell = '
'; - cell += '
'; - cell += '

' + item.title + '

'; - cell += '
'; - cell += '
'; - cell += marked.parse(item.body); - cell += '
'; - cell += '
'; - $(el).append(cell); + if (item.labels.length > 0) { + var cell = '
'; + cell += '
'; + let date = new Date(item.created_at); + cell += '

' + date + '

'; + cell += '
'; + cell += '
'; + cell += '

' + item.title + '

'; + cell += marked.parse(item.body); + cell += ''; + cell += '
'; + cell += '
'; + $(el).append(cell); + } }); }, function() { $(el).find('.loading-wrap svg').remove();