Skip to content

Commit

Permalink
clear about duoshuo server
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhuyule committed Jan 5, 2018
1 parent aab1a52 commit 11d551f
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 535 deletions.
15 changes: 0 additions & 15 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,6 @@ han: false
# Baidu Analytics ID
#baidu_analytics:

# Duoshuo ShortName
#duoshuo_shortname:

# Disqus
disqus:
enable: false
Expand Down Expand Up @@ -429,9 +426,6 @@ gitment:
##uid: Get this uid from http://www.jiathis.com/
#add_this_id:

# Share
#duoshuo_share: true

# NeedMoreShare2
# Dependencies: https://github.com/theme-next/theme-next-needmoreshare2
# See: https://github.com/revir/need-more-share2
Expand Down Expand Up @@ -482,15 +476,6 @@ needmoreshare2:
# See https://azure.microsoft.com/en-us/services/application-insights/
# application_insights:

# Make duoshuo show UA
# user_id must NOT be null when admin_enable is true!
# you can visit http://dev.duoshuo.com get duoshuo user id.
duoshuo_info:
ua_enable: true
admin_enable: false
user_id: 0
#admin_nickname: Author

# Post widgets & FB/VK comments settings.
# ---------------------------------------------------------------
# Facebook SDK Support.
Expand Down
1 change: 0 additions & 1 deletion gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ gulp.task 'lint', ->
return gulp.src([
'./source/js/src/utils.js',
'./source/js/src/motion.js',
'./source/js/src/hook-duoshuo.js',
'./source/js/src/algolia-search.js',
'./source/js/src/bootstrap.js',
'./source/js/src/post-details.js',
Expand Down
1 change: 0 additions & 1 deletion layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<div id="content" class="content">
{% block content %}{% endblock %}
</div>
{% include '_third-party/duoshuo-hot-articles.swig' %}
{% include '_partials/comments.swig' %}
</div>
{% if theme.sidebar.display !== 'remove' %}
Expand Down
12 changes: 1 addition & 11 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,7 @@
{% endif %}

{% if post.comments %}
{% if (theme.duoshuo and theme.duoshuo.shortname) or theme.duoshuo_shortname %}
<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>
<a href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl">
<span class="post-comments-count ds-thread-count" data-thread-key="{{ post.path }}" itemprop="commentCount"></span>
</a>
</span>
{% elseif theme.facebook_comments_plugin.enable %}
{% if theme.facebook_comments_plugin.enable %}
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
Expand Down
9 changes: 1 addition & 8 deletions layout/_partials/comments.swig
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{% if page.comments %}

{% if (theme.duoshuo and theme.duoshuo.shortname) or theme.duoshuo_shortname %}
<div class="comments" id="comments">
<div class="ds-thread" data-thread-key="{{ page.path }}"
data-title="{{ page.title }}" data-url="{{ page.permalink }}">
</div>
</div>

{% elseif theme.facebook_sdk.enable and theme.facebook_comments_plugin.enable %}
{% if theme.facebook_sdk.enable and theme.facebook_comments_plugin.enable %}
<div class="comments" id="comments">
<div class="fb-comments"
data-href="{{ page.permalink }}"
Expand Down
4 changes: 0 additions & 4 deletions layout/_partials/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@
lazyload: {{ theme.lazyload }},
tabs: {{ theme.tabs.enable }},
motion: {{ theme.motion | json_encode }},
duoshuo: {
userId: '{{ theme.duoshuo_info.user_id | default() }}',
author: '{{ theme.duoshuo_info.admin_nickname | default(__('author'))}}'
},
algolia: {
applicationID: '{{ theme.algolia.applicationID }}',
apiKey: '{{ theme.algolia.apiKey }}',
Expand Down
36 changes: 17 additions & 19 deletions layout/_third-party/comments/disqus.swig
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %}
{% if theme.disqus.enable %}
{% if theme.disqus.enable %}

{% if theme.disqus.count %}
<script id="dsq-count-scr" src="https://{{theme.disqus.shortname}}.disqus.com/count.js" async></script>
{% endif %}

{% if page.comments %}
<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ page.permalink }}';
this.page.identifier = '{{ page.path }}';
this.page.title = '{{ page.title| addslashes }}';
};
var d = document, s = d.createElement('script');
s.src = 'https://{{theme.disqus.shortname}}.disqus.com/embed.js';
s.setAttribute('data-timestamp', '' + +new Date());
(d.head || d.body).appendChild(s);
</script>
{% endif %}
{% if theme.disqus.count %}
<script id="dsq-count-scr" src="https://{{theme.disqus.shortname}}.disqus.com/count.js" async></script>
{% endif %}

{% if page.comments %}
<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ page.permalink }}';
this.page.identifier = '{{ page.path }}';
this.page.title = '{{ page.title| addslashes }}';
};
var d = document, s = d.createElement('script');
s.src = 'https://{{theme.disqus.shortname}}.disqus.com/embed.js';
s.setAttribute('data-timestamp', '' + +new Date());
(d.head || d.body).appendChild(s);
</script>
{% endif %}

{% endif %}
33 changes: 0 additions & 33 deletions layout/_third-party/comments/duoshuo.swig

This file was deleted.

4 changes: 1 addition & 3 deletions layout/_third-party/comments/gitment.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %}
{% if theme.gitment.enable and theme.gitment.client_id %}
<!-- LOCAL: You can save these files to your site and update links -->
{% if theme.gitment.mint %}
Expand All @@ -23,7 +22,7 @@
<script type="text/javascript">
function renderGitment(){
var gitment = new {{CommentsClass}}({
id: window.location.pathname,
id: window.location.pathname,
owner: '{{ theme.gitment.github_user }}',
repo: '{{ theme.gitment.github_repo }}',
{% if theme.gitment.mint %}
Expand Down Expand Up @@ -56,4 +55,3 @@
{% endif %}

{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion layout/_third-party/comments/hypercomments.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname %}
{% if not theme.disqus_shortname %}

{% if theme.hypercomments_id %}

Expand Down
1 change: 0 additions & 1 deletion layout/_third-party/comments/index.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% include 'duoshuo.swig' %}
{% include 'disqus.swig' %}
{% include 'hypercomments.swig' %}
{% include 'youyan.swig' %}
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/comments/livere.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not (theme.disqus.enable and theme.disqus.shortname) and not theme.hypercomments_id %}
{% if not (theme.disqus.enable and theme.disqus.shortname) and not theme.hypercomments_id %}

{% if page.comments and theme.livere_uid %}
<script type="text/javascript">
Expand Down
4 changes: 1 addition & 3 deletions layout/_third-party/comments/youyan.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname)
and not theme.duoshuo_shortname
and not theme.disqus_shortname
{% if not theme.disqus_shortname
and not theme.hypercomments_id %}

{% if theme.youyan_uid %}
Expand Down
5 changes: 0 additions & 5 deletions layout/_third-party/duoshuo-hot-articles.swig

This file was deleted.

2 changes: 0 additions & 2 deletions layout/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
{% include '_partials/share/baidushare.swig' %}
{% elseif theme.add_this_id %}
{% include '_partials/share/add-this.swig' %}
{% elseif theme.duoshuo_shortname and theme.duoshuo_share %}
{% include '_partials/share/duoshuo_share.swig' %}
{% endif %}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions scripts/tags/center-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Alias: {% cq %} Something {% endcq %}

function centerQuote (args, content) {
console.log(hexo.render.renderer.store);
return '<blockquote class="blockquote-center">' +
hexo.render.renderSync({text: content, engine: 'markdown'}) +
'</blockquote>';
Expand Down
84 changes: 63 additions & 21 deletions scripts/tags/label.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,65 @@
/**
* label.js | global hexo script.
*
* Usage:
*
* {% label [class]@Text %}
*
* [class] : default | primary | success | info | warning | danger.
* If not defined, default class will be selected.
*/

function postLabel (args) {
args = args.join(' ').split('@');
var classes = args[0] || 'default';
var text = args[1] || '';

classes = classes.trim();
!text && hexo.log.warn('Label text must be defined!');

return '<span class="label ' + classes + '">' + text + '</span>';
/* global hexo *///console.log()
// Class: default, primary, success, info, warning, danger
// Usage: {% label class,Content %}
// Alias: {% lb class,Content %}

function Trim(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
}

function getClass(type) {
var perPart = 'info';

if (type == 'info') {
perPart = 'info';
} else
if (type == 'primary') {
perPart = 'primary';
} else
if (type == 'success') {
perPart = 'success';
} else
if (type == 'warning') {
perPart = 'warning';
} else
if (type == 'danger') {
perPart = 'danger';
} else
if (type == '1') {
perPart = 'info';
} else
if (type == '1') {
perPart = 'primary';
} else
if (type == '2') {
perPart = 'success';
} else
if (type == '3') {
perPart = 'warning';
} else
if (type == '4') {
perPart = 'danger';
};

perPart = '<span class="label label-' + perPart + '">';

return perPart;
}

function label(args) {
args = args.join(' ').split(',');
var type = args[0];
var perPart = getClass(Trim(type));
var endPart = '</span>';

var content = args[1];
for (var i=2;i<args.length;i++)
{
content = content + ',' + args[i];
}

return perPart + content + endPart;
}

hexo.extend.tag.register('label', postLabel, { ends: false });
hexo.extend.tag.register('label', label);
hexo.extend.tag.register('lb', label);
Loading

0 comments on commit 11d551f

Please sign in to comment.