/*! * DisqusJS | v1.1.1 * Author: SukkaW * Link: https://github.com/SukkaW/DisqusJS * License: MIT */"use strict";function _typeof(s){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(s){return typeof s}:function(s){return s&&"function"==typeof Symbol&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s})(s)}!function(s,e){"function"==typeof define&&define.amd?define("DisqusJS",[],e):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e():s.DisqusJS=e()}("undefined"!=typeof self?self:void 0,function(){return function(s){var e=document,d=function(s){return e.getElementById(s)},c=function(s,e,n){var t=new XMLHttpRequest;t.open("GET",encodeURI(s),!0),t.onload=function(){if(200<=t.status&&t.status<300||304===t.status){var s=JSON.parse(t.responseText);e(s)}else u()},t.timeout=4500,t.ontimeout=function(s){n(s)},t.onerror=function(s){n(s)},t.send()},n=function(s,e){try{localStorage.setItem(s,e)}catch(s){}},r=function(s){s=Date.parse(new Date(s));var e=(s=new Date(s+288e5)).getFullYear(),n=s.getMonth()+1;n=n<10?"0".concat(n):n;var t=s.getDate();t=t<10?"0".concat(t):t;var o=s.getHours();o=o<10?"0".concat(o):o;var a=s.getMinutes();return a=a<10?"0".concat(a):a,"".concat(e,"-").concat(n,"-").concat(t," ").concat(o,":").concat(a)};function t(){var s=e.createElement("script");d("disqus_thread").innerHTML='
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用 评论基础模式
',d("dsqjs-force-dsqjs").addEventListener("click",i),s.src="https://".concat(q.config.shortname,".disqus.com/embed.js"),s.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(s)}function l(){d("disqus_thread").innerHTML='
正在检查 Disqus 能否访问...
';for(var s=["disqus.com","".concat(q.config.shortname,".disqus.com")],t=0,o=0,a=function(){s.length===t&&t===o?m():s.length===t&&i()},e=function(s){var e=new Image,n=setTimeout(function(){e.onerror=e.onload=null,t++,a()},3e3);e.onerror=function(){clearTimeout(n),t++,a()},e.onload=function(){clearTimeout(n),t++,o++,a()},e.src="https://".concat(s,"/favicon.ico?").concat(+new Date)},n=0;n切换到完整 Disqus 模式 进行初始化?',d("dsqjs-force-disqus").addEventListener("click",m)):u()},function(s){u()})}();var n=function e(s){var n=d("dsqjs-load-more"),t=function s(){n.removeEventListener("click",s),e(q.page.next)},o=function(){s?(n.classList.remove("dsqjs-disabled"),n.innerHTML="加载更多评论失败,点击重试",n.addEventListener("click",t)):u()};s=s?"&cursor=".concat(s):"",n.classList.add("dsqjs-disabled");var a="".concat(q.config.api,"3.0/posts/list.json?forum=").concat(q.config.shortname,"&thread=").concat(q.page.id).concat(s,"&include=approved&include=deleted&api_key=").concat(q.config.apikey);c(a,function(s){0===s.code&&0尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',d("dsqjs-header").classList.remove("dsqjs-hide"),d("dsqjs-post-container").innerHTML='
这里冷冷清清的,一条评论都没有
',d("dsqjs-reload-disqus").addEventListener("click",l),d("dsqjs-force-disqus").addEventListener("click",m)):o()},function(s){o()})},i=function(s){var e,o,a,n,i=function(s){return s.comment.author.profileUrl?(s.comment.avatarEl=''),s.comment.authorEl='")):(s.comment.avatarEl=''),s.comment.authorEl='")),q.config.adminLabel&&s.isPrimary&&(s.comment.authorEl+=''.concat(q.config.adminLabel,"")),s},c=function(s){var n,e,t,o="",a="";return a=s.isDeleted?"此评论已被删除":(o="".concat(s.authorEl,''),s.message),'
'.concat(s.avatarEl,'
').concat(o,'
').concat((n=a,e=new RegExp(/(.+?)<\/a>/gi),t=new RegExp(/href=\"(.+?)\"/gi),(n.match(e)||[]).map(function(s){var e=s.match(t)[0].replace(/href=\"https:\/\/disq.us\/url\?url=/g,"").replace(/(.*)"/,"$1");e=(e=decodeURIComponent(e)).replace(/(.*):(.*)cuid=(.*)/,"$1"),n=n.replace(s,'').concat(e,""))}),n=n.replace(/href=/g,'target="_blank" href=')),"
")},t="";e=[],o=[],a=function(s){return{comment:s,author:s.author.name,isPrimary:!!q.config.admin&&s.author.username===q.config.admin,children:n(+s.id)}},n=function(s){if(0===o.length)return null;for(var e=[],n=0;n').concat(c(s.comment)).concat(function e(s){var n=s.nesting,t=s.children||[];if(t){var o=n<4?'
    ':'
      ';return t.map(function(s){(s=i(s)).nesting=n+1,o+='
    • ').concat(c(s.comment)).concat(e(s),"
    • ")}),0!==(o+="
    ").length?o:void 0}}(s),"")}),d("dsqjs-header").classList.remove("dsqjs-hide"),d("dsqjs-msg").innerHTML='你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并 尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',d("dsqjs-post-container").innerHTML=t,d("dsqjs-reload-disqus").addEventListener("click",l),d("dsqjs-force-disqus").addEventListener("click",m)}}function u(){d("dsqjs-msg").innerHTML='评论基础模式加载失败,是否 重载尝试完整 Disqus 模式 ?',d("dsqjs-reload-dsqjs").addEventListener("click",o),d("dsqjs-reload-disqus").addEventListener("click",l)}function i(){n("dsqjs_mode","dsqjs"),o()}function m(){n("dsqjs_mode","disqus"),t()}var q=[];q.config=s,q.config.api=q.config.api||"https://disqus.skk.moe/disqus/",q.config.identifier=q.config.identifier||e.location.origin+e.location.pathname+e.location.search,q.config.url=q.config.url||e.location.origin+e.location.pathname+e.location.search,q.page=[],window.disqus_config=function(){this.page.url=q.config.url,this.page.identifier=q.config.identifier},q.mode=localStorage.getItem("dsqjs_mode"),"disqus"===q.mode?t():"dsqjs"===q.mode?o():l()}});