Skip to content

Commit

Permalink
opt & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuechao committed Oct 17, 2019
1 parent aaecefb commit 6a5ffda
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ github api 详情可以参照[官方api说明](https://developer.github.com/v3/#
+ 这个 code 是 GitHub 登录授权完成时,在跳转回 redirect_uri 的查询参数拿到的, redirect_uri 必须是在 OAuth App 配置的 callback URL 域名下。
+ 这样即使别人用了你的 client_id 和 client_secret ,跳转之后也拿不到 code,所以,有 client_id 和 client_secret 也做不了什么。

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

Large diffs are not rendered by default.

44 changes: 39 additions & 5 deletions themes/icarus/layout/common/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
<div class="level-item tag is-danger" style="background-color: #3273dc;">已置顶</div>
<%} %>
<time class="level-item has-text-grey" datetime="<%= date_xml(post.date) %>"><%= date(post.date) %></time>
<span class="display-none-class"><%- md5(post.path) %></span>
<img class="not-gallery-item" src="/images/chat.svg">&nbsp;<span class="level-item has-text-grey" id=<%- md5(post.path) %>>99+</span></img>
<% if (get_config('comment.type') == 'gitalk') { %>
<span class="display-none-class"><%- md5(post.path) %></span>
<img class="not-gallery-item" src="/images/chat.svg">&nbsp;<span class="level-item has-text-grey" id=<%- md5(post.path) %>>99+</span></img>
<% } %>
<% if (post.categories && post.categories.length) { %>
<div class="level-item">
<%- list_categories(post.categories, {
Expand Down Expand Up @@ -52,6 +54,17 @@
<div class="content">
<%- index && post.excerpt ? post.excerpt : post.content %>
</div>
<!-- 部分参考自https://www.alphalxy.com/2019/03/customize-icarus/ -->
<% if (!index && post.layout === 'post' && post.copyright !== false) { %>
<ul class="post-copyright">
<li><strong>本文标题:</strong><a href="<%= post.permalink %>"><%= page.title %></a></li>
<li><strong>本文作者:</strong><a href="<%= theme.url %>"><%= theme.author %></a></li>
<li><strong>本文链接:</strong><a href="<%= post.permalink %>"><%= post.permalink %></a></li>
<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> 许可协议。转载请注明出处!
</li>
</ul>
<br>
<% } %>
<% if (!index && post.tags && post.tags.length) { %>
<div class="level is-size-7 is-uppercase">
<div class="level-start">
Expand All @@ -60,17 +73,38 @@
<%- list_tags(post.tags, {
class: 'has-link-grey ',
show_count: false,
style: 'link'
style: 'link',
separator: ',&nbsp;'
}) %>
</div>
</div>
</div>
<% } %>
<% if (index && post.excerpt) { %>
<div class="level is-mobile">
<div class="level is-mobile is-flex">
<div class="level-start">
<% if (post.tags && post.tags.length) { %>
<div class="level-item is-size-7 is-uppercase">
<i class="fas fa-tags has-text-grey"></i>&nbsp;
<%- list_tags(post.tags, {
class: 'has-link-grey ',
show_count: false,
style: 'link',
separator: ',&nbsp;'
}) %>
</div>
<% } %>
</div>
<div class="level-start">
<div class="level-item has-text-grey is-size-7 is-hidden-mobile">
<% if (post.updated && post.updated > post.date) { %>
<time datetime="<%= date_xml(post.updated) %>"><i class="far fa-calendar-check">&nbsp;更新时间:&nbsp;</i><%= date(post.updated) %></time>
<% } %>
</div>
</div>
<div class="level-start">
<div class="level-item">
<a class="button is-size-7 is-light" href="<%- url_for(post.path) %>#more"><%= __('article.more') %></a>
<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>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion themes/icarus/layout/common/widget.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
} %>
<% function visibility_class() {
if (column_count() === 3 && position === 'right') {
return 'is-hidden-touch is-hidden-desktop-only';
return '';
}
return '';
} %>
Expand Down
16 changes: 8 additions & 8 deletions themes/icarus/layout/index.ejs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if (page.path == 'index.html') { %>
<!-- 参考自https://dp2px.com/网站 -->
<div class="tag is-white" style="font-size:15px;">热门推荐:</div>
<br>
<br>
<div class="tags hot-tags" id = "index_hot_div">
加载中,稍等几秒...
</div>
<% if (page.path == 'index.html' && get_config('comment.type') == 'gitalk'){ %>
<!-- 参考自https://dp2px.com/网站 -->
<div class="tag is-white" style="font-size:15px;">热门推荐:</div>
<br>
<br>
<div class="tags hot-tags" id = "index_hot_div">
加载中,稍等几秒...
</div>
<% } %>
<% page.posts.each(function(post){ %>
<%- partial('common/article', { post, index: true }) %>
Expand Down
10 changes: 6 additions & 4 deletions themes/icarus/layout/widget/hot_comment.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="card widget">
<div class="card-content" id="body_hot_comment">
<h3 class="menu-label">最新评论<br>加载中,稍等几秒...</h3>
<% if (get_config('comment.type') == 'gitalk') { %>
<div class="card widget">
<div class="card-content" id="body_hot_comment">
<h3 class="menu-label">最新评论<br>加载中,稍等几秒...</h3>
</div>
</div>
</div>
<% } %>
4 changes: 2 additions & 2 deletions themes/icarus/layout/widget/notice.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<% if (links !== null) { %>
<div class="card widget">
<div class="card-content">
<div class="menu">
<div class="menu text-desc">
<h3 class="menu-label">
通知
</h3>
<ul class="menu-list">
<% for (let i in links) { %>
<li>
<span class="level-left">
<span class="level-item" style="justify-content:left;margin-left:4px;"><%= i %></span>
<span class="level-item notice-item"><%= i %></span>
</span>
</li>
<% } %>
Expand Down
6 changes: 4 additions & 2 deletions themes/icarus/layout/widget/toc.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ function buildToc(toc) {
return result;
}
%>
<div class="card widget" id="toc">
<% let tocContent = buildToc(_toc(post.content)); if (tocContent !== '' && tocContent !== undefined){ %>
<div class="card widget" id="toc" style="max-height: 225px;overflow: auto;">
<div class="card-content">
<div class="menu">
<h3 class="menu-label">
<%= _p('widget.catalogue', Infinity) %>
</h3>
<%- buildToc(_toc(post.content)) %>
<%- tocContent %>
</div>
</div>
</div>
<% } %>
<% } %>
23 changes: 19 additions & 4 deletions themes/icarus/source/css/style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,11 @@ figure.highlight


.cardm {
border-left: 5px solid #6190e8;
//border-left: 5px solid #6190e8;
width: 32%;
background-color: white;
border-radius: 2px;
box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
//box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
color: #4a4a4a;
padding: 0.5rem;
display: inline-block;
Expand Down Expand Up @@ -663,7 +663,7 @@ figure.highlight
-o-transition: all 0.5s ease-in;
}

card-comment-item img {
.card-comment-item img {
float left
transition: all 0.5s ease-in;
-webkit-transition: all 0.5s ease-in;
Expand Down Expand Up @@ -747,6 +747,7 @@ card-comment-item img {
.item {
margin-top: -4px;
margin-bottom: -9px;
// #f6f9fe
background-color: #f9f9f900;
color: #3d3d3d;
-webkit-line-clamp: 3;
Expand Down Expand Up @@ -792,6 +793,20 @@ card-comment-item img {
background-color: #d9e6fd;
}

.notice-item {
justify-content: left;
margin-left: 4px;
}

.display-none-class {
display:none;
}
}

.post-copyright
font-size: 1rem
letter-spacing: 0.02rem
word-break: break-all
margin: 2.5rem 0 0
padding: 1rem 1rem
border-left: 3px solid #FF1700
background-color: #F9F9F9
3 changes: 2 additions & 1 deletion themes/icarus/source/js/friend.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};

if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
Expand All @@ -20,7 +21,7 @@ $(function () { //获取处理友链数据
$.getJSON("../json_data/friend.json", function (data) {

var data0 = data[0];

$('.links-content').html("");
$('.links-content').append("<div class=\"link-navigation\"><div class='friend-title-item'>本站友链信息【欢迎添加到自己的网站,需要交换友链请留言哦】</div>");
{
var e = data0;
Expand Down
Loading

0 comments on commit 6a5ffda

Please sign in to comment.