|
|
|
@ -402,14 +402,21 @@
|
|
|
|
|
xhr.send();
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
if (this.status == 200 || this.status == 304) {
|
|
|
|
|
var response = JSON.parse(this.responseText).response[0];
|
|
|
|
|
disqusjs.page = {
|
|
|
|
|
id: response.id,
|
|
|
|
|
title: response.title,
|
|
|
|
|
isClosed: response.isClosed,
|
|
|
|
|
length: response.posts
|
|
|
|
|
};
|
|
|
|
|
getComment();
|
|
|
|
|
let res = JSON.parse(this.responseText).response;
|
|
|
|
|
console.log(res.length)
|
|
|
|
|
if (res.length === 1) {
|
|
|
|
|
var response = res[0];
|
|
|
|
|
disqusjs.page = {
|
|
|
|
|
id: response.id,
|
|
|
|
|
title: response.title,
|
|
|
|
|
isClosed: response.isClosed,
|
|
|
|
|
length: response.posts
|
|
|
|
|
};
|
|
|
|
|
getComment();
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('dsqjs-thread-not-init').classList.remove('dsqjs-hide');
|
|
|
|
|
document.getElementById('dsqjs-init-thread').addEventListener('click', forceDisqus);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
xhr.ontimeout = (e) => {
|
|
|
|
@ -420,6 +427,16 @@
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Name: initThread()
|
|
|
|
|
* Description: init the thread when it is not
|
|
|
|
|
* API URI: /3.0/posts/list.json?forum=[shortname]&thread=[thread id]&api_key=[apikey]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* let initThread = () => {
|
|
|
|
|
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Name: getComment()
|
|
|
|
|
* Description: get the comment content
|
|
|
|
@ -609,7 +626,8 @@
|
|
|
|
|
<header></header>
|
|
|
|
|
<section class="dsqjs-info">
|
|
|
|
|
<p id="dsqjs-load-disqus" class="dsqjs-message dsqjs-hide">评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用<a href="#disqus_thread" id="dsqjs-force-dsqjs">评论基础模式</a></p>
|
|
|
|
|
<p id="dsqjs-loading-dsqjs" class="dsqjs-message dsqjs-hide">你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并<a href="#disqus_thread" id="dsqjs-reload-disqus">尝试使用完整 Disqus 模式</a> | <a href="#disqus_thread" id="dsqjs-force-disqus">强制完整 Disqus 模式</a>。</p>
|
|
|
|
|
<p id="dsqjs-loading-dsqjs" class="dsqjs-message dsqjs-hide">你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并<a href="#disqus_thread" id="dsqjs-reload-disqus">尝试完整 Disqus 模式</a> | <a href="#disqus_thread" id="dsqjs-force-disqus">强制完整 Disqus 模式</a>。</p>
|
|
|
|
|
<p id="dsqjs-thread-not-init" class="dsqjs-message dsqjs-hide">该 Thread 并没有初始化,是否 <a href="#disqus_thread" id="dsqjs-init-thread">切换到完整 Disqus 模式</a> 进行初始化?</p>
|
|
|
|
|
<p id="dsqjs-load-error" class="dsqjs-message dsqjs-hide">评论基础模式出现错误,是否<a href="#disqus_thread" id="dsqjs-reload">重载</a>?</p>
|
|
|
|
|
<p id="dsqjs-no-comment" class="dsqjs-no-comment dsqjs-hide">这里冷冷清清的,一条评论都没有</p>
|
|
|
|
|
</section>
|
|
|
|
@ -623,7 +641,7 @@
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
*/
|
|
|
|
|
var disqusjsBaseTpl = `<div id="dsqjs"><section class="dsqjs-action"></section><header></header><section class="dsqjs-info"><p id="dsqjs-load-disqus" class="dsqjs-message dsqjs-hide">评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用<a href="#disqus_thread" id="dsqjs-force-dsqjs">评论基础模式</a></p><p id="dsqjs-loading-dsqjs" class="dsqjs-message dsqjs-hide">你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并<a href="#disqus_thread" id="dsqjs-reload-disqus">尝试使用完整 Disqus 模式</a> | <a href="#disqus_thread" id="dsqjs-force-disqus">强制完整 Disqus 模式</a>。</p><p id="dsqjs-load-error" class="dsqjs-message dsqjs-hide">评论基础模式出现错误,是否<a href="#disqus_thread" id="dsqjs-reload">重载</a>?</p><p id="dsqjs-no-comment" class="dsqjs-no-comment dsqjs-hide">这里冷冷清清的,一条评论都没有</p></section><section class="dsqjs-container" id="dsqjs-container"><ul id="dsqjs-list" class="dsqjs-list"></ul><div class="dsqjs-footer"><div class="dsqjs-footer-right">Powered by <a href="https://disqus.com" rel="nofollow noopener noreferrer" target="_blank">DISQUS</a> & <a href="https://github.com/SukkaW/DisqusJS">DisqusJS</a></div></div></section></div>`;
|
|
|
|
|
var disqusjsBaseTpl = `<div id="dsqjs"><section class="dsqjs-action"></section><header></header><section class="dsqjs-info"><p id="dsqjs-load-disqus" class="dsqjs-message dsqjs-hide">评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用<a href="#disqus_thread" id="dsqjs-force-dsqjs">评论基础模式</a></p><p id="dsqjs-loading-dsqjs" class="dsqjs-message dsqjs-hide">你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并<a href="#disqus_thread" id="dsqjs-reload-disqus">尝试完整 Disqus 模式</a> | <a href="#disqus_thread" id="dsqjs-force-disqus">强制完整 Disqus 模式</a>。</p><p id="dsqjs-thread-not-init" class="dsqjs-message dsqjs-hide">该 Thread 并没有初始化,是否 <a href="#disqus_thread" id="dsqjs-init-thread">切换到完整 Disqus 模式</a> 进行初始化?</p><p id="dsqjs-load-error" class="dsqjs-message dsqjs-hide">评论基础模式出现错误,是否<a href="#disqus_thread" id="dsqjs-reload">重载</a>?</p><p id="dsqjs-no-comment" class="dsqjs-no-comment dsqjs-hide">这里冷冷清清的,一条评论都没有</p></section><section class="dsqjs-container" id="dsqjs-container"><ul id="dsqjs-list" class="dsqjs-list"></ul><div class="dsqjs-footer"><div class="dsqjs-footer-right">Powered by <a href="https://disqus.com" rel="nofollow noopener noreferrer" target="_blank">DISQUS</a> & <a href="https://github.com/SukkaW/DisqusJS">DisqusJS</a></div></div></section></div>`;
|
|
|
|
|
document.getElementById('disqus_thread').innerHTML = disqusjsBaseTpl;
|
|
|
|
|
|
|
|
|
|
disqusjs.mode = getLS('disqusjs_mode');
|
|
|
|
|