Skip to content

Commit

Permalink
Merge pull request #1155 from ivan-nginx/5.1.0
Browse files Browse the repository at this point in the history
Add Hypercomments system.
  • Loading branch information
iissnan authored Oct 8, 2016
2 parents 27e0a7a + 04f4941 commit 341b4d5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ mathjax:
# Disqus
#disqus_shortname:

# Hypercomments
#hypercomments_id:

# Baidu Share
# Available value:
# button | slide
Expand Down
12 changes: 12 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentsCount"></span>
</a>
</span>
{% elseif theme.hypercomments_id %}
<!--noindex-->
<span class="post-comments-count">
&nbsp;|&nbsp;
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
<span class="post-comments-count hc-comment-count" data-xid="{{ post.path }}" itemprop="commentsCount"></span>
</a>
</span>
</span>
<!--/noindex-->
{% 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 @@ -11,6 +11,8 @@
<a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
</div>
{% elseif theme.hypercomments_id %}
<div id="hypercomments_widget"></div>
{% endif %}
</div>
{% endif %}
1 change: 1 addition & 0 deletions layout/_scripts/third-party/comments.swig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{% include './comments/duoshuo.swig' %}
{% include './comments/disqus.swig' %}
{% include './comments/hypercomments.swig' %}
27 changes: 27 additions & 0 deletions layout/_scripts/third-party/comments/hypercomments.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname %}

{% if theme.hypercomments_id %}

<script type="text/javascript">
_hcwp = window._hcwp || [];

_hcwp.push({widget:"Bloggerstream", widget_id: {{ theme.hypercomments_id }}, selector:".hc-comment-count", label: "{\%COUNT%\}" });

{% if page.comments %}
_hcwp.push({widget:"Stream", widget_id: {{ theme.hypercomments_id }}, xid: "{{ page.path }}"});
{% endif %}

(function() {
if("HC_LOAD_INIT" in window)return;
HC_LOAD_INIT = true;
var lang = (navigator.language || navigator.systemLanguage || navigator.userLanguage || "en").substr(0, 2).toLowerCase();
var hcc = document.createElement("script"); hcc.type = "text/javascript"; hcc.async = true;
hcc.src = ("https:" == document.location.protocol ? "https" : "http")+"://w.hypercomments.com/widget/hc/{{ theme.hypercomments_id }}/"+lang+"/widget.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hcc, s.nextSibling);
})();
</script>

{% endif %}

{% endif %}

0 comments on commit 341b4d5

Please sign in to comment.