Skip to content

Commit 6a5ffda

Browse files
author
liyuechao
committed
opt & fix
1 parent aaecefb commit 6a5ffda

File tree

12 files changed

+179
-112
lines changed

12 files changed

+179
-112
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ github api 详情可以参照[官方api说明](https://developer.github.com/v3/#
5151
+ 这个 code 是 GitHub 登录授权完成时,在跳转回 redirect_uri 的查询参数拿到的, redirect_uri 必须是在 OAuth App 配置的 callback URL 域名下。
5252
+ 这样即使别人用了你的 client_id 和 client_secret ,跳转之后也拿不到 code,所以,有 client_id 和 client_secret 也做不了什么。
5353

54-
对应主题中要开启`gitalk评论,相应的最新评论、热门推荐、文章中评论数都需要依靠gitalk评论,如果使用主题中其他评论请删掉此三个模块,以免出错`,如下配置xxx换成自己的,否则无效。
54+
对应主题中要开启`gitalk评论,相应的最新评论、热门推荐、文章中评论数都需要依靠gitalk评论,如果使用主题中其他评论请删掉(2019.10.17已加上判断逻辑不用删掉了)此三个模块,以免出错`,如下配置xxx换成自己的,否则无效。
5555
```yaml
5656
comment:
5757
type: gitalk

db.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

themes/icarus/layout/common/article.ejs

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
<div class="level-item tag is-danger" style="background-color: #3273dc;">已置顶</div>
1515
<%} %>
1616
<time class="level-item has-text-grey" datetime="<%= date_xml(post.date) %>"><%= date(post.date) %></time>
17-
<span class="display-none-class"><%- md5(post.path) %></span>
18-
<img class="not-gallery-item" src="/images/chat.svg">&nbsp;<span class="level-item has-text-grey" id=<%- md5(post.path) %>>99+</span></img>
17+
<% if (get_config('comment.type') == 'gitalk') { %>
18+
<span class="display-none-class"><%- md5(post.path) %></span>
19+
<img class="not-gallery-item" src="/images/chat.svg">&nbsp;<span class="level-item has-text-grey" id=<%- md5(post.path) %>>99+</span></img>
20+
<% } %>
1921
<% if (post.categories && post.categories.length) { %>
2022
<div class="level-item">
2123
<%- list_categories(post.categories, {
@@ -52,6 +54,17 @@
5254
<div class="content">
5355
<%- index && post.excerpt ? post.excerpt : post.content %>
5456
</div>
57+
<!-- 部分参考自https://www.alphalxy.com/2019/03/customize-icarus/ -->
58+
<% if (!index && post.layout === 'post' && post.copyright !== false) { %>
59+
<ul class="post-copyright">
60+
<li><strong>本文标题:</strong><a href="<%= post.permalink %>"><%= page.title %></a></li>
61+
<li><strong>本文作者:</strong><a href="<%= theme.url %>"><%= theme.author %></a></li>
62+
<li><strong>本文链接:</strong><a href="<%= post.permalink %>"><%= post.permalink %></a></li>
63+
<li><strong>版权声明:</strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处!
64+
</li>
65+
</ul>
66+
<br>
67+
<% } %>
5568
<% if (!index && post.tags && post.tags.length) { %>
5669
<div class="level is-size-7 is-uppercase">
5770
<div class="level-start">
@@ -60,17 +73,38 @@
6073
<%- list_tags(post.tags, {
6174
class: 'has-link-grey ',
6275
show_count: false,
63-
style: 'link'
76+
style: 'link',
77+
separator: ',&nbsp;'
6478
}) %>
6579
</div>
6680
</div>
6781
</div>
6882
<% } %>
6983
<% if (index && post.excerpt) { %>
70-
<div class="level is-mobile">
84+
<div class="level is-mobile is-flex">
85+
<div class="level-start">
86+
<% if (post.tags && post.tags.length) { %>
87+
<div class="level-item is-size-7 is-uppercase">
88+
<i class="fas fa-tags has-text-grey"></i>&nbsp;
89+
<%- list_tags(post.tags, {
90+
class: 'has-link-grey ',
91+
show_count: false,
92+
style: 'link',
93+
separator: ',&nbsp;'
94+
}) %>
95+
</div>
96+
<% } %>
97+
</div>
98+
<div class="level-start">
99+
<div class="level-item has-text-grey is-size-7 is-hidden-mobile">
100+
<% if (post.updated && post.updated > post.date) { %>
101+
<time datetime="<%= date_xml(post.updated) %>"><i class="far fa-calendar-check">&nbsp;更新时间:&nbsp;</i><%= date(post.updated) %></time>
102+
<% } %>
103+
</div>
104+
</div>
71105
<div class="level-start">
72106
<div class="level-item">
73-
<a class="button is-size-7 is-light" href="<%- url_for(post.path) %>#more"><%= __('article.more') %></a>
107+
<a class="button is-size-7 is-light" href="<%- url_for(post.path) %>#more"><i class="fas fa-book-reader has-text-grey">&nbsp;</i><%= __('article.more') %></a>
74108
</div>
75109
</div>
76110
</div>

themes/icarus/layout/common/widget.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
} %>
1111
<% function visibility_class() {
1212
if (column_count() === 3 && position === 'right') {
13-
return 'is-hidden-touch is-hidden-desktop-only';
13+
return '';
1414
}
1515
return '';
1616
} %>

themes/icarus/layout/index.ejs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<% if (page.path == 'index.html') { %>
2-
<!-- 参考自https://dp2px.com/网站 -->
3-
<div class="tag is-white" style="font-size:15px;">热门推荐:</div>
4-
<br>
5-
<br>
6-
<div class="tags hot-tags" id = "index_hot_div">
7-
加载中,稍等几秒...
8-
</div>
1+
<% if (page.path == 'index.html' && get_config('comment.type') == 'gitalk'){ %>
2+
<!-- 参考自https://dp2px.com/网站 -->
3+
<div class="tag is-white" style="font-size:15px;">热门推荐:</div>
4+
<br>
5+
<br>
6+
<div class="tags hot-tags" id = "index_hot_div">
7+
加载中,稍等几秒...
8+
</div>
99
<% } %>
1010
<% page.posts.each(function(post){ %>
1111
<%- partial('common/article', { post, index: true }) %>
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
<div class="card widget">
2-
<div class="card-content" id="body_hot_comment">
3-
<h3 class="menu-label">最新评论<br>加载中,稍等几秒...</h3>
1+
<% if (get_config('comment.type') == 'gitalk') { %>
2+
<div class="card widget">
3+
<div class="card-content" id="body_hot_comment">
4+
<h3 class="menu-label">最新评论<br>加载中,稍等几秒...</h3>
5+
</div>
46
</div>
5-
</div>
7+
<% } %>

themes/icarus/layout/widget/notice.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<% if (links !== null) { %>
33
<div class="card widget">
44
<div class="card-content">
5-
<div class="menu">
5+
<div class="menu text-desc">
66
<h3 class="menu-label">
77
通知
88
</h3>
99
<ul class="menu-list">
1010
<% for (let i in links) { %>
1111
<li>
1212
<span class="level-left">
13-
<span class="level-item" style="justify-content:left;margin-left:4px;"><%= i %></span>
13+
<span class="level-item notice-item"><%= i %></span>
1414
</span>
1515
</li>
1616
<% } %>

themes/icarus/layout/widget/toc.ejs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ function buildToc(toc) {
2626
return result;
2727
}
2828
%>
29-
<div class="card widget" id="toc">
29+
<% let tocContent = buildToc(_toc(post.content)); if (tocContent !== '' && tocContent !== undefined){ %>
30+
<div class="card widget" id="toc" style="max-height: 225px;overflow: auto;">
3031
<div class="card-content">
3132
<div class="menu">
3233
<h3 class="menu-label">
3334
<%= _p('widget.catalogue', Infinity) %>
3435
</h3>
35-
<%- buildToc(_toc(post.content)) %>
36+
<%- tocContent %>
3637
</div>
3738
</div>
3839
</div>
40+
<% } %>
3941
<% } %>

themes/icarus/source/css/style.styl

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,11 @@ figure.highlight
601601

602602

603603
.cardm {
604-
border-left: 5px solid #6190e8;
604+
//border-left: 5px solid #6190e8;
605605
width: 32%;
606606
background-color: white;
607607
border-radius: 2px;
608-
box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
608+
//box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
609609
color: #4a4a4a;
610610
padding: 0.5rem;
611611
display: inline-block;
@@ -663,7 +663,7 @@ figure.highlight
663663
-o-transition: all 0.5s ease-in;
664664
}
665665

666-
card-comment-item img {
666+
.card-comment-item img {
667667
float left
668668
transition: all 0.5s ease-in;
669669
-webkit-transition: all 0.5s ease-in;
@@ -747,6 +747,7 @@ card-comment-item img {
747747
.item {
748748
margin-top: -4px;
749749
margin-bottom: -9px;
750+
// #f6f9fe
750751
background-color: #f9f9f900;
751752
color: #3d3d3d;
752753
-webkit-line-clamp: 3;
@@ -792,6 +793,20 @@ card-comment-item img {
792793
background-color: #d9e6fd;
793794
}
794795

796+
.notice-item {
797+
justify-content: left;
798+
margin-left: 4px;
799+
}
800+
795801
.display-none-class {
796802
display:none;
797-
}
803+
}
804+
805+
.post-copyright
806+
font-size: 1rem
807+
letter-spacing: 0.02rem
808+
word-break: break-all
809+
margin: 2.5rem 0 0
810+
padding: 1rem 1rem
811+
border-left: 3px solid #FF1700
812+
background-color: #F9F9F9

themes/icarus/source/js/friend.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
88
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
99
"S": this.getMilliseconds() //毫秒
1010
};
11+
1112
if (/(y+)/.test(fmt))
1213
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
1314
for (var k in o)
@@ -20,7 +21,7 @@ $(function () { //获取处理友链数据
2021
$.getJSON("../json_data/friend.json", function (data) {
2122

2223
var data0 = data[0];
23-
24+
$('.links-content').html("");
2425
$('.links-content').append("<div class=\"link-navigation\"><div class='friend-title-item'>本站友链信息【欢迎添加到自己的网站,需要交换友链请留言哦】</div>");
2526
{
2627
var e = data0;

0 commit comments

Comments
 (0)