From 2cba3b10cde7a6ddb286a2726ebd492928322505 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 14:27:56 +0800
Subject: [PATCH 01/35] Add multi-comments
---
_config.yml | 4 +++
layout/_partials/comments.swig | 31 +++++++++++++++++++--
scripts/filters/comment/default-config.js | 13 +++++++++
scripts/filters/comment/warn.js | 19 -------------
source/css/_common/components/comments.styl | 27 ++++++++++++++++++
5 files changed, 72 insertions(+), 22 deletions(-)
create mode 100644 scripts/filters/comment/default-config.js
delete mode 100644 scripts/filters/comment/warn.js
diff --git a/_config.yml b/_config.yml
index 6626ab14bd..7cd07bd03d 100644
--- a/_config.yml
+++ b/_config.yml
@@ -604,6 +604,10 @@ reading_progress:
# Comments and Widgets
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets
# ---------------------------------------------------------------
+# Comments system setting
+comments:
+ # If you have mutli-comment-system, active this comment when page loaded.
+ active:
# Disqus
disqus:
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index 3250cf4451..8766d94349 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -2,8 +2,33 @@
{%- if theme.injects.comment.length == 1 %}
{%- set inject_item = theme.injects.comment[0] %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
+ {%- else %}
+
+ {%- for inject_item in theme.injects.comment %}
+
+ {%- endfor %}
+
{%- endif %}
-{# {%- for inject_item in theme.injects.comment %}
- {{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
-{%- endfor %} #}
{%- endif %}
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
new file mode 100644
index 0000000000..52a1440cdf
--- /dev/null
+++ b/scripts/filters/comment/default-config.js
@@ -0,0 +1,13 @@
+/* global hexo */
+
+'use strict';
+
+const path = require('path');
+
+hexo.extend.filter.register('theme_inject', function(injects) {
+ injects.comment.raws.forEach(element => {
+ element.args[0] = Object.assign({
+ class: path.basename(element.name, path.extname(element.name))
+ }, element.args[0]);
+ });
+}, 99999);
diff --git a/scripts/filters/comment/warn.js b/scripts/filters/comment/warn.js
deleted file mode 100644
index f040d90d9b..0000000000
--- a/scripts/filters/comment/warn.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* global hexo */
-
-'use strict';
-
-hexo.extend.filter.register('theme_inject', injects => {
- if (injects.comment.raws.length > 1) {
- hexo.log.warn('It is currently not supported to launch mutli-comments systems at the same time, so stay tuned for subsequent versions of iteration.');
- hexo.log.warn('Please keep one of the following.');
- injects.comment.raws.forEach(element => {
- let commentName = element.name;
- // List comment system
- hexo.log.warn(' - ' + commentName);
- // Close comment system
- injects.postMeta.raw(commentName, '', {disableDefaultLayout: true}, {cache: true});
- injects.comment.raw(commentName, '', {}, {cache: true});
- injects.bodyEnd.raw(commentName, '', {}, {cache: true});
- });
- }
-}, 999);
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 9c8a2a0a54..448c0eb3fc 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -2,3 +2,30 @@
margin: 60px 20px 0;
overflow: hidden;
}
+
+.comment-button-group {
+ margin: 2rem 0 1rem;
+ display: flex;
+ justify-content: center;
+
+ .comment-button {
+ background-color: #fff;
+ border: 0;
+ cursor: pointer;
+ padding: 0.6rem 1.2rem;
+ margin: 0 0.2rem;
+ border-radius: 0.5rem;
+ }
+
+ .comment-button.active {
+ background-color: #ddd;
+ }
+
+}
+
+.comment-position {
+ display: none;
+}
+.comment-position.active {
+ display: block;
+}
From 1995b1295cc8aeb3aa9629bd1dbc8eeb37334ca3 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 15:35:43 +0800
Subject: [PATCH 02/35] Update button style
---
layout/_partials/comments.swig | 4 ++--
source/css/_common/components/comments.styl | 14 +++++---------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index 8766d94349..d240a2dd88 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -5,7 +5,7 @@
{%- else %}
{%- for inject_item in theme.injects.comment %}
@@ -17,7 +17,7 @@
let commentButton = document.querySelectorAll('.comment-button');
commentButton.forEach(item => {
console.log(item);
- let commentClass = item.classList[1];
+ let commentClass = item.classList[2];
console.log(commentClass);
item.addEventListener("click", () => {
commentButton.forEach(rmActive => rmActive.classList.remove('active'));
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 448c0eb3fc..1eaba1fa5e 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -9,16 +9,12 @@
justify-content: center;
.comment-button {
- background-color: #fff;
- border: 0;
- cursor: pointer;
- padding: 0.6rem 1.2rem;
margin: 0 0.2rem;
- border-radius: 0.5rem;
- }
-
- .comment-button.active {
- background-color: #ddd;
+ &.active {
+ background: $btn-default-hover-bg;
+ border-color: $btn-default-hover-border-color;
+ color: $btn-default-hover-color;
+ }
}
}
From 4a6ac1e31e033757c008a4055f202a4e93b4fbe4 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 15:53:23 +0800
Subject: [PATCH 03/35] moblie
---
source/css/_common/components/comments.styl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 1eaba1fa5e..33e38b28fc 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -4,12 +4,13 @@
}
.comment-button-group {
- margin: 2rem 0 1rem;
+ margin: 1.2em 0 .6em;
display: flex;
justify-content: center;
+ flex-wrap: wrap-reverse;
.comment-button {
- margin: 0 0.2rem;
+ margin: 0.1em 0.2em;
&.active {
background: $btn-default-hover-bg;
border-color: $btn-default-hover-border-color;
From 741a0f513ede5d8303536ca4d1c4a9b319851a9e Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 16:02:17 +0800
Subject: [PATCH 04/35] Fix facebook comments button style
---
layout/_partials/comments.swig | 2 +-
scripts/filters/comment/default-config.js | 4 +++-
scripts/filters/comment/facebook-comments-plugin.js | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index d240a2dd88..109ec0430f 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -5,7 +5,7 @@
{%- else %}
{%- for inject_item in theme.injects.comment %}
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
index 52a1440cdf..de14e43512 100644
--- a/scripts/filters/comment/default-config.js
+++ b/scripts/filters/comment/default-config.js
@@ -6,8 +6,10 @@ const path = require('path');
hexo.extend.filter.register('theme_inject', function(injects) {
injects.comment.raws.forEach(element => {
+ let injectName = path.basename(element.name, path.extname(element.name));
element.args[0] = Object.assign({
- class: path.basename(element.name, path.extname(element.name))
+ class: injectName,
+ button: injectName,
}, element.args[0]);
});
}, 99999);
diff --git a/scripts/filters/comment/facebook-comments-plugin.js b/scripts/filters/comment/facebook-comments-plugin.js
index 7f34b8a79c..f3d1184a8e 100644
--- a/scripts/filters/comment/facebook-comments-plugin.js
+++ b/scripts/filters/comment/facebook-comments-plugin.js
@@ -19,7 +19,9 @@ hexo.extend.filter.register('theme_inject', injects => {
data-colorscheme="{{ theme.facebook_comments_plugin.scheme }}">
- `);
+ `, {
+ button: ' facebook comments'
+ });
}, priority.facebook_comments_plugin);
From ef9909718978cd0bfaea0ed7bdcff16cc93c0022 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 16:11:34 +0800
Subject: [PATCH 05/35] Fix QA
---
scripts/filters/comment/default-config.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
index de14e43512..5d70acf1d0 100644
--- a/scripts/filters/comment/default-config.js
+++ b/scripts/filters/comment/default-config.js
@@ -9,7 +9,7 @@ hexo.extend.filter.register('theme_inject', function(injects) {
let injectName = path.basename(element.name, path.extname(element.name));
element.args[0] = Object.assign({
class: injectName,
- button: injectName,
+ button: injectName
}, element.args[0]);
});
}, 99999);
From 9c9ad516a01ad15b6408661d6df61b4d7d15308a Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Sat, 3 Aug 2019 16:18:53 +0800
Subject: [PATCH 06/35] Fix comment length is 0
---
_config.yml | 2 +-
layout/_partials/comments.swig | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/_config.yml b/_config.yml
index 7cd07bd03d..cb22d02fab 100644
--- a/_config.yml
+++ b/_config.yml
@@ -606,7 +606,7 @@ reading_progress:
# ---------------------------------------------------------------
# Comments system setting
comments:
- # If you have mutli-comment-system, active this comment when page loaded.
+ # If you want to enable mutli-comment-system, you can active one comment when page loaded.
active:
# Disqus
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index 109ec0430f..fa4c0dcb8e 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -2,7 +2,7 @@
{%- if theme.injects.comment.length == 1 %}
{%- set inject_item = theme.injects.comment[0] %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
- {%- else %}
+ {%- elif theme.injects.comment.length > 1 %}
`, {
- button: ' facebook comments'
+ button: ' facebook'
});
}, priority.facebook_comments_plugin);
From 49349d1a4de1d74df27fb92aec2d6419fe4e535c Mon Sep 17 00:00:00 2001
From: MrTT
Date: Sun, 4 Aug 2019 16:11:45 +0800
Subject: [PATCH 14/35] Add custom button support
---
_config.yml | 9 +++++++--
scripts/filters/comment/default-config.js | 7 +++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/_config.yml b/_config.yml
index 1c53c869d7..c08e61cce1 100644
--- a/_config.yml
+++ b/_config.yml
@@ -605,12 +605,17 @@ reading_progress:
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets
# ---------------------------------------------------------------
# Comments system setting
+# Types: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
comments:
- # If you want to enable mutli-comment-system, you can active one comment when page loaded.
- # active list: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
+ # If you enable mutli comments, you can active one comment type, it will display as default when page loaded.
active:
# If true, storage user selected comment, and active this when page loaded.
storage: true
+ # Set button style over the default. Configurate as following.
+ button:
+ #disqus: disqus
+ #[facebook-comments-plugin]: facebook
+ #gitalk: Load Gitalk
# Disqus
disqus:
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
index 418243db99..7fcf9c7af8 100644
--- a/scripts/filters/comment/default-config.js
+++ b/scripts/filters/comment/default-config.js
@@ -6,10 +6,17 @@ const path = require('path');
hexo.extend.filter.register('theme_inject', injects => {
injects.comment.raws.forEach(element => {
+ // Set default button content
let injectName = path.basename(element.name, path.extname(element.name));
element.args[0] = Object.assign({
class: injectName,
button: injectName
}, element.args[0]);
+ // Set custom button content
+ let locals = element.args[0];
+ let customButton = hexo.theme.config.comments.button[locals.class];
+ if (customButton) {
+ locals.button = customButton;
+ }
});
}, 99999);
From 6598b872513463ceb14c3d5f3fa35709e522253f Mon Sep 17 00:00:00 2001
From: MrTT
Date: Sun, 4 Aug 2019 16:13:12 +0800
Subject: [PATCH 15/35] Fix null
---
scripts/filters/comment/default-config.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
index 7fcf9c7af8..5f7e9be5f1 100644
--- a/scripts/filters/comment/default-config.js
+++ b/scripts/filters/comment/default-config.js
@@ -14,9 +14,11 @@ hexo.extend.filter.register('theme_inject', injects => {
}, element.args[0]);
// Set custom button content
let locals = element.args[0];
- let customButton = hexo.theme.config.comments.button[locals.class];
- if (customButton) {
- locals.button = customButton;
+ if (hexo.theme.config.comments.button) {
+ let customButton = hexo.theme.config.comments.button[locals.class];
+ if (customButton) {
+ locals.button = customButton;
+ }
}
});
}, 99999);
From 96fc0f43449dea2530c986443da58335a0032f5a Mon Sep 17 00:00:00 2001
From: MrTT
Date: Sun, 4 Aug 2019 17:30:09 +0800
Subject: [PATCH 16/35] Add pjax
---
layout/_partials/comments.swig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index 0e228a386b..5572454cc8 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -13,7 +13,7 @@
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{%- endfor %}
-
{%- endif %}
{%- endif %}
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 33e38b28fc..88ce523c27 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -4,7 +4,7 @@
}
.comment-button-group {
- margin: 1.2em 0 .6em;
+ margin: 1em 0;
display: flex;
justify-content: center;
flex-wrap: wrap-reverse;
From 31b2329b806a932a73907d093eb50b67026db1e5 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 11:33:05 +0800
Subject: [PATCH 18/35] Add tabs style
---
_config.yml | 7 +-
layout/_partials/comments.swig | 83 ++++++++++++--------
scripts/filters/comment/default-config.js | 5 +-
source/css/_common/components/comments.styl | 12 +++
source/css/_common/components/tags/tabs.styl | 2 +-
source/css/_schemes/Gemini/index.styl | 3 +
6 files changed, 74 insertions(+), 38 deletions(-)
diff --git a/_config.yml b/_config.yml
index 4fa423092f..18b34026cd 100644
--- a/_config.yml
+++ b/_config.yml
@@ -612,12 +612,15 @@ reading_progress:
# Comments system setting
# Types: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
comments:
+ # You can choose `buttons` or `tabs`
+ style: tabs
# If you enable mutli comments, you can active one comment type, it will display as default when page loaded.
active:
# If true, storage user selected comment, and active this when page loaded.
+ # Only support style is `buttons`.
storage: true
- # Set button style over the default. Configurate as following.
- button:
+ # Modify button or tabs style over the default. Configurate as following.
+ nav:
#disqus: disqus
#[facebook-comments-plugin]: facebook
#gitalk: Load Gitalk
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index f9cc2948fc..6f196f708d 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -3,42 +3,59 @@
{%- set inject_item = theme.injects.comment[0] %}
{{ partial(inject_item.layout, inject_item.locals, inject_item.options) }}
{%- elif theme.injects.comment.length > 1 %}
-
- {%- for inject_item in theme.injects.comment %}
-
- {%- endfor %}
-
+ if (activeClass) {
+ let activeButton = document.querySelector(`.comment-button.${activeClass}`);
+ if (activeButton) {
+ activeButton.click();
+ }
+ }
+ })();
+
+ {%- elif theme.comments.style == 'tabs' %}
+
+ {%- endif %}
{%- endif %}
{%- endif %}
diff --git a/scripts/filters/comment/default-config.js b/scripts/filters/comment/default-config.js
index 5f7e9be5f1..5b5c55ef51 100644
--- a/scripts/filters/comment/default-config.js
+++ b/scripts/filters/comment/default-config.js
@@ -14,8 +14,9 @@ hexo.extend.filter.register('theme_inject', injects => {
}, element.args[0]);
// Set custom button content
let locals = element.args[0];
- if (hexo.theme.config.comments.button) {
- let customButton = hexo.theme.config.comments.button[locals.class];
+ let nav = hexo.theme.config.comments.nav;
+ if (nav) {
+ let customButton = nav[locals.class];
if (customButton) {
locals.button = customButton;
}
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 88ce523c27..3941160862 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -26,3 +26,15 @@
.comment-position.active {
display: block;
}
+
+.tabs-comment {
+ padding-top: 0;
+ margin-top: 4em;
+ background: white;
+ .comments {
+ margin-top: 0;
+ padding-top: 0;
+ border: 0;
+ box-shadow: none;
+ }
+}
diff --git a/source/css/_common/components/tags/tabs.styl b/source/css/_common/components/tags/tabs.styl
index 6bcd90083a..49f794d2ed 100644
--- a/source/css/_common/components/tags/tabs.styl
+++ b/source/css/_common/components/tags/tabs.styl
@@ -1,4 +1,4 @@
-.post-body .tabs {
+.post-body .tabs,.tabs-comment {
display: block;
margin-bottom: 20px;
padding-top: 10px;
diff --git a/source/css/_schemes/Gemini/index.styl b/source/css/_schemes/Gemini/index.styl
index d3231896fd..7875826268 100644
--- a/source/css/_schemes/Gemini/index.styl
+++ b/source/css/_schemes/Gemini/index.styl
@@ -61,6 +61,9 @@ $use-seo = hexo-config('seo');
margin-top: $sidebar-offset;
padding: $content-desktop-padding;
}
+.tabs-comment {
+ margin-top: 1em;
+}
// Top main padding from header to posts (default 40px).
.posts-expand {
From e31ac2bede4928d46aca62c1ceb0786e5f56499e Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 12:38:34 +0800
Subject: [PATCH 19/35] Update post meta
---
scripts/filters/comment/changyan.js | 2 +-
scripts/filters/comment/common.js | 29 ++++++++++++++-----
scripts/filters/comment/disqus.js | 2 +-
.../comment/facebook-comments-plugin.js | 2 +-
scripts/filters/comment/valine.js | 2 +-
5 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/scripts/filters/comment/changyan.js b/scripts/filters/comment/changyan.js
index a49a1780c2..1fe9cc7a92 100644
--- a/scripts/filters/comment/changyan.js
+++ b/scripts/filters/comment/changyan.js
@@ -29,7 +29,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('changyan', `
{% if post.comments %}
- ${iconText}
+ ${iconText('comment-o', 'changyan')}
{% if is_post() %}
diff --git a/scripts/filters/comment/common.js b/scripts/filters/comment/common.js
index e92252b1a1..934042d26d 100644
--- a/scripts/filters/comment/common.js
+++ b/scripts/filters/comment/common.js
@@ -1,12 +1,25 @@
'use strict';
+function capitalize(input) {
+ return input.toString().charAt(0).toUpperCase() + input.toString().substr(1);
+}
+
module.exports = {
- iconText: `
-
-
-
- {% if theme.post_meta.item_text %}
- {{ __('post.comments_count') + __('symbol.colon') }}
- {% endif %}
- `
+ iconText(icon, key, defaultValue) {
+ if (!defaultValue) {
+ defaultValue = capitalize(key);
+ }
+ return `
+
+
+
+ {%- if theme.post_meta.item_text %}
+ {%- set post_meta_comment = __('post.comments.${key}') %}
+ {%- if post_meta_comment == 'post.comments.${key}' %}
+ {%- set post_meta_comment = '${defaultValue}' %}
+ {%- endif %}
+ {{ (post_meta_comment|default('${defaultValue}')) + __('symbol.colon') }}
+ {%- endif %}
+ `
+ }
};
diff --git a/scripts/filters/comment/disqus.js b/scripts/filters/comment/disqus.js
index e44cc95bdb..afe3896387 100644
--- a/scripts/filters/comment/disqus.js
+++ b/scripts/filters/comment/disqus.js
@@ -33,7 +33,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('disqus', `
{% if post.comments %}
- ${iconText}
+ ${iconText('comment-o', 'disqus')}
diff --git a/scripts/filters/comment/facebook-comments-plugin.js b/scripts/filters/comment/facebook-comments-plugin.js
index 3468ba8b23..038e2dd2be 100644
--- a/scripts/filters/comment/facebook-comments-plugin.js
+++ b/scripts/filters/comment/facebook-comments-plugin.js
@@ -33,7 +33,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('facebook-comments-plugin', `
{% if post.comments %}
- ${iconText}
+ ${iconText('comment-o', 'facebook')}
diff --git a/scripts/filters/comment/valine.js b/scripts/filters/comment/valine.js
index b71dd5462b..80e45366f0 100644
--- a/scripts/filters/comment/valine.js
+++ b/scripts/filters/comment/valine.js
@@ -25,7 +25,7 @@ hexo.extend.filter.register('theme_inject', injects => {
injects.postMeta.raw('valine', `
{% if post.comments and (is_post() or theme.valine.comment_count) %}
- ${iconText}
+ ${iconText('comment-o', 'valine')}
From 7332e459c601cfdc0c52cc5c72c6f88f14256e0a Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 12:41:34 +0800
Subject: [PATCH 20/35] Fix defaultValue
---
scripts/filters/comment/common.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/filters/comment/common.js b/scripts/filters/comment/common.js
index 934042d26d..d12da50ddb 100644
--- a/scripts/filters/comment/common.js
+++ b/scripts/filters/comment/common.js
@@ -18,7 +18,7 @@ module.exports = {
{%- if post_meta_comment == 'post.comments.${key}' %}
{%- set post_meta_comment = '${defaultValue}' %}
{%- endif %}
- {{ (post_meta_comment|default('${defaultValue}')) + __('symbol.colon') }}
+ {{ post_meta_comment + __('symbol.colon') }}
{%- endif %}
`
}
From 2fdefaa0d02d2bd3ac4a9f27873a18cbaf85f9ac Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 12:50:49 +0800
Subject: [PATCH 21/35] Add title
---
scripts/filters/comment/changyan.js | 4 ++--
scripts/filters/comment/disqus.js | 2 +-
scripts/filters/comment/facebook-comments-plugin.js | 2 +-
scripts/filters/comment/valine.js | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/filters/comment/changyan.js b/scripts/filters/comment/changyan.js
index 1fe9cc7a92..3101fbb977 100644
--- a/scripts/filters/comment/changyan.js
+++ b/scripts/filters/comment/changyan.js
@@ -31,11 +31,11 @@ hexo.extend.filter.register('theme_inject', injects => {
${iconText('comment-o', 'changyan')}
{% if is_post() %}
-
+
{% else %}
-
+
{% endif %}
diff --git a/scripts/filters/comment/disqus.js b/scripts/filters/comment/disqus.js
index afe3896387..2d24ab098a 100644
--- a/scripts/filters/comment/disqus.js
+++ b/scripts/filters/comment/disqus.js
@@ -34,7 +34,7 @@ hexo.extend.filter.register('theme_inject', injects => {
{% if post.comments %}
${iconText('comment-o', 'disqus')}
-
+
diff --git a/scripts/filters/comment/facebook-comments-plugin.js b/scripts/filters/comment/facebook-comments-plugin.js
index 038e2dd2be..7b5263b908 100644
--- a/scripts/filters/comment/facebook-comments-plugin.js
+++ b/scripts/filters/comment/facebook-comments-plugin.js
@@ -34,7 +34,7 @@ hexo.extend.filter.register('theme_inject', injects => {
{% if post.comments %}
${iconText('comment-o', 'facebook')}
-
+
diff --git a/scripts/filters/comment/valine.js b/scripts/filters/comment/valine.js
index 80e45366f0..b60aa7b379 100644
--- a/scripts/filters/comment/valine.js
+++ b/scripts/filters/comment/valine.js
@@ -26,7 +26,7 @@ hexo.extend.filter.register('theme_inject', injects => {
{% if post.comments and (is_post() or theme.valine.comment_count) %}
${iconText('comment-o', 'valine')}
-
+
From 4bb84cedc93f52b18c5882b8f774dcc9efdaba6d Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 12:55:04 +0800
Subject: [PATCH 22/35] Fix QA
---
scripts/filters/comment/common.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/filters/comment/common.js b/scripts/filters/comment/common.js
index d12da50ddb..7b4a1bb2b8 100644
--- a/scripts/filters/comment/common.js
+++ b/scripts/filters/comment/common.js
@@ -20,6 +20,6 @@ module.exports = {
{%- endif %}
{{ post_meta_comment + __('symbol.colon') }}
{%- endif %}
- `
+ `;
}
};
From 12695f46450f061a7cfbf171366e2f4f08567975 Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Mon, 5 Aug 2019 17:10:00 +0800
Subject: [PATCH 23/35] Del i18n comments_count
---
languages/en.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/languages/en.yml b/languages/en.yml
index ed25551727..b1fae2bc93 100644
--- a/languages/en.yml
+++ b/languages/en.yml
@@ -32,7 +32,6 @@ post:
sticky: Sticky
toc_empty: This post does not have a Table of Contents
views: Views
- comments_count: Comments
related_posts: Related Posts
copy_button: Copy
copy_success: Copied
From ae0613fecd966fe8786a6210fab8767e786c1546 Mon Sep 17 00:00:00 2001
From: 1v9
Date: Wed, 7 Aug 2019 10:39:40 +0800
Subject: [PATCH 24/35] update
---
_config.yml | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/_config.yml b/_config.yml
index d0249de295..50217a1e70 100644
--- a/_config.yml
+++ b/_config.yml
@@ -609,17 +609,18 @@ reading_progress:
# Comments and Widgets
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets
# ---------------------------------------------------------------
-# Comments system setting
-# Types: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
+
+# Multiple Comment System Support
comments:
- # You can choose `buttons` or `tabs`
- style: tabs
- # If you enable mutli comments, you can active one comment type, it will display as default when page loaded.
+ # Available values: tabs | buttons
+ style:
+ # Choose a comment system to be displayed by default
+ # Supported values: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
active:
- # If true, storage user selected comment, and active this when page loaded.
- # Only support style is `buttons`.
+ # This option is only for `style: buttons` now
+ # Setting `true` means remembering the comment system selected by the visitor
storage: true
- # Modify button or tabs style over the default. Configurate as following.
+ # Modify icons and texts for any style, here are some examples
nav:
#disqus: disqus
#[facebook-comments-plugin]: facebook
From c24144026566b82201d523e43aa84c8127850002 Mon Sep 17 00:00:00 2001
From: StevenJoeZhang <1119186082@qq.com>
Date: Wed, 7 Aug 2019 10:48:29 +0800
Subject: [PATCH 25/35] stylint
---
source/css/_common/components/comments.styl | 21 +++++++++++---------
source/css/_common/components/tags/tabs.styl | 2 +-
source/css/_schemes/Gemini/index.styl | 1 +
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/source/css/_common/components/comments.styl b/source/css/_common/components/comments.styl
index 3941160862..2f1bcd05f7 100644
--- a/source/css/_common/components/comments.styl
+++ b/source/css/_common/components/comments.styl
@@ -4,13 +4,14 @@
}
.comment-button-group {
- margin: 1em 0;
display: flex;
- justify-content: center;
flex-wrap: wrap-reverse;
+ justify-content: center;
+ margin: 1em 0;
.comment-button {
margin: 0.1em 0.2em;
+
&.active {
background: $btn-default-hover-bg;
border-color: $btn-default-hover-border-color;
@@ -22,19 +23,21 @@
.comment-position {
display: none;
-}
-.comment-position.active {
- display: block;
+
+ &.active {
+ display: block;
+ }
}
.tabs-comment {
- padding-top: 0;
- margin-top: 4em;
background: white;
+ margin-top: 4em;
+ padding-top: 0;
+
.comments {
- margin-top: 0;
- padding-top: 0;
border: 0;
box-shadow: none;
+ margin-top: 0;
+ padding-top: 0;
}
}
diff --git a/source/css/_common/components/tags/tabs.styl b/source/css/_common/components/tags/tabs.styl
index 49f794d2ed..5018f8f077 100644
--- a/source/css/_common/components/tags/tabs.styl
+++ b/source/css/_common/components/tags/tabs.styl
@@ -1,4 +1,4 @@
-.post-body .tabs,.tabs-comment {
+.post-body .tabs, .tabs-comment {
display: block;
margin-bottom: 20px;
padding-top: 10px;
diff --git a/source/css/_schemes/Gemini/index.styl b/source/css/_schemes/Gemini/index.styl
index 7875826268..4ee322f24c 100644
--- a/source/css/_schemes/Gemini/index.styl
+++ b/source/css/_schemes/Gemini/index.styl
@@ -61,6 +61,7 @@ $use-seo = hexo-config('seo');
margin-top: $sidebar-offset;
padding: $content-desktop-padding;
}
+
.tabs-comment {
margin-top: 1em;
}
From ab43c3bdd4ab9d6bc9fc078ab484a7b29e39443f Mon Sep 17 00:00:00 2001
From: jiangtj <116749895@qq.com>
Date: Wed, 7 Aug 2019 10:50:00 +0800
Subject: [PATCH 26/35] Add configKey
---
_config.yml | 4 ++--
layout/_partials/comments.swig | 6 +++---
scripts/filters/comment/default-config.js | 14 ++++++++++----
.../filters/comment/facebook-comments-plugin.js | 1 +
scripts/filters/comment/vkontakte.js | 1 +
5 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/_config.yml b/_config.yml
index d0249de295..e572afcf08 100644
--- a/_config.yml
+++ b/_config.yml
@@ -610,7 +610,7 @@ reading_progress:
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets
# ---------------------------------------------------------------
# Comments system setting
-# Types: changyan | disqus | disqusjs | facebook-comments-plugin | gitalk | livere | valine | vkontakte-comments
+# Types: changyan | disqus | disqusjs | facebook_comments_plugin | gitalk | livere | valine | vkontakte
comments:
# You can choose `buttons` or `tabs`
style: tabs
@@ -622,7 +622,7 @@ comments:
# Modify button or tabs style over the default. Configurate as following.
nav:
#disqus: disqus
- #[facebook-comments-plugin]: facebook
+ #facebook_comments_plugin: facebook
#gitalk: Load Gitalk
# Disqus
diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig
index 6f196f708d..a675bf1069 100644
--- a/layout/_partials/comments.swig
+++ b/layout/_partials/comments.swig
@@ -29,7 +29,7 @@
{%- endif %}
})
})
- let activeClass = '{{theme.comments.active}}';
+ let activeClass = '{{theme.comments.activeClass}}';
{%- if theme.comments.storage %}
activeClass = localStorage.getItem('comments_active') || activeClass;
{%- endif %}
@@ -45,12 +45,12 @@