Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 2b2ee67

Browse files
committed
add overdue
1 parent f525e36 commit 2b2ee67

File tree

5 files changed

+44
-35
lines changed

5 files changed

+44
-35
lines changed

README.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,16 @@ support tag
7777

7878
#### Demand
7979

80-
article page bg text color
81-
8280
support more article styles
8381

8482
https://yfzhou.coding.me/2018/08/27/Hexo-Next%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%EF%BC%88%E4%B8%BB%E9%A2%98%E4%BC%98%E5%8C%96%EF%BC%89/
8583

86-
https://www.zhangxinxu.com/wordpress/2018/11/css-background-color-font-auto-match/
87-
88-
to optimize the search input style
89-
9084
index home left slide can folding, topbar fullscreen, navigation and article center
9185

92-
image automatic compression
93-
9486
mobile and PC dynamic processing image size in qiniu cloud
9587

96-
The watermark image automatically
97-
9888
PWA
9989

100-
about me
101-
10290
back top
10391

10492
Contents https://yanm1ng.github.io/2017/09/10/Day06-%E7%90%86%E8%A7%A3Virtual-DOM%E6%A8%A1%E5%9E%8B/
@@ -108,30 +96,16 @@ http://chenhuichao.com/2018/04/16/seo/seo-in-station-optimization/
10896

10997
The article recommended
11098

111-
Hovering explain vocabulary
112-
113-
提醒: 本文最后更新于 424 天前,文中所描述的信息可能已发生改变,请谨慎使用。
114-
115-
超过指定时间出现这样的提示
116-
11799
##### Submit daily
118100

119101
every acticle set to meta desc
120102

121-
about reprinted font size
122-
123103
compression static files (css)
124104

125105
previous posts and next posts
126106

127107
article title add the anchor github.com
128108

129-
juejin badge
130-
131-
The article set-top
132-
133-
Copyright statement
134-
135109
site visitors
136110

137111
add more animations

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ console_config:
7171
- 'https://static.hufangyun.com/blog-url-qrcode-180-180.png'
7272
- '\n 想知道这个效果如何实现的?博客内搜索 console 彩蛋 🚀 !\n'
7373

74+
# 长时间未更新的博文显示提醒
75+
overdue_auto_all: false
76+
overdue_remind: 本文最后更新于$day天前,文中所描述的信息可能已发生改变。
77+

layout/_partial/article.ejs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
<div class="container">
2525
<div class="article">
2626
<div class="content">
27+
<% if ((theme.overdue_auto_all || post.overdue) && theme.overdue_remind) { %>
28+
<div class="overdue-remind">
29+
<%= theme.overdue_remind %>
30+
</div>
31+
<% } %>
2732
<%- post.content %>
2833
</div>
2934
<div class="support-author">

source-src/main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,15 @@ function regtest(raw, regExp) {
147147
regExp.lastIndex = 0;
148148
return regExp.test(raw);
149149
}
150+
151+
152+
// 显示文章长时间未更新提醒
153+
var overdueRemindDom = document.querySelector('.overdue-remind');
154+
var overdueRemindText = overdueRemindDom.textContent;
155+
var postUpdateDate = document.querySelector("time[itemprop='dateUpdated']").textContent;
156+
var now = Date.parse(new Date());
157+
var postLastTime = Date.parse(postUpdateDate);
158+
var dayNum = parseInt((now - postLastTime) / (1000 * 60 * 60 * 24));
159+
160+
overdueRemindDom.innerHTML = overdueRemindText.replace(/\$day/, '<span> ' + dayNum + ' </span>');
161+

source-src/main.scss

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,11 @@ h2, h3, h4 {
500500
}
501501

502502
blockquote {
503-
padding: 10px 20px;
503+
padding: 15px 20px;
504504
margin: 20px 0;
505505
background-color: #F6F6F6;
506-
border-left: 2px solid #49be38;
506+
border-left: 3px solid #49be38;
507+
border-radius: 3px;
507508
word-break: break-word;
508509

509510
p {
@@ -526,6 +527,18 @@ h2, h3, h4 {
526527
}
527528

528529
.content {
530+
.overdue-remind {
531+
background-color: #fdf8ea;
532+
border-left: 3px solid #f0ad4e;
533+
padding: 15px 20px;
534+
margin: 20px auto;
535+
border-radius: 3px;
536+
font-weight: 500;
537+
span {
538+
color: crimson;
539+
font-weight: bold;
540+
}
541+
}
529542
a {
530543
color: #49be38;
531544
border-bottom: 1px solid #49be38;
@@ -614,13 +627,14 @@ h2, h3, h4 {
614627
}
615628

616629
.article .support-author {
617-
padding: 25px;
618-
margin-bottom: 40px;
619-
background-color: whitesmoke;
620-
border-left: 4px solid #49be38;
621-
box-sizing: border-box;
622-
box-shadow: 0 0 1px #d9d9d9;
623-
margin:50px auto;
630+
padding: 25px;
631+
margin-bottom: 40px;
632+
background-color: whitesmoke;
633+
border-left: 4px solid #49be38;
634+
border-radius: 3px;
635+
box-sizing: border-box;
636+
box-shadow: 0 0 1px #d9d9d9;
637+
margin:50px auto;
624638
}
625639
.article .support-author p{
626640
margin: 0 auto 10px;

0 commit comments

Comments
 (0)