diff --git a/README.md b/README.md index dcb768f..8751e50 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,12 @@ ```html - - + + - - + + ``` 在需要显示评论的地方插入下述代码: diff --git a/dist/disqus.js b/dist/disqus.js index 8ce4cc5..9afcc0d 100644 --- a/dist/disqus.js +++ b/dist/disqus.js @@ -1,6 +1,6 @@ /*! - * DisqusJS | v0.2.4 + * DisqusJS | v0.2.5 * Author: SukkaW * Link: https://github.com/SukkaW/DisqusJS * License: GPL-3.0 - */"use strict";!function(){disqusjs.page=[],window.disqus_config=function(){this.page.url=disqusjs.config.url,this.page.identifier=disqusjs.config.identifier};var n=new XMLHttpRequest;function o(s,e){try{localStorage.setItem(s,e)}catch(s){console.log("Failed to set localStorage item")}}function e(){var e=new Image,t=setTimeout(function(){e.onerror=e.onload=null,o("disqusjs_mode","dsqjs"),r()},2e3);e.onerror=function(){clearTimeout(t),o("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(t);var s=setTimeout(function(){e.onerror=e.onload=null,o("disqusjs_mode","dsqjs"),r()},2e3);e.onerror=function(){clearTimeout(s),o("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(s),o("disqusjs_mode","disqus"),r()},e.src="https://".concat(disqusjs.config.shortname,".disqus.com/favicon.ico?").concat(+new Date)},e.src="https://disqus.com/favicon.ico?".concat(+new Date)}function t(){o("disqusjs_mode","dsqjs"),r()}function d(){o("disqusjs_mode","disqus"),r()}function i(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-load-error").classList.add("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",d),document.getElementById("dsqjs-reload-disqus").addEventListener("click",e);var s="".concat(disqusjs.config.api,"3.0/threads/list.json?forum=").concat(disqusjs.config.shortname,"&thread=ident:").concat(disqusjs.config.identifier,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",s,!0),n.timeout=4e3,n.send(),n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText).response;if(1===s.length){var e=s[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},function e(s){s=s?"&cursor=".concat(s):"";var t="".concat(disqusjs.config.api,"3.0/posts/list.json?forum=").concat(disqusjs.config.shortname,"&thread=").concat(disqusjs.page.id).concat(s,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",t,!0);n.timeout=4e3;n.send();n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText);0===s.code&&0'),s.comment.authorEl='').concat(s.comment.author.name,"")):(s.comment.avatarEl=''),s.comment.authorEl="".concat(s.comment.author.name)),s.isPrimary&&(s.comment.authorEl+=''.concat(disqusjs.config.adminLabel,"")),s.children&&(s.nesting=1),s}function i(s){var e=''.concat(s.avatarEl,'').concat(s.authorEl,'').concat(function(s){var e=s.getFullYear(),t=s.getMonth()+1;t=t<10?"0"+t:t;var n=s.getDate();n=n<10?"0"+n:n;var o=s.getHours()+8;o=o<10?"0"+o:o;var d=s.getMinutes();d=d<10?"0"+d:d;var i=s.getSeconds();return i=d<10?"0"+i:i,"".concat(e,"-").concat(t,"-").concat(n," ").concat(o,":").concat(d,":").concat(i)}(new Date(s.createdAt)),'').concat(s.message,"");return e}s.map(function(s){s=d(s);var e='').concat(i(s.comment)).concat(function e(s){var t=s.nesting,n=s.children||[];if(!n)return;var o=t<4?'':'';o+=n.map(function(s){return(s=d(s)).nesting=t+1,'').concat(i(s.comment)).concat(e(s),"")});o+="";return 0!==o.length?o:void 0}(s),"");document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",e)})}(e.map(function(s){return{comment:s,author:s.author.name,isPrimary:s.author.username===disqusjs.config.admin.toLowerCase(),children:function s(e){if(0===d.length)return null;var t=[];for(var n=0;n评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并尝试完整 Disqus 模式 | 强制完整 Disqus 模式。该 Thread 并没有初始化,是否 切换到完整 Disqus 模式 进行初始化?评论基础模式出现错误,是否重载?这里冷冷清清的,一条评论都没有加载更多评论',disqusjs.mode=(s="disqusjs_mode",localStorage.getItem(s)),"disqus"===disqusjs.mode?function(){var s=document;s.getElementById("dsqjs-load-disqus").classList.remove("dsqjs-hide"),s.getElementById("dsqjs-force-dsqjs").addEventListener("click",t);var e=s.createElement("script");e.src="https://"+disqusjs.config.shortname+".disqus.com/embed.js",e.setAttribute("data-timestamp",+new Date),(s.head||s.body).appendChild(e)}():"dsqjs"===disqusjs.mode?i():e()}n.ontimeout=function(s){c()},n.onerror=function(s){c()},r()}(); \ No newline at end of file + */"use strict";!function(){var n=new XMLHttpRequest;function d(s,e){try{localStorage.setItem(s,e)}catch(s){console.log("Failed to set localStorage item")}}function e(){var e=new Image,t=setTimeout(function(){e.onerror=e.onload=null,d("disqusjs_mode","dsqjs"),r()},2e3);e.onerror=function(){clearTimeout(t),d("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(t);var s=setTimeout(function(){e.onerror=e.onload=null,d("disqusjs_mode","dsqjs"),r()},2e3);e.onerror=function(){clearTimeout(s),d("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(s),d("disqusjs_mode","disqus"),r()},e.src="https://".concat(disqusjs.config.shortname,".disqus.com/favicon.ico?").concat(+new Date)},e.src="https://disqus.com/favicon.ico?".concat(+new Date)}function t(){d("disqusjs_mode","dsqjs"),r()}function o(){d("disqusjs_mode","disqus"),r()}function i(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-load-error").classList.add("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",o),document.getElementById("dsqjs-reload-disqus").addEventListener("click",e);var s="".concat(disqusjs.config.api,"3.0/threads/list.json?forum=").concat(disqusjs.config.shortname,"&thread=ident:").concat(disqusjs.config.identifier,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",s,!0),n.timeout=4e3,n.send(),n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText).response;if(1===s.length){var e=s[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},function e(s){s=s?"&cursor=".concat(s):"";var t="".concat(disqusjs.config.api,"3.0/posts/list.json?forum=").concat(disqusjs.config.shortname,"&thread=").concat(disqusjs.page.id).concat(s,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",t,!0);n.timeout=4e3;n.send();n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText);0===s.code&&0'),s.comment.authorEl='').concat(s.comment.author.name,"")):(s.comment.avatarEl=''),s.comment.authorEl="".concat(s.comment.author.name)),s.isPrimary&&(s.comment.authorEl+=''.concat(disqusjs.config.adminLabel,"")),s.children&&(s.nesting=1),s}function i(s){var e=''.concat(s.avatarEl,'').concat(s.authorEl,'').concat(function(s){var e=s.getFullYear(),t=s.getMonth()+1;t=t<10?"0"+t:t;var n=s.getDate();n=n<10?"0"+n:n;var d=s.getHours()+8;d=d<10?"0"+d:d;var o=s.getMinutes();o=o<10?"0"+o:o;var i=s.getSeconds();return i=o<10?"0"+i:i,"".concat(e,"-").concat(t,"-").concat(n," ").concat(d,":").concat(o,":").concat(i)}(new Date(s.createdAt)),'').concat(s.message,"");return e}s.map(function(s){s=o(s);var e='').concat(i(s.comment)).concat(function e(s){var t=s.nesting,n=s.children||[];if(!n)return;var d=t<4?'':'';d+=n.map(function(s){return(s=o(s)).nesting=t+1,'').concat(i(s.comment)).concat(e(s),"")});d+="";return 0!==d.length?d:void 0}(s),"");document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",e)})}(e.map(function(s){return{comment:s,author:s.author.name,isPrimary:s.author.username===disqusjs.config.admin.toLowerCase(),children:function s(e){if(0===o.length)return null;var t=[];for(var n=0;n评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并尝试完整 Disqus 模式 | 强制完整 Disqus 模式。该 Thread 并没有初始化,是否 切换到完整 Disqus 模式 进行初始化?评论基础模式出现错误,是否重载?这里冷冷清清的,一条评论都没有加载更多评论',disqusjs.mode=(s="disqusjs_mode",localStorage.getItem(s)),"disqus"===disqusjs.mode?function(){var s=document;s.getElementById("dsqjs-load-disqus").classList.remove("dsqjs-hide"),s.getElementById("dsqjs-force-dsqjs").addEventListener("click",t);var e=s.createElement("script");e.src="https://"+disqusjs.config.shortname+".disqus.com/embed.js",e.setAttribute("data-timestamp",+new Date),(s.head||s.body).appendChild(e)}():"dsqjs"===disqusjs.mode?i():e()}var s}n.ontimeout=function(s){c()},n.onerror=function(s){c()},r(),window.disqusjs=window.disqusjs||{},window.disqusjs.load=r}(); \ No newline at end of file diff --git a/dist/disqusjs.css b/dist/disqusjs.css index 3f1e2ad..299e231 100644 --- a/dist/disqusjs.css +++ b/dist/disqusjs.css @@ -1,5 +1,5 @@ /*! - * DisqusJS - Default Theme | v0.2.4 + * DisqusJS - Default Theme | v0.2.5 * Author: SukkaW * Link: https://github.com/SukkaW/DisqusJS * License: GPL-3.0 diff --git a/docs/index.html b/docs/index.html index 43a5234..6437090 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,7 +11,7 @@ - +
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式
你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并尝试完整 Disqus 模式 | 强制完整 Disqus 模式。
该 Thread 并没有初始化,是否 切换到完整 Disqus 模式 进行初始化?
评论基础模式出现错误,是否重载?
这里冷冷清清的,一条评论都没有