Skip to content

Commit

Permalink
Merge pull request #35 from Z4HD/master
Browse files Browse the repository at this point in the history
添加对Gitment评论系统的支持
  • Loading branch information
iTimeTraveler authored Oct 5, 2017
2 parents 5d5106f + 4349aea commit f3d2d67
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
7 changes: 6 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ duoshuo_shortname:
disqus_shortname:
livere_shortname: MTAyMC8yOTQ4MS82MDQ5
uyan_uid:
wumii:
wumii:
gitment:
owner: #Your GitHub ID
repo: #The repo to store comments
client_id: #Your client ID
client_secret: #Your client secret

# Code Highlight theme
# Available value:
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<% if (!index && theme.donate.enable){ %>
<%- partial('donate') %>
<% } %>

<% if (!index && post.comments && (theme.gentie_productKey || theme.duoshuo_shortname || theme.disqus_shortname || theme.uyan_uid || theme.wumii || theme.livere_shortname)){ %>
<% if (!index && post.comments && (theme.gentie_productKey || theme.duoshuo_shortname || theme.disqus_shortname || theme.uyan_uid || theme.wumii || theme.livere_shortname || theme.gitment.owner)){ %>
<%- partial('comment') %>
<% } %>
</footer>
Expand Down
22 changes: 21 additions & 1 deletion layout/_partial/comment.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- 多说公共JS代码 end -->
</div>
<%- css('css/comment.css') %>
<%- css('css/comment-ds.css') %>
<% } else if (theme.disqus_shortname) {%>
<section id="comments" class="comment">
<div id="disqus_thread">
Expand Down Expand Up @@ -104,4 +104,24 @@
</div>
<!-- City版安装代码已完成 -->
</div>
<% } else if (theme.gitment.client_secret) {%>
<!-- Gitment START! Deploy by Z4HD -->
<div id="comments"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: '<%- post.permalink %>',
owner: '<%- theme.gitment.owner %>',
repo: '<%- theme.gitment.repo %>',
oauth: {
client_id: '<%- theme.gitment.client_id %>',
client_secret: '<%- theme.gitment.client_secret %>',
},
})
gitment.render('comments')
</script>
<!-- Gitment 自定义样式表 -->
<%- css('css/comment-gitment.css') %>
<!-- Gitment END! -->
<% } %>
2 changes: 1 addition & 1 deletion source/css/comment.css → source/css/comment-ds.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ padding: 0 3px;
#ds-thread #ds-reset .ds-replybox {background: #fafafa;padding: 0 !important;}

#ds-thread #ds-reset .ds-post-button {background: #16171b;}
#ds-thread #ds-reset .ds-post-button:hover {background: #ff2828;}
#ds-thread #ds-reset .ds-post-button:hover {background: #ff2828;}
13 changes: 13 additions & 0 deletions source/css/comment-gitment.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*Gitment TAB 颜色调整*/
.gitment-editor-tab{
transition: color 0.25s, background 0.25s, border-color 0.25s;
-moz-transition: color 0.25s, background 0.25s, border-color 0.25s; /* Firefox 4 */
-webkit-transition: color 0.25s, background 0.25s, border-color 0.25s; /* Safari 和 Chrome */
-o-transition: color 0.25s, background 0.25s, border-color 0.25s;
}
.gitment-editor-tab:hover{
color: white;
background: black;
border-color: black;
}
.gitment-editor-submit{background-color: #ff321e !important}

0 comments on commit f3d2d67

Please sign in to comment.