diff --git a/src/disqus.js b/src/disqus.js
index 2d51b31..956d110 100644
--- a/src/disqus.js
+++ b/src/disqus.js
@@ -393,6 +393,7 @@ loadError = () => {
getThreadInfo = () => {
document.getElementById('dsqjs-loading-dsqjs').classList.remove('dsqjs-hide');
document.getElementById('dsqjs-force-disqus').addEventListener('click', forceDisqus);
+ document.getElementById('dsqjs-reload-disqus').addEventListener('click', checkDisqus);
let url = disqusjs.config.api + '3.0/threads/list.json?forum=' + disqusjs.config.shortname + '&thread=ident:' + disqusjs.config.identifier + '&api_key=' + disqusjs.config.apikey;
xhr.open('GET', url, true);
xhr.timeout = 4000;
@@ -431,19 +432,22 @@ getComment = () => {
xhr.onload = function () {
if (this.status == 200 || this.status == 304) {
var res = JSON.parse(this.responseText);
- if (res.code === 0) {
+ if (res.code === 0 && res.response.length > 0) {
getCommentList(res.response);
- } else {
- // Have error when get comments.
+ } else if (res.code === 0 && res.response.length === 0) {
+ // Have no comments.
+ document.getElementById('dsqjs-no-comment').classList.remove('dsqjs-hide');
}
}
};
xhr.ontimeout = (e) => {
- console.log(e)
+ // Have error when get comments.
+ loadError();
};
xhr.onerror = (e) => {
- console.log(e)
+ // Have error when get comments.
+ loadError();
};
}
@@ -595,14 +599,15 @@ main = () => {
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式 你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并切换到完整 Disqus 模式。 评论基础模式出现错误,是否重载? 这里冷冷清清的,一条评论都没有
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式
你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并切换到完整 Disqus 模式。
评论基础模式出现错误,是否重载?
这里冷冷清清的,一条评论都没有