quadrille-elsa.fr/themes/zhaohuabing/static/js/iDisqus.min.js
Adrian Amaglio c5b2a334f7 init
2023-09-18 21:27:59 +02:00

12 lines
54 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.iDisqus=t():e.iDisqus=t()}(window,(function(){return function(e){var t={};function o(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=t,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(a,n,function(t){return e[t]}.bind(null,n));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){(function(e){var a;
/*!
*
* @author fooleap
* @email fooleap@gmail.com
* @create 2017-06-17 20:48:25
* @update 2021-05-11 11:58:38
* @version 0.2.31
* Copyright 2017-2021 fooleap
* Released under the MIT license
*/o(2),function(n){"use strict";var i,r=document,s=localStorage,m=r.scripts,c=m[m.length-1].src,l=(c.substring(0,c.lastIndexOf("/")),navigator.userAgent.indexOf("Edge")>-1),d=!!window.ActiveXObject||"ActiveXObject"in window;function u(e,t,o){var a=new XMLHttpRequest;return a.open("GET",encodeURI(e)),a.onreadystatechange=function(){4==a.readyState&&200==a.status&&t(a.responseText)},a.onerror=o,a.withCredentials=!0,a.send(),a}function p(e,t,o,a){var n="string"==typeof t?t:Object.keys(t).filter((function(e){return null!=t[e]})).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&"),i=new XMLHttpRequest;return i.open("POST",e),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&o(i.responseText)},i.onerror=a,i.withCredentials=!0,i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.send(n),i}function f(){var e=Number((new Date).getTime().toString().substring(3)),t=Math.abs(e+Math.floor(1e5*Math.random())-48e6+Math.floor(1e6*Math.random())).toString(32);return t+=Math.floor(1e9*Math.random()).toString(32)}"function"!=typeof(i=window.Element.prototype).matches&&(i.matches=i.msMatchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),o=0;t[o]&&t[o]!==this;)++o;return Boolean(t[o])}),"function"!=typeof i.closest&&(i.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null}),i.on=function(e,t,o){this.addEventListener(e,(function(e){for(var a=e.target;a&&a!=this;a=a.parentNode)if(a.matches(t)){o.call(null,e,a);break}}),!0)};var v=function(){this.dom=arguments[0],this.opts=arguments[1],this.init(),this.autologin()};v.prototype={init:function(){var e=this;e.name=s.getItem("name"),e.email=s.getItem("email"),e.url=s.getItem("url"),e.avatar=s.getItem("avatar"),e.type=s.getItem("type"),e.logged_in=s.getItem("logged_in"),e.unique=s.getItem("disqus_unique"),s.getItem("vote")||s.setItem("vote",JSON.stringify({})),s.getItem("reaction_vote")||s.setItem("reaction_vote",JSON.stringify({})),e.vote=JSON.parse(s.getItem("vote")),e.reactionVote=JSON.parse(s.getItem("reaction_vote"));var t=e.dom.getElementsByClassName("comment-box");if("true"==e.logged_in?[].forEach.call(t,(function(t){"1"==e.type&&t.querySelector(".comment-form-wrapper").classList.add("logged-in"),t.querySelector(".comment-form-name").value=e.name,t.querySelector(".comment-form-email").value=e.email,t.querySelector(".comment-form-url").value=e.url,t.querySelector(".comment-avatar-image").src=e.avatar})):([].forEach.call(t,(function(t){t.querySelector(".comment-form-wrapper").classList.remove("logged-in"),t.querySelector(".comment-form-name").value="",t.querySelector(".comment-form-email").value="",t.querySelector(".comment-form-url").value="",t.querySelector(".comment-avatar-image").src=e.dom.querySelector(".comment-avatar-image").dataset.avatar})),s.setItem("logged_in","false")),"1"==e.type&&"true"==e.logged_in){var o=e.dom.querySelector(".comment-login");o&&(o.innerHTML=e.name+'<label class="comment-logout" title="退出" for="comment-user">退出登录</label>',o.title=e.name,o.classList.add("comment-user"),o.classList.remove("comment-login"),e.dom.querySelector("#comment-user").checked=!1)}else{var a=e.dom.querySelector(".comment-user");a&&(a.innerHTML="登录",a.title="使用 Disqus 帐号授权登录",a.classList.add("comment-login"),a.classList.remove("comment-user"))}},autologin:function(){var e=this;u(e.opts.api+"/user.php",(function(t){var o=JSON.parse(t);if(0==o.code){var a=o.response;e.avatar=a.avatar,e.name=a.name,e.username=a.username,e.url=a.url,e.type=a.type,e.submit()}else"1"==e.type?(s.setItem("logged_in","false"),e.init()):(s.setItem("type","0"),e.unique||s.setItem("disqus_unique",f()),e.init())}),(function(){}))},login:function(){var e,t=this,o=window.open(t.opts.api+"/login.php","Disqus Oauth","width=470,height=508");e=setInterval((function(){o&&o.closed&&(clearInterval(e),t.user.autologin())}),100)},logout:function(){var e=this;p(e.opts.api+"/logout.php",{},(function(t){s.setItem("logged_in","false"),s.removeItem("type"),s.removeItem("email"),s.removeItem("avatar"),s.removeItem("name"),s.removeItem("url"),s.removeItem("disqus_unique"),s.removeItem("vote"),s.removeItem("reaction_vote"),e.user.init()}))},submit:function(){var e=this;s.setItem("email",e.email),s.setItem("type",e.type),s.setItem("name",e.name),s.setItem("url",e.url),s.setItem("avatar",e.avatar),s.setItem("disqus_unique",e.unique),s.setItem("logged_in","true"),this.init()}};var h=function(){var e=this;if(e.opts="object"==typeof arguments[1]?arguments[1]:arguments[0],e.dom=r.getElementById("string"==typeof arguments[0]?arguments[0]:"comment"),e.opts.api="/"==e.opts.api.slice(-1)?e.opts.api.slice(0,-1):e.opts.api,e.opts.site=e.opts.site||location.origin,e.opts.url){var t=e.opts.url.replace(e.opts.site,"");e.opts.url="/"!=t.slice(0,1)?"/"+t:t}else e.opts.url=l||d?encodeURI(location.pathname)+encodeURI(location.search):location.pathname+location.search;e.opts.identifier=e.opts.identifier||e.opts.url,e.opts.link=e.opts.site+e.opts.url,e.opts.title=e.opts.title||r.title,e.opts.slug=e.opts.slug?e.opts.slug.replace(/[^A-Za-z0-9_-]+/g,""):"",e.opts.desc=e.opts.desc||(r.querySelector('[name="description"]')?r.querySelector('[name="description"]').content:""),e.opts.mode=e.opts.mode||1,e.opts.timeout=e.opts.timeout||3e3,e.opts.toggle=e.opts.toggle?r.getElementById(e.opts.toggle):null,e.opts.autoCreate=!!e.opts.autoCreate||!!e.opts.auto,e.opts.relatedType=e.opts.relatedType||"related",e.opts.emojiPath=e.opts.emojiPath||e.opts.emoji_path||"https://github.githubassets.com/images/icons/emoji/unicode/",e.emojiList=e.opts.emojiList||e.opts.emoji_list||[{code:"smile",title:"笑脸",unicode:"1f604"},{code:"mask",title:"生病",unicode:"1f637"},{code:"joy",title:"破涕为笑",unicode:"1f602"},{code:"stuck_out_tongue_closed_eyes",title:"吐舌",unicode:"1f61d"},{code:"flushed",title:"脸红",unicode:"1f633"},{code:"scream",title:"恐惧",unicode:"1f631"},{code:"pensive",title:"失望",unicode:"1f614"},{code:"unamused",title:"无语",unicode:"1f612"},{code:"grin",title:"露齿笑",unicode:"1f601"},{code:"heart_eyes",title:"色",unicode:"1f60d"},{code:"sweat",title:"汗",unicode:"1f613"},{code:"smirk",title:"得意",unicode:"1f60f"},{code:"relieved",title:"满意",unicode:"1f60c"},{code:"rolling_eyes",title:"翻白眼",unicode:"1f644"},{code:"ok_hand",title:"OK",unicode:"1f44c"},{code:"v",title:"胜利",unicode:"270c"}],(e.opts.emoji_preview||e.opts.emojiPreview)&&u(e.opts.api+"/eac.php",(function(t){e.eac=JSON.parse(t)}),(function(){})),e.stat={current:"idisqus",loaded:!1,loading:!1,editing:!1,offsetTop:0,next:null,message:null,mediaHtml:null,forum:{},thread:{},post:{},media:{},root:[],order:"desc",users:[],imageSize:[],disqusLoaded:!1},window.disqus_config=function(){this.page.identifier=e.opts.identifier,this.page.title=e.opts.title,this.page.url=e.opts.link,this.callbacks.onReady.push((function(){e.stat.current="disqus",e.stat.disqusLoaded=!0,e.dom.querySelector("#idisqus").style.display="none",e.dom.querySelector("#disqus_thread").style.display="block",3==e.opts.mode&&e.opts.toggle&&(e.opts.toggle.disabled="",e.opts.toggle.checked=!0,e.opts.toggle.addEventListener("change",e.handle.toggle,!1))})),this.callbacks.onNewComment=[function(t,o){var a={id:t.id};setTimeout((function(){p(e.opts.api+"/sendemail.php",a,(function(e){console.info("邮件发送成功!")}))}),2e3)}]},e.opts.init&&e.init()};h.prototype.timeAgo=function(){var e=this,t={prefix:"",suffix:"前",seconds:"几秒",minute:"1分钟",minutes:"%d分钟",hour:"1小时",hours:"%d小时",day:"1天",days:"%d天",week:"1周",weeks:"%d周",month:"1个月",months:"%d个月",year:"1年",years:"%d年"},o=function(e,o){return t[e]&&t[e].replace(/%d/i,Math.abs(Math.round(o)))},a=function(e){if(e){e=(e=(e=(e=e.replace(/\.\d+/,"")).replace(/-/,"/").replace(/-/,"/")).replace(/T/," ").replace(/Z/," UTC")).replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),e=new Date(1e3*e||e);var a=.001*((new Date).getTime()-e)>>0,n=a/60,i=n/60,r=i/24,s=r/30,m=r/365;return t.prefix+(a<45&&o("seconds",a)||a<90&&o("minute",1)||n<45&&o("minutes",n)||n<90&&o("hour",1)||i<24&&o("hours",i)||i<42&&o("day",1)||r<30&&o("days",r)||r<45&&o("month",1)||r<365&&o("months",s)||m<1.5&&o("year",1)||o("years",m))+t.suffix}},n=e.dom.querySelectorAll("time[datetime]");for(var i in n){var r=n[i];"object"==typeof r&&(r.title=new Date(r.getAttribute("datetime")),r.innerHTML=a(r.getAttribute("datetime")))}setTimeout(e.timeAgo.bind(e),6e4)},h.prototype.init=function(){var e=this;if(e.dom){var t="";e.emojiList.forEach((function(o){t+='<li class="emojione-item" title="'+o.title+'" data-code=":'+o.code+':"><img class="emojione-item-image" src="'+e.opts.emojiPath+o.unicode+'.png" /></li>'})),e.dom.innerHTML=`<div class="comment init" id="idisqus">\n <div class="comment-reaction">\n <div class="comment-reaction-header">\n <div class="comment-reaction-prompt"></div>\n <div class="comment-reaction-total"></div>\n </div>\n <div class="comment-reaction-list"></div>\n </div>\n <div class="init-container" data-tips="正在初始化……"><svg class="init-bg" width="72" height="72" viewBox="0 0 720 720" version="1.1" xmlns="http://www.w3.org/2000/svg"><path class="ring" fill="none" stroke="#9d9ea1" d="M 0 -260 A 260 260 0 1 1 -80 -260" transform="translate(400,400)" stroke-width="50" /><polygon transform="translate(305,20)" points="50,0 0,100 18,145 50,82 92,145 100,100" style="fill:#9d9ea1"/></svg></div>\n <div class="comment-header">\n <div class="comment-header-primary">\n <span class="comment-header-item" id="comment-count">评论</span>\n <a class="comment-header-item" id="comment-link" target="_blank">在线讨论</a>\n </div>\n <div class="comment-header-menu">\n <input class="comment-header-checkbox" type="checkbox" id="comment-user">\n <label class="comment-header-item comment-login" title="使用 Disqus 帐号授权登录" for="comment-user">登录</label>\n </div>\n </div>\n <div class="comment-navbar">\n <div class="comment-navbar-item">\n <a class="comment-recommend" href="javascript:;"><svg t="1537508059126" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3234" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M489.993 887.107 177.906 586.021c-4.002-3.501-114.033-104.031-114.033-224.063 0-146.54 89.526-234.065 239.069-234.065 87.523 0 169.546 69.019 209.058 108.03 39.512-39.011 121.535-108.03 209.059-108.03 149.542 0 239.068 87.525 239.068 234.065 0 120.033-110.031 220.563-114.533 225.065L534.007 887.107c-6 6-14.003 9-22.007 9C503.997 896.107 495.993 893.107 489.993 887.107z" p-id="3235"></path></svg><span class="comment-recommend-text">推荐</span><span class="comment-recommend-count"></span></a>\n </div>\n <div class="comment-navbar-item comment-order">\n <input class="comment-order-radio" id="order-popular" type="radio" name="comment-order" value="popular" />\n <label class="comment-order-label" for="order-popular" title="按评分高低排序">最佳</label>\n <input class="comment-order-radio" id="order-desc" type="radio" name="comment-order" value="desc" />\n <label class="comment-order-label" for="order-desc" title="按从新到旧排序">最新</label>\n <input class="comment-order-radio" id="order-asc" type="radio" name="comment-order" value="asc" />\n <label class="comment-order-label" for="order-asc" title="按从旧到新排序">最早</label>\n </div>\n </div>\n <div class="comment-box">\n <div class="comment-avatar avatar"><img class="comment-avatar-image" src="//a.disquscdn.com/images/noavatar92.png" data-avatar="//a.disquscdn.com/images/noavatar92.png"></div>\n <div class="comment-form">\n <div class="comment-form-wrapper">\n <textarea class="comment-form-textarea" placeholder="加入讨论……"></textarea>\n <div class="comment-form-alert"></div>\n <div class="comment-image">\n <ul class="comment-image-list"></ul>\n <div class="comment-image-progress"><div class="comment-image-loaded"></div></div>\n </div>\n \n <div class="comment-actions">\n \n <div class="comment-actions-group">\n <input id="emoji-input" class="comment-actions-input" type="checkbox">\n <label class="comment-actions-label emojione" for="emoji-input">\n <svg class="icon" fill="#c2c6cc" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">\n <g>\n <title>选择表情</title>\n <path d="M512 1024c-282.713043 0-512-229.286957-512-512s229.286957-512 512-512c282.713043 0 512 229.286957 512 512S792.486957 1024 512 1024zM512 44.521739c-258.226087 0-467.478261 209.252174-467.478261 467.478261 0 258.226087 209.252174 467.478261 467.478261 467.478261s467.478261-209.252174 467.478261-467.478261C979.478261 253.773913 768 44.521739 512 44.521739z"></path>\n <path d="M801.391304 554.295652c0 160.278261-129.113043 289.391304-289.391304 289.391304s-289.391304-129.113043-289.391304-289.391304L801.391304 554.295652z"></path>\n <path d="M674.504348 349.495652m-57.878261 0a2.6 2.6 0 1 0 115.756522 0 2.6 2.6 0 1 0-115.756522 0Z"></path>\n <path d="M347.269565 349.495652m-57.878261 0a2.6 2.6 0 1 0 115.756522 0 2.6 2.6 0 1 0-115.756522 0Z"></path>\n </g>\n </svg>\n <ul class="emojione-list">${t}</ul>\n </label>\n <input id="upload-input" class="comment-actions-input comment-image-input" type="file" accept="image/*" name="file">\n <label class="comment-actions-label" for="upload-input">\n <svg class="icon" fill="#c2c6cc" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">\n <g>\n <title>上传图片</title>\n <path d="M15.515152 15.515152 15.515152 15.515152 15.515152 15.515152Z"></path>\n <path d="M15.515152 139.636364l0 806.787879 992.969697 0 0-806.787879-992.969697 0zM946.424242 884.363636l-868.848485 0 0-682.666667 868.848485 0 0 682.666667zM698.181818 356.848485c0-51.417212 41.673697-93.090909 93.090909-93.090909s93.090909 41.673697 93.090909 93.090909c0 51.417212-41.673697 93.090909-93.090909 93.090909s-93.090909-41.673697-93.090909-93.090909zM884.363636 822.30303l-744.727273 0 186.181818-496.484848 248.242424 310.30303 124.121212-93.090909z"></path>\n </g>\n </svg>\n </label>\n </div>\n \n <div class="comment-actions-form">\n <button class="comment-form-submit">\n <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">\n <path d="M565.747623 792.837176l260.819261 112.921839 126.910435-845.424882L66.087673 581.973678l232.843092 109.933785 562.612725-511.653099-451.697589 563.616588-5.996574 239.832274L565.747623 792.837176z" fill="#ffffff"></path>\n </svg>\n </button>\n </div>\n </div>\n\n </div>\n <div class="comment-form-user">\n <form class="comment-form-guest"><input class="comment-form-input comment-form-name" type="text" name="name" placeholder="名字(必填)" autocomplete="name" /><input class="comment-form-input comment-form-email" type="email" name="email" placeholder="邮箱(必填)" autocomplete="email" /><input class="comment-form-input comment-form-url" type="url" name="url" placeholder="网址(可选)" autocomplete="url" /></form>\n </div>\n </div>\n </div>\n <ul id="comments" class="comment-list" data-tips="评论加载中……"></ul>\n <a href="javascript:;" class="comment-loadmore hide">加载更多</a>\n <div class="comment-related"></div>\n </div>\n <div class="comment" id="disqus_thread"></div>`,e.user=new v(e.dom,e.opts),e.handle={logout:e.user.logout.bind(e),login:e.user.login.bind(e),loadMore:e.loadMore.bind(e),loadMoreReply:e.loadMoreReply.bind(e),post:e.post.bind(e),threadCreate:e.threadCreate.bind(e),threadVote:e.threadVote.bind(e),reactionVote:e.reactionVote.bind(e),remove:e.remove.bind(e),show:e.show.bind(e),toggle:e.toggle.bind(e),upload:e.upload.bind(e),verify:e.verify.bind(e),jump:e.jump.bind(e),mention:e.mention.bind(e),keySelect:e.keySelect.bind(e),field:e.field.bind(e),focus:e.focus,input:e.input.bind(e),parentShow:e.parentShow.bind(e),selectOrder:e.selectOrder.bind(e)};var o=e.dom.querySelector("#idisqus");switch(o.on("blur",".comment-form-textarea",e.handle.focus),o.on("focus",".comment-form-textarea",e.handle.focus),o.on("input",".comment-form-textarea",e.handle.input),o.on("propertychange",".comment-form-textarea",e.handle.input),o.on("keyup",".comment-form-textarea",e.handle.mention),o.on("keydown",".comment-form-textarea",e.handle.keySelect),o.on("blur",".comment-form-name",e.handle.verify),o.on("blur",".comment-form-email",e.handle.verify),o.on("click",".comment-form-submit",e.handle.post),o.on("click",".comment-login",e.handle.login),o.on("change",".comment-image-input",e.handle.upload),o.on("click",".emojione-item",e.handle.field),o.on("click",".comment-logout",e.handle.logout),o.on("click",".comment-item-reply",e.handle.show),o.on("click",".comment-item-cancel",e.handle.show),o.on("click",".comment-item-avatar",e.handle.jump),o.on("click",".comment-item-pname",e.handle.jump),o.on("mouseover",".comment-item-pname",e.handle.parentShow),o.on("click",".comment-loadmore",e.handle.loadMore),o.on("click",".comment-item-loadmore",e.handle.loadMoreReply),o.on("click","#thread-submit",e.handle.threadCreate),o.on("click",".comment-recommend",e.handle.threadVote),o.on("click",".comment-reaction-btn:not(.selected)",e.handle.reactionVote),o.on("change",".comment-order-radio",e.handle.selectOrder),e.opts.mode){case 1:e.disqus();break;case 2:e.threadInit();break;case 3:e.threadInit(),e.disqus();break;default:e.disqus()}}},h.prototype.toggle=function(){var e=this;"disqus"==e.stat.current?(e.stat.current="idisqus",e.dom.querySelector("#idisqus").style.display="block",e.dom.querySelector("#disqus_thread").style.display="none"):e.disqus()},h.prototype.disqus=function(){var e=this;e.dom.querySelector(".init-container").dataset.tips;if(e.opts.site!=location.origin)return console.log("本地环境不加载 Disqus 评论框!"),void(1==e.opts.mode&&e.threadInit());if(e.stat.disqusLoaded)e.stat.current="disqus",e.dom.querySelector("#idisqus").style.display="none",e.dom.querySelector("#disqus_thread").style.display="block";else{"尝试连接 Disqus……";var t=r.createElement("script");t.src="//"+e.opts.forum+".disqus.com/embed.js",t.dataset.timestamp=Date.now(),t.onload=function(){e.stat.disqusLoaded=!0,"连接成功,加载 Disqus 评论框……"},t.onerror=function(){1==e.opts.mode&&("连接失败,加载简易评论框……",e.threadInit())};var o=new Image;o.onerror=function(){1==e.opts.mode&&("连接超时,加载简易评论框……",e.threadInit())},o.onload=function(){(r.head||r.body).appendChild(t),clearTimeout(a)},o.src="https://disqus.com/favicon.ico?"+Date.now();var a=setTimeout((function(){o.complete&&o.naturalWidth||1==e.opts.mode&&("连接失败,加载简易评论框……",e.threadInit())}),e.opts.timeout)}},h.prototype.addListener=function(e,t,o){var a=this.dom.getElementsByClassName(e);[].forEach.call(a,(function(e){e.addEventListener(t,o,!1)}))},h.prototype.count=function(){var e=r.querySelectorAll("[data-disqus-url]"),t=e.length;if(t>0){for(var o=[],a=0;a<t;a++)o[a]=e[a].dataset.disqusUrl.replace(this.opts.site,"");u(this.opts.api+"/threadsList.php?links="+o.join(","),(function(e){JSON.parse(e).response.forEach((function(e){var t=document.createElement("a");t.href=e.link;var o=t.href.replace(t.origin,""),a=r.querySelector('[data-disqus-url$="'+o+'"]');a&&(a.innerHTML=e.posts,a.dataset.disqusCount=e.posts)}))}),(function(){console.log("获取数据失败!")}))}},h.prototype.postsList=function(e,t){e=e||5;var o=r.getElementById("string"==typeof t?t:"disqusPostsList");o&&u(this.opts.api+"/postsList.php?limit="+e,(function(e){var t=JSON.parse(e).response,a="";t.forEach((function(e){a+=`<li style="list-style-type: none;">${e.name}: ${e.raw_message}</br>评: <a href="${e.thread.link}">${e.thread.title}</a></li>`})),a=`<ul>${a}</ul`,o.innerHTML=a}),(function(){console.log("获取数据失败!")}))},h.prototype.loadRelated=function(){var e=this;0==e.stat.forum.settings.organicDiscoveryEnabled||e.stat.relatedLoaded||u(e.opts.api+"/threadsList.php?type="+e.opts.relatedType.toLowerCase()+"&thread="+e.stat.thread.id,(function(t){var o=JSON.parse(t);if(0==o.code){e.stat.relatedLoaded=!0;var a=o.response,n="";a.forEach((function(e){var t=e.topPost.message.replace(/<[^>]*>/g,"");n+=`<li class="related-item">\n <a class="related-item-link" href="${e.link}" title="${e.title}">\n <div class="related-item-title">${e.title}</div>\n <div class="related-item-desc">${e.posts}条评论<span class="related-item-bullet"> • </span><time class="related-item-time" datetime="${e.createdAt}"></time></div></a>\n <a class="related-item-link" href="${e.link}?#comment-${e.topPost.id}" title="${t}">\n <div class="related-item-post">\n <div class="related-item-avatar"><img src="${e.topPost.avatar}" /></div>\n <div class="related-item-main">\n <div class="related-item-name">${e.topPost.name}</div>\n <div class="related-item-message">${t}</div>\n </div>\n </div></a>\n </li>`})),n=`<div class="comment-related-title">在<span class="comment-related-forumname">${e.stat.forum.name}</span>上还有</div><div class="comment-related-content"><ul class="related-list">${n}</ul></div>`,e.dom.querySelector(".comment-related").innerHTML=n,e.timeAgo()}}),(function(){console.log("获取数据失败!")}))},h.prototype.loadReactions=function(){var e=this;0!=e.stat.forum.settings.threadReactionsEnabled&&u(e.opts.api+"/threadReactionsLoadReations.php?thread="+e.stat.thread.id,(function(t){var o=JSON.parse(t);if(o.response.eligible){e.dom.querySelector(".comment-reaction-prompt").innerHTML=o.response.prompt;var a=o.response.reactions,n=0,i="",r=e.user.reactionVote[e.stat.thread.id];r=r||(o.selected?o.selected.id:0),a.forEach((function(e){n+=e.votes,i+=`<li class="comment-reaction-item"><a class="comment-reaction-btn${r==e.id?" selected":""}" data-id="${e.id}" href="javascript:;"><img class="comment-reaction-image" src="${e.imageUrl}"> ${e.text}</a><div class="comment-reaction-count">${e.votes}</div></li>`})),e.dom.querySelector(".comment-reaction-list").innerHTML=i,e.dom.querySelector(".comment-reaction-total").innerHTML=n+" 人次参与"}}),(function(){}))},h.prototype.reactionVote=function(e,t){var o=this,a=t.closest(".comment-reaction-item").querySelector(".comment-reaction-count"),n=t.dataset.id,i={thread:o.stat.thread.id,unique:o.user.unique,reaction:n};p(o.opts.api+"/threadReactionsVote.php",i,(function(e){o.user.reactionVote[o.stat.thread.id]=n,s.setItem("reaction_vote",JSON.stringify(o.user.reactionVote)),t.classList.add("selected"),a.innerHTML++}))},h.prototype.selectOrder=function(e,t){var o=this,a=t.value;sessionStorage.setItem("order",a),o.stat.order=a,o.dom.querySelector(".comment-list").innerHTML="",o.dom.querySelector(".comment-loadmore").classList.add("hide"),o.stat.next=null,o.getlist()},h.prototype.getlist=function(){var e=this;e.stat.loading=!0,e.dom.querySelector("#idisqus").classList.add("loading"),e.dom.querySelector(".comment-list").dataset.tips="评论加载中……",u(e.opts.api+"/getcomments.php?thread="+e.stat.thread.id+(e.stat.next?"&cursor="+e.stat.next:"")+"&order="+e.stat.order,(function(t){var o=JSON.parse(t);if(0===o.code){e.stat.offsetTop=r.documentElement.scrollTop||r.body.scrollTop,e.dom.querySelector("#idisqus").classList.remove("loading");var a=e.dom.querySelector(".comment-loadmore"),n=o.response?o.response:[];if(e.stat.root=[],n.forEach((function(t){e.load(t),t.parent||e.stat.root.unshift(t.id)})),o.cursor.hasPrev&&e.stat.root.forEach((function(t){e.dom.querySelector(".comment-list").appendChild(e.dom.querySelector("#comment-"+t))})),o.cursor.hasNext?(e.stat.next=o.cursor.next,a.classList.remove("loading"),a.classList.remove("hide")):(e.stat.next=null,a.classList.add("hide")),0==e.stat.thread.posts)return void(e.dom.querySelector(".comment-list").dataset.tips="来做第一个留言的人吧!");if(0==n.length)return;e.timeAgo();var i=e.dom.querySelectorAll(".comment-item-body iframe");if([].forEach.call(i,(function(e){e.style.width=e.clientWidth+"px",e.style.height=9*e.clientWidth/16+"px",setTimeout((function(){e.src=e.src}),1e3)})),e.dom.querySelectorAll(".comment-item-body .twitter-tweet").length>0){var s=document.getElementsByTagName("head")[0],m=document.createElement("script");m.type="text/javascript",m.src="//platform.twitter.com/widgets.js",s.appendChild(m)}if(window.scrollTo(0,e.stat.offsetTop),/^#disqus|^#comment-/.test(location.hash)&&!o.cursor.hasPrev&&!e.stat.disqusLoaded&&!e.stat.loaded){var c=e.dom.querySelector("#idisqus "+location.hash);c&&window.scrollBy(0,c.getBoundingClientRect().top)}e.stat.loading=!1,e.stat.loaded=!0}}),(function(){alert("获取数据失败,请检查服务器设置。")}))},h.prototype.load=function(e){var t=this;t.stat.post[e.id]=e;var o=t.dom.querySelector('.comment-item[data-id="'+e.parent+'"]'),a={username:e.username,name:e.name,avatar:e.avatar};e.username&&-1==t.stat.users.map((function(e){return e.username})).indexOf(e.username)&&t.stat.users.push(a);var n=e.parent?{name:`<a class="comment-item-pname" data-parent="${e.parent}" href="#${o.id}"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M1.664 902.144s97.92-557.888 596.352-557.888V129.728L1024 515.84l-425.984 360.448V628.8c-270.464 0-455.232 23.872-596.352 273.28"></path></svg>${o.dataset.name}</a>`,dom:o.querySelector(".comment-item-children"),insert:"afterbegin"}:{name:"",dom:t.dom.querySelector(".comment-list"),insert:"preview"==e.id||e.isPost?"afterbegin":"beforeend"},i=`<li class="comment-item" data-id="${e.id}" data-name="${e.name}" id="comment-${e.id}">\n <div class="comment-item-body">\n <a class="comment-item-avatar" href="#comment-${e.id}"><img src="${e.avatar}"></a>\n <div class="comment-item-main">\n <div class="comment-item-header"><a class="comment-item-name" title="${e.name}" rel="nofollow" target="_blank" href="${e.url||"javascript:;"}">${e.name}</a>${e.isMod?`<span class="comment-item-badge">${t.opts.badge}</span>`:""}${n.name}<span class="comment-item-bullet"> • </span><time class="comment-item-time" datetime="${e.createdAt}"></time></div>\n <div class="comment-item-content">${e.message}</div>\n <div class="comment-item-footer">${e.isPost?'<span class="comment-item-manage"><a class="comment-item-edit" href="javascript:;">编辑</a><span class="comment-item-bullet"> • </span><a class="comment-item-delete" href="javascript:;">删除</a><span class="comment-item-bullet"> • </span></span>':""}<a class="comment-item-reply" href="javascript:;">回复</a></div>\n </div></div>\n <ul class="comment-item-children">\n ${e.hasMore?'<li><a class="comment-item-loadmore" href="javascript:;">显示更多回复</a></li>':""}\n </ul>\n </li>`;if(e.isDeleted&&(i=`<li class="comment-item" data-id="${e.id}" id="comment-${e.id}" data-name="${e.name}">\n <div class="comment-item-body">\n <a class="comment-item-avatar" href="#comment-${e.id}"><img src="${e.avatar}"></a>\n <div class="comment-item-main" data-message="此评论已被删除。"></div></div>\n <ul class="comment-item-children">\n ${e.hasMore?'<li><a class="comment-item-loadmore" href="javascript:;">显示更多回复</a></li>':""}\n </ul>\n </li>`),t.dom.querySelector('.comment-item[data-id="'+e.id+'"]')?t.dom.querySelector('.comment-item[data-id="'+e.id+'"]').outerHTML=i:n.dom.insertAdjacentHTML(n.insert,i),e.isPost&&!t.stat.editing){var r=t.dom.querySelector('.comment-item[data-id="'+e.id+'"]'),s=setTimeout((function(){r.querySelector(".comment-item-manage")&&(r.querySelector(".comment-item-manage").outerHTML="")}),6e5);r.querySelector(".comment-item-delete").addEventListener("click",(function(o){var a={id:e.id};o.currentTarget.innerHTML="删除中",p(t.opts.api+"/removecomment.php",a,(function(e){var o=JSON.parse(e);0===o.code?1==o.response.isDeleted?(r.outerHTML="",t.stat.thread.posts=parseInt(t.dom.querySelector("#comment-count").innerHTML)-1,t.dom.querySelector("#comment-count").innerHTML=t.stat.thread.posts+" 条评论"):(alert(o.response.message),r.querySelector(".comment-item-manage").outerHTML=""):2===o.code&&(alert(o.response),r.querySelector(".comment-item-manage").outerHTML="")}),(function(){alert("删除出错,请稍后重试")})),clearTimeout(s)}),!1),r.querySelector(".comment-item-edit").addEventListener("click",(function(){t.stat.editing=e,t.edit(e)}),!1)}},h.prototype.loadMore=function(e,t){var o=this;o.stat.offsetTop=r.documentElement.scrollTop||r.body.scrollTop,o.stat.loading||(t.classList.add("loading"),o.getlist())},h.prototype.loadMoreReply=function(e,t){var o=this;t.innerHTML="加载中……";var a=t.closest(".comment-item-children"),n=t.closest(".comment-item");u(o.opts.api+"/descendants.php?post="+n.dataset.id,(function(e){var n=JSON.parse(e);0==n.code?(a.removeChild(t.parentNode),n.response.forEach((function(e){o.load(e)})),o.timeAgo()):t.innerHTML="读取失败"}),(function(){t.innerHTML="读取出错"}))},h.prototype.focus=function(e,t){var o=t.closest(".comment-form-wrapper");o.classList.add("editing"),o.classList.contains("focus")?o.classList.remove("focus"):o.classList.add("focus")},h.prototype.input=function(e,t){var o=this,a=t.closest(".comment-form");a.querySelector(".comment-form-alert").innerHTML="";var n=a.querySelector(".comment-form-wrapper"),i=t.value.replace(/<code>.*?<\/code>/g,"").match(/(^|\s|\r|\n)*(http:\/\/|https:\/\/)(\w|-|\.)*(disqus|sinaimg|giphy|imgur|instagram|twimg|twitter|youtube|youtu\.be)((\w|=|\?|\.|\/|&|\%|-)*)(jpg|png|gif|gallery\/\w+|p\/[a-zA-Z0-9]{11}.*|status\/\d{19}|v=[a-zA-Z0-9]{11}|\/[a-zA-Z0-9]{11})(\s|$|\n)/g);a.querySelector(".comment-image-list").innerHTML="",i?i.forEach((function(e,t){e=e.replace("/\n|\r\n|^s|s$/g","");var i=o.stat.media[e];if(i){var r=`<li class="comment-image-item" data-image-url="${i.thumbnailUrl}"><img class="comment-image-object" src="https:${i.thumbnailUrl}"></li>`;return a.querySelector(".comment-image-list").insertAdjacentHTML("beforeend",r),void n.classList.add("expanded")}p(o.opts.api+"/media.php",{url:e},(function(t){var r=JSON.parse(t);if(0==r.code){var s=`<li class="comment-image-item" data-image-url="${(i=r.response).thumbnailUrl}"><img class="comment-image-object" src="https:${i.thumbnailUrl}"></li>`;a.querySelector(".comment-image-list").insertAdjacentHTML("beforeend",s),o.stat.media[e]=i,n.classList.add("expanded")}}),(function(){}))})):n.classList.remove("expanded")},h.prototype.mention=function(e,t){var o=this,a=t,n=a.selectionStart,i=a.value.slice(0,n).lastIndexOf("@"),r=a.value.slice(i,n),s=o.dom.querySelector(".mention-user"),m=o.stat.users.filter((function(e){var t=new RegExp(r.slice(1),"i");return e.username.search(t)>-1}));if(0==r.search(/^@\w+$|^@$/)&&m.length>0){if(38==e.keyCode||40==e.keyCode)return;var c=o.getCaretCoord(a),l="",d="";m.forEach((function(e,t){l+=`<li class="mention-user-item${0==t?" active":""}" data-username="${e.username}"><img class="mention-user-avatar" src="${e.avatar}"><div class="mention-user-username">${e.username}</div><div class="mention-user-name">${e.name}</div></li>`})),s?(s.innerHTML='<ul class="mention-user-list">'+l+"</ul>",s.style.left=c.left+"px",s.style.top=c.top+"px"):(d=`<div class="mention-user" style="left:${c.left}px;top:${c.top}px"><ul class="mention-user-list">${l}</ul></div>`,o.dom.querySelector("#idisqus").insertAdjacentHTML("beforeend",d)),o.addListener("mention-user-item","mouseover",(function(){o.dom.querySelector(".mention-user-item.active").classList.remove("active"),this.classList.add("active")})),o.addListener("mention-user-item","click",(function(){var e="@"+this.dataset.username+" ";a.value=a.value.slice(0,i)+e+a.value.slice(n),s.outerHTML="",a.focus(),a.setSelectionRange(i+e.length,i+e.length)}))}else s&&(s.outerHTML="")},h.prototype.getCaretCoord=function(e){var t=e.selectionEnd,o=r.createElement("div"),a=r.createElement("span"),n=getComputedStyle(e);[].forEach.call(n,(function(e){o.style[e]=n[e]})),o.style.position="absolute",this.dom.appendChild(o),o.textContent=e.value.substr(0,t),a.textContent=e.value.substr(t)||".",o.appendChild(a);var i={top:e.offsetTop-e.scrollTop+a.offsetTop+parseFloat(n.lineHeight),left:e.offsetLeft-e.scrollLeft+a.offsetLeft};return this.dom.removeChild(o),i},h.prototype.keySelect=function(e,t){var o=this,a=t,n=a.selectionStart,i=a.value.slice(0,n).lastIndexOf("@");a.value.slice(i,n);if(o.dom.querySelector(".mention-user")){var r=o.dom.querySelector(".mention-user-item.active");switch(e.keyCode){case 13:var s="@"+r.dataset.username+" ";a.value=a.value.slice(0,i)+s+a.value.slice(n),a.setSelectionRange(i+s.length,i+s.length),o.dom.querySelector(".mention-user").outerHTML="",e.preventDefault();break;case 38:r.previousSibling&&(r.previousSibling.classList.add("active"),r.classList.remove("active")),e.preventDefault();break;case 40:r.nextSibling&&(r.nextSibling.classList.add("active"),r.classList.remove("active")),e.preventDefault()}}},h.prototype.jump=function(e,t){var o,a,n=(o=t.href,a=r.createElement("a"),a.href=o,a).hash,i=this.dom.querySelector("#idisqus "+n);history.replaceState(void 0,void 0,n),window.scrollBy(0,i.getBoundingClientRect().top),e.preventDefault()},h.prototype.parentShow=function(e,t){if(!t.querySelector(".comment-item-parent")){var o=this.stat.post[t.dataset.parent];if(!o.isDeleted){var a=o.message.replace(/<[^>]*>/g,""),n=`<div class="comment-item-parent"><a class="comment-item-avatar" href="javascript:;"><img src="${o.avatar}"></a><div class="comment-item-pmain"><div class="comment-item-pheader">${o.name}</div><div class="comment-item-pcontent" title="${a}">${a}</div></div></div>`;t.insertAdjacentHTML("beforeend",n)}}},h.prototype.field=function(e,t){var o=t,a=o.closest(".comment-form").querySelector(".comment-form-textarea");this.appendText(a,o.dataset.code)},h.prototype.show=function(e,t){var o=this,a=t,n=a.closest(".comment-item"),i=o.dom.querySelector(".comment-item .comment-box:not([data-current-id])");if(i){var r=i.closest(".comment-item").querySelector(".comment-item-cancel");r.outerHTML=r.outerHTML.replace("cancel","reply"),i.outerHTML=""}if("comment-item-reply"==a.className){a.outerHTML=a.outerHTML.replace("reply","cancel");var s=o.box.replace(/emoji-input/g,"emoji-input-"+n.dataset.id).replace(/upload-input/g,"upload-input-"+n.dataset.id);n.querySelector(".comment-item-children").insertAdjacentHTML("beforebegin",s),o.user.init(),n.querySelector(".comment-form-textarea").focus()}},h.prototype.verify=function(e,t){var o=this,a=t,n=a.closest(".comment-box"),i=n.querySelector(".comment-avatar-image"),r=n.querySelector(".comment-form-name"),s=n.querySelector(".comment-form-email");n.querySelector(".comment-form-alert");""!=s.value&&u(o.opts.api+"/getgravatar.php?email="+s.value+"&name="+r.value,(function(e){var t=JSON.parse(e);t.isEmail||a!=s||o.errorTips("您所填写的邮箱地址有误。",s),""!=r.value&&(i.src=t.gravatar)}),(function(){}))},h.prototype.appendText=function(e,t){var o=e.selectionStart;t=0==o?t+" ":" "+t+" ";e.value=e.value.slice(0,o)+t+e.value.slice(o),e.focus(),e.setSelectionRange(o+t.length,o+t.length)},h.prototype.upload=function(e,t){var o=this,a=t,n=a.closest(".comment-form"),i=n.querySelector(".comment-image-progress"),r=n.querySelector(".comment-image-loaded"),s=n.querySelector(".comment-form-wrapper"),m=n.querySelector(".comment-form-alert");if(m.innerHTML="",0!==a.files.length){var c=a.files[0].size;if(c>5e6)return m.innerHTML="请选择 5M 以下图片。",void setTimeout((function(){m.innerHTML=""}),3e3);if(-1!=o.stat.imageSize.indexOf(c))return m.innerHTML="请勿选择已存在的图片。",void setTimeout((function(){m.innerHTML=""}),3e3);i.style.width="80px",s.classList.add("expanded");var l=new FormData;l.append("file",a.files[0]);a.files[0].name;var d,u=new XMLHttpRequest;u.withCredentials=!0,u.onreadystatechange=function(){if(4==u.readyState&&200==u.status){var e=JSON.parse(u.responseText);if(0==e.code){o.stat.imageSize.push(c);var t=e.response.thumbnailUrl,a=n.querySelector(".comment-form-textarea");o.appendText(a,"https:"+t);var i=new Image;i.src=t,i.onload=function(){d.innerHTML='<img class="comment-image-object" src="https:'+t+'">',d.dataset.imageUrl=t,d.classList.remove("loading")}}else m.innerHTML="图片上传出错。",d.innerHTML="",n.getElementsByClassName("comment-image-item").length&&s.classList.remove("expanded"),setTimeout((function(){m.innerHTML=""}),3e3)}},u.upload.addEventListener("progress",(function(e){r.style.width=Math.ceil(e.loaded/e.total*100)+"%"}),!1),u.upload.addEventListener("load",(function(e){r.style.width=0,i.style.width=0;var t=`<li class="comment-image-item loading" data-image-size="${c}">\n <svg version="1.1" class="comment-image-object" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background: new 0 0 50 50;" xml:space="preserve">\n <rect x="0" y="10" width="4" height="10" fill="rgba(127,145,158,1)" opacity="0.2">\n <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />\n </rect>\n <rect x="8" y="10" width="4" height="10" fill="rgba(127,145,158,1)" opacity="0.2">\n <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.15s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />\n </rect>\n <rect x="16" y="10" width="4" height="10" fill="rgba(127,145,158,1)" opacity="0.2">\n <animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />\n <animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />\n </rect>\n </svg>\n </li>`;n.querySelector(".comment-image-list").insertAdjacentHTML("beforeend",t),d=n.querySelector('[data-image-size="'+c+'"]')}),!1),u.open("POST",o.opts.api+"/media.php",!0),u.send(l)}},h.prototype.remove=function(e){var t=this,o=e.currentTarget.closest(".comment-image-item"),a=e.currentTarget.closest(".comment-form-wrapper");o.outerHTML="",t.stat.imageSize=[];var n=a.getElementsByClassName("comment-image-item");[].forEach.call(n,(function(e,o){t.stat.imageSize[o]=e.dataset.imageSize})),0==t.stat.imageSize.length&&a.classList.remove("expanded"),a.querySelector(".comment-image-input").value=""},h.prototype.errorTips=function(e,t){var o=this;"true"==o.user.logged_in&&o.handle.logout();var a=o.dom.querySelector("#idisqus"),n=o.dom.querySelector(".comment-form-error");n&&(n.outerHTML="");var i='<div class="comment-form-error" style="top:'+t.offsetTop+"px;left:"+t.offsetLeft+'px;">'+e+"</div>";a.insertAdjacentHTML("beforeend",i),setTimeout((function(){var e=o.dom.querySelector(".comment-form-error");e&&(e.outerHTML="")}),3e3)},h.prototype.post=function(e,t){var o=this,a=t.closest(".comment-box[data-current-id]")||t.closest(".comment-item")||t.closest(".comment-box"),n=a.querySelector(".comment-form-textarea").value,i=a.dataset.id?a.dataset.id:"";a.getElementsByClassName("comment-image-item");if(!a.dataset.currentId){var r=a.querySelector(".comment-form-name"),s=a.querySelector(".comment-form-email"),m=a.querySelector(".comment-form-url"),c=a.querySelector(".comment-form-alert"),l=function(){setTimeout((function(){c.innerHTML=""}),3e3)};if("1"!=o.user.type){var d=r.value,u=s.value,v=m.value.replace(/\s/g,"");if(/^\s*$/i.test(d))return void o.errorTips("名字不能为空或空格。",r);if(/^\s*$/i.test(u))return void o.errorTips("邮箱不能为空或空格。",s);if(!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(u))return void o.errorTips("请正确填写邮箱。",s);if(!/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$|^\s*$/i.test(v))return void o.errorTips("请正确填写网址。",m);if(o.user.unique=o.user.email==u?o.user.unique:f(),o.user.name=d,o.user.email=u,o.user.url=v,o.user.avatar=a.querySelector(".comment-avatar-image").src,o.user.submit(),!o.user.name&&!o.user.email)return}if(o.stat.message||o.stat.mediaHtml||(o.box=o.dom.querySelector(".comment-box").outerHTML.replace("comment-form-wrapper","comment-form-wrapper editing").replace(/加入讨论……/,"")),/^\s*$/i.test(n))return c.innerHTML="评论不能为空或空格。",void a.querySelector(".comment-form-textarea").focus();var h=n;o.opts.emoji_preview?h=h.replace(/:([-+\w]+):/g,(function(e){var t=e.replace(/:/g,"");return o.eac[t]?`<img class="emojione" width="24" height="24" alt="'+emojiShort+'" title=":${t}:" src="${o.opts.emojiPath+o.eac[t]}.png">`:e})):o.emojiList.forEach((function(e){h=h.replace(`:${e.code}:`,`<img class="emojione" width="24" height="24" src="${o.opts.emojiPath+e.unicode}.png" />`)}));var g={url:o.user.url?o.user.url:"",isMod:!1,username:null,name:o.user.name,avatar:o.user.avatar,id:"preview",parent:i,createdAt:(new Date).toJSON(),message:"<p>"+h+"</p>"};o.load(g),o.timeAgo(),o.stat.message=n,o.stat.mediaHtml=a.querySelector(".comment-image-list").innerHTML,i?a.querySelector(".comment-item-cancel").click():(a.querySelector(".comment-form-textarea").value="",a.querySelector(".comment-image-list").innerHTML="",a.querySelector(".comment-form-wrapper").classList.remove("expanded","editing"))}var y=n.match(/@\w+/g);if(y&&(y=y.filter((function(e){return o.stat.users.map((function(e){return e.username})).indexOf(e.slice(1))>-1}))).length>0){var b=new RegExp("("+y.join("|")+")","g");n=n.replace(b,"$1:disqus")}if(a.dataset.currentId){var q={id:a.dataset.currentId,message:n,unique:o.user.unique};p(o.opts.api+"/updatecomment.php",q,(function(e){var t=JSON.parse(e);if(0===t.code){o.stat.message=null,o.stat.mediaHtml=null;var a=t.response;o.load(a),o.timeAgo(),o.stat.editing=!1}else o.load(o.stat.editing),o.timeAgo(),o.stat.editing=!1}),(function(){o.load(o.stat.editing),o.timeAgo(),o.stat.editing=!1}))}else{q={thread:o.stat.thread.id,parent:i,message:n,name:o.user.name,email:o.user.email,url:o.user.url,unique:o.user.unique};p(o.opts.api+"/postcomment.php",q,(function(e){var t=JSON.parse(e);if(0===t.code){o.dom.querySelector('.comment-item[data-id="preview"]').outerHTML="",o.stat.thread=t.thread,o.stat.thread.posts=parseInt(o.dom.querySelector("#comment-count").innerHTML)+1,o.dom.querySelector("#comment-count").innerHTML=o.stat.thread.posts+" 条评论";var n=t.response;n.isPost=!0,o.load(n),o.timeAgo();var r={post:JSON.stringify(n),thread:JSON.stringify(o.stat.thread),parent:JSON.stringify(o.stat.post[i]),code:t.verifyCode};t.verifyCode&&p(o.opts.api+"/sendemail.php",r,(function(e){console.info("邮件发送成功!")}))}else 2===t.code?(c.innerHTML=t.response,o.dom.querySelector('.comment-item[data-id="preview"]').outerHTML="",o.reEdit(a),t.response.indexOf("author")>-1&&o.handle.logout()):(c.innerHTML="提交失败,请稍后重试,错误代码:"+t.code,l(),o.dom.querySelector('.comment-item[data-id="preview"]').outerHTML="",o.reEdit(a))}),(function(){c.innerHTML="提交出错,请稍后重试。",l(),o.dom.querySelector('.comment-item[data-id="preview"]').outerHTML="",o.reEdit(a)}))}},h.prototype.reEdit=function(e){var t=this;e.dataset.id?e.querySelector(".comment-item-reply").click():e.querySelector(".comment-form-wrapper").classList.add("editing"),t.stat.message&&(e.querySelector(".comment-form-textarea").value=t.stat.message),t.stat.mediaHtml&&(e.querySelector(".comment-form-wrapper").classList.add("expanded"),e.querySelector(".comment-image-list").innerHTML=t.stat.mediaHtml)},h.prototype.edit=function(e){var t=this,o=t.box.replace("comment-box","comment-box comment-box-"+e.id).replace(/emoji-input/g,"emoji-input-"+e.id).replace(/upload-input/g,"upload-input-"+e.id);t.dom.querySelector('.comment-item[data-id="'+e.id+'"] .comment-item-body').outerHTML=o,t.user.init();var a=t.dom.querySelector(".comment-box-"+e.id);a.dataset.currentId=e.id,a.querySelector(".comment-form-textarea").focus(),a.querySelector(".comment-actions-form").insertAdjacentHTML("afterbegin",'<a class="comment-form-cancel" href="javascript:;">取消</a>'),a.querySelector(".comment-form-cancel").addEventListener("click",(function(){t.stat.editing=!1,t.load(e),t.timeAgo()}),!1),t.stat.message&&(a.querySelector(".comment-form-textarea").value=t.stat.message),t.stat.mediaHtml&&(a.querySelector(".comment-form-wrapper").classList.add("expanded"),a.querySelector(".comment-image-list").innerHTML=t.stat.mediaHtml)},h.prototype.threadInit=function(e,t){var o=this;o.dom.querySelector("#idisqus").style.display="block",o.dom.querySelector("#disqus_thread").style.display="none",u(o.opts.api+"/threadsDetails.php?ident="+o.opts.identifier+"&link="+o.opts.url,(function(e){var t=JSON.parse(e);if(0==t.code){if(o.stat.thread=t.response,o.stat.forum=t.forum,o.dom.querySelector("#comment-link").href=`https://disqus.com/home/discussion/${o.stat.forum.id}/${o.stat.thread.slug}/?l=zh`,o.dom.querySelector(".comment-avatar-image").dataset.avatar=o.stat.forum.avatar,o.dom.querySelector(".comment-recommend-count").innerHTML=o.stat.thread.likes||"",0==o.stat.forum.settings.mediaembedEnabled&&(o.dom.querySelector(".comment-image-input").outerHTML="",o.dom.querySelector('[for="upload-input"]').outerHTML=""),"false"==o.user.logged_in&&(o.dom.querySelector(".comment-avatar-image").src=o.stat.forum.avatar),o.box=o.dom.querySelector(".comment-box").outerHTML.replace(/<label class="comment-actions-label exit"(.|\n)*<\/label>\n/,"").replace("comment-form-wrapper","comment-form-wrapper editing").replace(/加入讨论……/,""),o.opts.badge=o.stat.forum.moderatorBadgeText,!o.stat.order)switch(o.stat.forum.order){case 1:o.stat.order="asc";break;case 2:o.stat.order="desc";break;case 4:o.stat.order="popular"}o.dom.querySelector('.comment-order-radio[value="'+o.stat.order+'"]').checked=!0;var a=t.votedusers,n=0;n=1==o.user.type?a.filter((function(e){return e.username==o.user.username})).length>0?1:0:o.user.vote[o.stat.thread.id]?1:0,o.user.vote[o.stat.thread.id]=n,s.setItem("vote",JSON.stringify(o.user.vote)),n&&(o.dom.querySelector(".comment-recommend").classList.add("voted"),o.dom.querySelector(".comment-recommend-text").innerHTML="已推荐"),o.dom.querySelector("#idisqus").classList.remove("init"),o.loadRelated(),o.loadReactions(),o.dom.querySelector("#comment-count").innerHTML=o.stat.thread.posts+" 条评论",o.getlist()}else if(2===t.code){if(o.opts.autoCreate){o.dom.querySelector(".init-container").dataset.tips="正在创建 Thread……";var i={url:o.opts.link,identifier:o.opts.identifier,title:o.opts.title,slug:o.opts.slug,message:o.opts.desc};return void o.threadCreate(i)}o.dom.querySelector("#idisqus").classList.remove("init");var r=`<div class="comment-header"><span class="comment-header-item">创建 Thread</span></div>\n <div class="comment-thread-form">\n <p>由于 Disqus 没有本页面的相关 Thread故需先创建 Thread</p>\n <div class="comment-form-item"><label class="comment-form-label">url:</label><input class="comment-form-input" id="thread-url" name="url" value="${o.opts.link}" disabled /></div>\n <div class="comment-form-item"><label class="comment-form-label">identifier:</label><input class="comment-form-input" id="thread-identifier" name="identifier" value="${o.opts.identifier}" disabled /></div>\n <div class="comment-form-item"><label class="comment-form-label">title:</label><input class="comment-form-input" id="thread-title" name="title" value="${o.opts.title}" disabled /></div>\n <div class="comment-form-item"><label class="comment-form-label">slug:</label><input class="comment-form-input" id="thread-slug" name="slug" value="${o.opts.slug}" /></div>\n <div class="comment-form-item"><label class="comment-form-label">message:</label><textarea class="comment-form-textarea" id="thread-message" name="message">${o.opts.desc}</textarea></div>\n <button id="thread-submit" class="comment-form-submit">提交</button></div>`;o.dom.querySelector("#idisqus").innerHTML=r}}),(function(){}))},h.prototype.threadVote=function(e,t){var o=this,a=o.user.vote[o.stat.thread.id]?0:1,n={thread:o.stat.thread.id,unique:o.user.unique,vote:a};p(o.opts.api+"/threadsVote.php",n,(function(e){o.user.vote[o.stat.thread.id]=a,s.setItem("vote",JSON.stringify(o.user.vote)),a?(o.dom.querySelector(".comment-recommend").classList.add("voted"),o.stat.thread.likes++):(o.dom.querySelector(".comment-recommend").classList.remove("voted"),o.stat.thread.likes=0==o.stat.thread.likes?0:o.stat.thread.likes-1),o.dom.querySelector(".comment-recommend-count").innerHTML=o.stat.thread.likes||""}))},h.prototype.threadCreate=function(e,t){var o=this;if(t)var a={url:o.dom.querySelector("#thread-url").value,identifier:o.dom.querySelector("#thread-identifier").value,title:o.dom.querySelector("#thread-title").value,slug:o.dom.querySelector("#thread-slug").value.replace(/[^A-Za-z0-9_-]+/g,""),message:o.dom.querySelector("#thread-message").value};else a=arguments[0];p(o.opts.api+"/createthread.php",a,(function(e){var t=JSON.parse(e);if(0!==t.code)return 2===t.code?t.response.indexOf("A thread already exists with link")>-1?void alert(t.response.replace("A thread already exists with link,","已存在此链接的相关 Thread")):t.response.indexOf("Invalid URL")>-1?void alert("参数错误,无效的'URL'"):t.response.indexOf("Invalid slug")>-1?void alert("参数错误,无效的'slug'"):void alert(t.response):void alert(t.response);alert("创建 Thread 成功,刷新后便可愉快地评论了!"),setTimeout((function(){location.reload()}),2e3)}),(function(){alert("创建 Thread 出错,请稍后重试!")}))},h.prototype.destroy=function(){var e=this;e.dom.innerHTML="",delete e.dom,delete e.box,delete e.emojiList,delete e.user,delete e.handle,delete e.stat,delete e.opts},e&&"object"==typeof t&&t?e.exports=h:void 0===(a=function(){return h}.call(t,o,t,e))||(e.exports=a)}(window)}).call(this,o(1)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,o){}])}));
//# sourceMappingURL=iDisqus.min.js.map