/*! * DisqusJS | v1.2.2 * 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 n=document,f=function(s){return n.getElementById(s)},o=function(s,e,t){var n=new XMLHttpRequest;n.open("GET",encodeURI(s),!0),n.onload=function(){if(200<=n.status&&n.status<300||304===n.status){var s=JSON.parse(n.responseText);e(s)}else a()},n.timeout=4500,n.ontimeout=function(s){t(s)},n.onerror=function(s){t(s)},n.send()},p=function(s,e){try{localStorage.setItem(s,e)}catch(s){}},d=function(s){var e=function(s){return s<10?"0".concat(s):s};s=Date.parse(new Date(s));var t=(s=new Date(s+288e5)).getFullYear(),n=e(s.getMonth()+1),o=e(s.getDate()),a=e(s.getHours()),r=e(s.getMinutes());return"".concat(t,"-").concat(n,"-").concat(o," ").concat(a,":").concat(r)};function e(){var s=n.createElement("script");f("disqus_thread").innerHTML='
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用 评论基础模式
',f("dsqjs-force-dsqjs").addEventListener("click",r),s.src="https://".concat(h.config.shortname,".disqus.com/embed.js"),s.setAttribute("data-timestamp",+new Date),(n.head||n.body).appendChild(s)}function j(){f("disqus_thread").innerHTML='
正在检查 Disqus 能否访问...
';for(var s=["disqus.com","".concat(h.config.shortname,".disqus.com")],n=0,o=0,a=function(){s.length===n&&n===o?g():s.length===n&&r()},e=function(s){var e=new Image,t=setTimeout(function(){e.onerror=e.onload=null,n++,a()},3e3);e.onerror=function(){clearTimeout(t),n++,a()},e.onload=function(){clearTimeout(t),n++,o++,a()},e.src="https://".concat(s,"/favicon.ico?").concat(+new Date)},t=0;t切换到完整 Disqus 模式 进行初始化?',f("dsqjs-force-disqus").addEventListener("click",g)):a()},function(s){a()})}();var t=function i(s){var d=f("dsqjs-load-more"),c=n.getElementsByClassName("dsqjs-order-radio"),l=function s(){var e=!0,t=!1,n=void 0;try{for(var o,a=c[Symbol.iterator]();!(e=(o=a.next()).done);e=!0)o.value.removeEventListener("change",u)}catch(s){t=!0,n=s}finally{try{e||null==a.return||a.return()}finally{if(t)throw n}}d.removeEventListener("click",s),i(h.page.next)},r=function(){s?(d.classList.remove("dsqjs-disabled"),d.innerHTML="加载更多评论失败,点击重试",d.addEventListener("click",l)):a()},u=function s(e){h.sortType=e.target.getAttribute("value"),p("disqus.sort",h.sortType);var t=!0,n=!1,o=void 0;try{for(var a,r=c[Symbol.iterator]();!(t=(a=r.next()).done);t=!0)a.value.removeEventListener("change",s)}catch(s){n=!0,o=s}finally{try{t||null==r.return||r.return()}finally{if(n)throw o}}d.removeEventListener("click",l),h.page.comment=[],h.page.next="",f("dsqjs-post-container").innerHTML='

正在切换排序方式...

',d.classList.add("dsqjs-hide"),i()};s=s?"&cursor=".concat(s):"",d.classList.add("dsqjs-disabled");var m={parseDate:function(s){return Date.parse(new Date(s.createdAt))},parentAsc:function(s,e){return s.parent&&e.parent?m.parseDate(s)-m.parseDate(e):0}},e="".concat(h.config.api,"3.0/threads/listPostsThreaded?forum=").concat(h.config.shortname,"&thread=").concat(h.page.id).concat(s,"&api_key=").concat(v(),"&order=").concat(h.sortType);o(e,function(s){if(0===s.code&&0尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',f("dsqjs-header").classList.remove("dsqjs-hide"),f("dsqjs-post-container").innerHTML='
这里冷冷清清的,一条评论都没有
',f("dsqjs-reload-disqus").addEventListener("click",j),f("dsqjs-force-disqus").addEventListener("click",g)):r()},function(s){r()})},q=function(s){var e,o,a,t,r=function(s){return s.comment.author.profileUrl?(s.comment.avatarEl=''),s.comment.authorEl='")):(s.comment.avatarEl=''),s.comment.authorEl='")),h.config.adminLabel&&s.isPrimary&&(s.comment.authorEl+=''.concat(h.config.adminLabel,"")),s},i=function(s){var t,e,n,o="",a="";return a=s.isDeleted?"此评论已被删除":(o="".concat(s.authorEl,''),s.message),'
'.concat(s.avatarEl,'
').concat(o,'
').concat((t=a,e=new RegExp(/(.+?)<\/a>/gi),n=new RegExp(/href=\"(.+?)\"/gi),(t.match(e)||[]).map(function(s){var e=s.match(n)[0].replace(/href=\"https:\/\/disq.us\/url\?url=/g,"").replace(/(.*)"/,"$1");e=(e=decodeURIComponent(e)).replace(/(.*):(.*)cuid=(.*)/,"$1"),t=t.replace(s,'').concat(e,""))}),t=t.replace(/href=/g,'target="_blank" href=')),"
")},n="";e=[],o=[],a=function(s){return{comment:s,author:s.author.name,isPrimary:!!h.config.admin&&s.author.username===h.config.admin,children:t(+s.id)}},t=function(s){if(0===o.length)return null;for(var e=[],t=0;t').concat(i(s.comment)).concat(function e(s){var t=s.nesting,n=s.children||[];if(n){var o=t<4?'
    ':'
      ';return n.map(function(s){(s=r(s)).nesting=t+1,o+='
    • ').concat(i(s.comment)).concat(e(s),"
    • ")}),0!==(o+="
    ").length?o:void 0}}(s),"")}),f("dsqjs-header").classList.remove("dsqjs-hide"),f("dsqjs-msg").innerHTML='你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并 尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',f("dsqjs-post-container").innerHTML=n,f("dsqjs-reload-disqus").addEventListener("click",j),f("dsqjs-force-disqus").addEventListener("click",g)}}function a(){f("dsqjs-msg").innerHTML='评论基础模式加载失败,是否 重载尝试完整 Disqus 模式 ?',f("dsqjs-reload-dsqjs").addEventListener("click",t),f("dsqjs-reload-disqus").addEventListener("click",j)}function r(){p("dsqjs_mode","dsqjs"),t()}function g(){p("dsqjs_mode","disqus"),e()}Array.isArray||(Array.isArray=function(s){return"[object Array]"===Object.prototype.toString.call(s)});var h=[];h.config=s,h.config.api=h.config.api||"https://disqus.skk.moe/disqus/",h.config.identifier=h.config.identifier||n.location.origin+n.location.pathname+n.location.search,h.config.url=h.config.url||n.location.origin+n.location.pathname+n.location.search,h.page=[];var v=function(){return Array.isArray(h.config.apikey)?h.config.apikey[Math.floor(Math.random()*h.config.apikey.length)]:h.config.apikey};window.disqus_config=function(){this.page.url=h.config.url,this.page.identifier=h.config.identifier},h.mode=localStorage.getItem("dsqjs_mode"),h.sortType=localStorage.getItem("disqus.sort"),h.sortType||(p("disqus.sort","desc"),h.sortType="desc"),"disqus"===h.mode?e():"dsqjs"===h.mode?t():j()}});