/*! * DisqusJS | v1.2.5 * 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 l=document,y=function(s){return l.getElementById(s)},n=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 o()},n.timeout=4500,n.ontimeout=function(s){t(s)},n.onerror=function(s){t(s)},n.send()},b=function(s,e){try{localStorage.setItem(s,e)}catch(s){}},c=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(){if(window.DISQUS)window.DISQUS.reset({reload:!0,config:function(){this.page.identifier=D.config.identifier,this.page.url=D.config.url,this.page.title=D.config.title}});else{var s=l.createElement("script");y("disqus_thread").innerHTML='
评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用 评论基础模式
',y("dsqjs-force-dsqjs").addEventListener("click",r),s.src="https://".concat(D.config.shortname,".disqus.com/embed.js"),s.setAttribute("data-timestamp",+new Date),(l.head||l.body).appendChild(s)}}function L(){y("disqus_thread").innerHTML='
正在检查 Disqus 能否访问...
';for(var s=["disqus.com","".concat(D.config.shortname,".disqus.com")],n=0,o=0,a=function(){s.length===n&&n===o?k():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 模式 进行初始化?',y("dsqjs-force-disqus").addEventListener("click",k)):o()},function(s){o()})}();var t=function m(s){var f=y("dsqjs-load-more"),q=l.getElementsByClassName("dsqjs-order-radio"),p=l.getElementsByClassName("dsqjs-has-more-btn"),g=function s(){var e=!0,t=!1,n=void 0;try{for(var o,a=q[Symbol.iterator]();!(e=(o=a.next()).done);e=!0)o.value.removeEventListener("change",h)}catch(s){t=!0,n=s}finally{try{e||null==a.return||a.return()}finally{if(t)throw n}}f.removeEventListener("click",s);var r=!0,i=!1,c=void 0;try{for(var d,l=p[Symbol.iterator]();!(r=(d=l.next()).done);r=!0)d.value.removeEventListener("click",L)}catch(s){i=!0,c=s}finally{try{r||null==l.return||l.return()}finally{if(i)throw c}}m(D.page.next)},u=function(){s?(f.classList.remove("dsqjs-disabled"),f.innerHTML="加载更多评论失败,点击重试",f.addEventListener("click",g)):o()},h=function s(e){D.sortType=e.target.getAttribute("value"),b("disqus.sort",D.sortType);var t=!0,n=!1,o=void 0;try{for(var a,r=q[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}}f.removeEventListener("click",g);var i=!0,c=!1,d=void 0;try{for(var l,u=p[Symbol.iterator]();!(i=(l=u.next()).done);i=!0)l.value.removeEventListener("click",L)}catch(s){c=!0,d=s}finally{try{i||null==u.return||u.return()}finally{if(c)throw d}}D.page.comment=[],D.page.next="",y("dsqjs-post-container").innerHTML='

正在切换排序方式...

',f.classList.add("dsqjs-hide"),m()};s=s?"&cursor=".concat(s):"",f.classList.add("dsqjs-disabled");var v={parseDate:function(s){return Date.parse(new Date(s.createdAt))},parentAsc:function(s,e){return s.parent&&e.parent?v.parseDate(s)-v.parseDate(e):0}},e="".concat(D.config.api,"3.0/threads/listPostsThreaded?forum=").concat(D.config.shortname,"&thread=").concat(D.page.id).concat(s,"&api_key=").concat(a(),"&order=").concat(D.sortType);n(e,function(s){if(0===s.code&&0尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',y("dsqjs-header").classList.remove("dsqjs-hide"),y("dsqjs-post-container").innerHTML='
这里冷冷清清的,一条评论都没有
',y("dsqjs-reload-disqus").addEventListener("click",L),y("dsqjs-force-disqus").addEventListener("click",k)):u()},function(s){u()})},j=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='")),D.config.adminLabel&&s.isPrimary&&(s.comment.authorEl+=''.concat(D.config.adminLabel,"")),s},i=function(s){var e="",t="";return t=s.isDeleted?"此评论已被删除":(e="".concat(s.authorEl,''),s.message),'
'.concat(s.avatarEl,'
').concat(e,'
').concat(function(s){var e=l.createElement("div");e.innerHTML=s;var t=e.getElementsByTagName("a"),n=!0,o=!1,a=void 0;try{for(var r,i=t[Symbol.iterator]();!(n=(r=i.next()).done);n=!0){var c=r.value,d=c.href;d=decodeURIComponent(d.replace(/https:\/\/disq.us\/url\?url=/g,"").replace(/(.*)"/,"$1")).replace(/(.*):(.*)cuid=(.*)/,"$1"),c.href=d,c.innerHTML=d,c.rel="nofollow noopener noreferrer",c.target="_blank"}}catch(s){o=!0,a=s}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return e.innerHTML}(t),"
")},n="";e=[],o=[],a=function(s){return{comment:s,author:s.author.name,isPrimary:!!D.config.admin&&s.author.username===D.config.admin,children:t(+s.id),hasMore:s.hasMore}},t=function(s){if(0===o.length)return null;for(var e=[],t=0;t切换到 完整 Disqus 模式 显示更多回复

')),n+='
  • ').concat(i(s.comment)).concat(function t(s){var n=s.nesting,e=s.children||[];if(e){var o=n':'
      ';return e.map(function(s){(s=r(s)).nesting=n+1;var e="";s.hasMore&&(e='

      切换到 完整 Disqus 模式 显示更多回复

      ')),o+='
    • ').concat(i(s.comment)).concat(t(s)).concat(e,"
    • ")}),0!==(o+="
    ").length?o:void 0}}(s)).concat(e,"
  • ")}),y("dsqjs-header").classList.remove("dsqjs-hide"),y("dsqjs-msg").innerHTML='你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并 尝试完整 Disqus 模式 | 强制完整 Disqus 模式。',y("dsqjs-post-container").innerHTML=n,y("dsqjs-reload-disqus").addEventListener("click",L),y("dsqjs-force-disqus").addEventListener("click",k)}}function o(){y("dsqjs-msg").innerHTML='评论基础模式加载失败,是否 重载尝试完整 Disqus 模式 ?',y("dsqjs-reload-dsqjs").addEventListener("click",t),y("dsqjs-reload-disqus").addEventListener("click",L)}function r(){b("dsqjs_mode","dsqjs"),t()}function k(){b("dsqjs_mode","disqus"),e()}Array.isArray||(Array.isArray=function(s){return"[object Array]"===Object.prototype.toString.call(s)});var D={};D.config=s,D.config.api=D.config.api||"https://disqus.skk.moe/disqus/",D.config.identifier=D.config.identifier||l.location.origin+l.location.pathname+l.location.search,D.config.url=D.config.url||l.location.origin+l.location.pathname+l.location.search,D.config.title=D.config.title||l.title,D.config.nesting=D.config.nesting?parseInt(D.config.nesting):4,D.page=[];var a=function(){return Array.isArray(D.config.apikey)?D.config.apikey[Math.floor(Math.random()*D.config.apikey.length)]:D.config.apikey};window.disqus_config=function(){this.page.url=D.config.url,this.page.identifier=D.config.identifier,this.page.title=D.config.title},D.mode=localStorage.getItem("dsqjs_mode"),D.sortType=localStorage.getItem("disqus.sort"),D.sortType||(b("disqus.sort","desc"),D.sortType="desc"),"disqus"===D.mode?e():"dsqjs"===D.mode?t():L()}});