Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add changyan comments #1514

Merged
merged 1 commit into from
Mar 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ mathjax:
# Gentie productKey
#gentie_productKey:

# changyan
changyan_appid:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those two fields could be grouped into one:

chanyan:
  enable: false
  appid: 
  appkey: 

changyan_appkey:

# Support for youyan comments system.
# You can get your uid from http://www.uyan.cc
#youyan_uid: your uid
Expand Down
16 changes: 16 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,22 @@
<span class="post-comments-count join-count" itemprop="commentCount"></span>
</a>
</span>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use correct indentation.

{% elseif theme.changyan_appid and theme.changyan_appkey %}
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
{% if is_post() %}
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl">
<span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentsCount"></span>
</a>
{% else %}
<a href="{{ url_for(post.path) }}#SOHUCS" itemprop="discussionUrl">
<span id = "url::{{ post.permalink }}" class = "cy_cmt_count" data-xid="{{ post.path }}" itemprop="commentsCount" ></span>
</a>
{% endif %}
{% endif %}
{% endif %}

Expand Down
2 changes: 2 additions & 0 deletions layout/_partials/comments.swig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<div id="uyan_frame"></div>
{% elseif theme.livere_uid %}
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>
{% elseif theme.changyan_appid and theme.changyan_appkey %}
<div id="SOHUCS" ></div>
{% endif %}
</div>
{% endif %}
3 changes: 2 additions & 1 deletion layout/_scripts/third-party/comments.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
{% include './comments/hypercomments.swig' %}
{% include './comments/gentie.swig' %}
{% include './comments/youyan.swig' %}
{% include './comments/livere.swig' %}
{% include './comments/livere.swig' %}
{% include './comments/changyan.swig' %}
14 changes: 14 additions & 0 deletions layout/_scripts/third-party/comments/changyan.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if theme.changyan_appid and theme.changyan_appkey %}
{% if is_home() %}
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId={{theme.changyan_appid}}"></script>
{% else %}
<script type="text/javascript">
(function(){
var appid = '{{theme.changyan_appid}}';
var conf = '{{theme.changyan_appkey}}';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })(); </script>
<script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
{% endif %}
{% endif %}