diff --git a/.gitignore b/.gitignore index 4cd7534..3892d32 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ _build public -src/index.html \ No newline at end of file +src/index.html + +dist/index.html diff --git a/.npmignore b/.npmignore index 912a432..e8fc8d5 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,5 @@ src/index.html +dist/index.html + docs/ diff --git a/README.md b/README.md index c9610c0..512a343 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,27 @@ ```html - - + + - - + + +``` + +DisqusJS 从 v1.3.0 版本开始使用 Fetch API 代替 XMLHttpRequest,因此不再兼容低于 IE 11 的老旧浏览器。这些浏览器将会收到如下提示: + +``` +你的浏览器版本过低,不兼容评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并尝试完整 Disqus 模式 +``` + +如果需要为 IE8 及以上浏览器提供 DisqusJS 评论基础模式的兼容性支持,请在 DisqusJS 加载之前添加如下的 Polyfill: + +```html + + + + ``` #### 从 NPM 安装 @@ -153,6 +168,11 @@ var dsqjs = new DisqusJS({ - 最大评论嵌套数;超过嵌套层数的评论,会不论从属关系显示在同一层级下 - 非必须,默认值为 `4` +**nocomment** `{Number}` + +- 没有评论时的提示语(对应 Disqus Admin - Settings - Community - Comment Count Link - Zero comments) +- 非必须,默认值为 `这里冷冷清清的,一条评论都没有` + --- 以下配置和 Disqus Moderator Badge 相关,缺少一个都不会显示 Badge @@ -167,15 +187,6 @@ var dsqjs = new DisqusJS({ - 你想显示在 Disqus Moderator Badge 中的文字。该配置应和 [Disqus Admin - Settings - Community - Moderator Badge Text](https://disqus.com/admin/settings/community/) 相同 - 非必须,无默认值 ---- - -未来可能扩展的配置: - -- nocomment 没有评论时的提示语(对应 Disqus Admin - Settings - Community - Comment Count Link - Zero comments) -- ~~commentPolicyURL 站点评论政策 URL(对应 对应 Disqus Admin - Settings - General - Comment Policy URL)~~ -- ~~commentPolicyText 站点评论政策简介(对应 对应 Disqus Admin - Settings - General - Comment Policy Summary)~~ -- ~~newcomment 是否允许添加新评论(目前增加评论功能尚未实现)~~ - ### PJAX 站点注意事项 如果你在使用 DisqusJS v0.2.5 版本,需要在 PJAX 的页面跳转事件下销毁 Disqus 实例(Disqus 不支持 PJAX)、并通过 `window.disqusjs.load();` 重新加载 DisqusJS。DisqusJS v0.2.5 版本支持自动判断当前页面是否存在 `#disqus_thread` 容器,如果容器不存在就不加载。 @@ -192,9 +203,9 @@ DisqusJS v1.2.6 开始支持检测是否存在 Disqus 实例,并在加载 Disq > 当然,你也可以直接使用我搭建的反代 `https://disqus.skk.moe/disqus/`。 -### ZEIT Now +### Vercel (ZEIT Now) -[ZEIT Now](https://zeit.co) 是一个 Serverless 平台。免费 Plan 提供每月 20 GiB 流量。 +[ZEIT Now](https://zeit.co) 是一个 Serverless 平台。免费 Plan 提供每月 100 GiB 流量和无限的请求次数。 [sukkaw/disqusjs-proxy-example](https://github.com/SukkaW/disqusjs-proxy-example) 提供了一个使用 Now Router 进行反代的样例配置文件。 ### Cloudflare Workers @@ -235,11 +246,12 @@ DisqusJS v1.2.6 开始支持检测是否存在 Disqus 实例,并在加载 Disq ## 调试、进阶使用 & 开发相关 -- `a.disquscdn.com` 和 `c.disquscdn.com` 解析到 Cloudflare 而不是 Fastly,可用性大大增强;`disqus.com` 和 `shortname.disqus.com` 仍然被墙;`disq.us` 解析到 Fastly 连通性较差,DisqusJS 通过解析获得了原链接。 +- ~~`a.disquscdn.com` 和 ~~`c.disquscdn.com` 解析到 Cloudflare 而不是 Fastly,可用性大大增强;`disqus.com` 和 `shortname.disqus.com` 仍然被墙;`disq.us` 解析到 Fastly 连通性较差,DisqusJS 通过解析获得了原链接。 +- `a.disquscdn.com` 重新解析到 Fastly,可用性不如 `c.disquscdn.com`,DisqusJS 内部已增加替换 `a.disquscdn.com` 为 `c.disquscdn.com` 以改善速度。 - DisqusJS 检测访客的 Disqus 可用性是通过检测 `disqus.com/favicon.ico` 和 `${disqusjs.config.shortname}.disqus.com/favicon.ico` 是否能正常加载,如果有一个加载出错或超时(2s)就判定 Disqus 不可用。 - DisqusJS 在 localStorage 中持久化了 Disqus 连通性检查结果,key 为 `dsqjs_mode`,value 为 `disqus` 或者 `dsqjs`。需要调整 DisqusJS 的模式时可以直接操作 localStorage。 - Disqus 自己的 config 保存在全局变量 `window.disqus_config` 中,你可能好奇为什么没有引入。实际上由于 `disqus_config` 和 DisqusJS 中有很多重复的配置,所以 DisqusJS 直接将相关配置项赋给了 `disqus_config`,所以用户只需要配置 DisqusJS 即可。 -- DisqusJS 并没有使用 Webpack 将 `disqusjs.css` 和 `disqus.js` 打包在一起,大家可以开发自己的 DisqusJS 主题。所有 DisqusJS 创建的 HTML 元素都在 `
` 之中、几乎所有的元素都有自己的类名并都以 `dsqjs-` 为前缀,防止污染。 +- DisqusJS 并没有使用 Webpack 将 `disqusjs.css` 和 `disqus.js` 打包在一起,大家可以开发自己的 DisqusJS 主题。所有 DisqusJS 创建的 HTML 元素都包裹在 `
` 之中、几乎所有的元素都有自己的类名并都以 `dsqjs-` 为前缀,防止污染。 - DisqusJS 从 v1.2.0 版本开始实现了评论排序。Disqus 将评论排序方式持久化在 localStorage 中、key 为 `disqus.sort`,DisqusJS 沿用了这一位置。 ## Todo List diff --git a/dist/disqus.js b/dist/disqus.js index 6893883..db5d498 100644 --- a/dist/disqus.js +++ b/dist/disqus.js @@ -1,6 +1 @@ -/*! - * DisqusJS | v1.2.6 - * 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()}}); \ No newline at end of file +/*! DisqusJS v1.3.0 | Sukka (https://skk.moe) | https://disqusjs.skk.moe | MIT License */"use strict";function _createForOfIteratorHelperLoose(e,s){var t;if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator])return(t=e[Symbol.iterator]()).next.bind(t);if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||s&&e&&"number"==typeof e.length){t&&(e=t);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,s){if(e){if("string"==typeof e)return _arrayLikeToArray(e,s);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,s):void 0}}function _arrayLikeToArray(e,s){(null==s||s>e.length)&&(s=e.length);for(var t=0,r=new Array(s);t & DisqusJS

    ',u=function(e,s){return'
    '},m=function(e,s,t){var r=e.avatarEl,n=e.createdAt;return'
    '+r+'
    '+s+'
    '+t+"
    "},g='如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并 尝试完整 Disqus 模式 | 强制完整 Disqus 模式',j=function(e){return r(e,{method:"GET"}).then(function(e){return n.all([e.ok,e.status,e.json(),e.headers])}).then(function(e){var s=e[0],t=e[1],r=e[2],n=e[3];if(s)return{ok:s,status:t,data:r,headers:n};throw new Error}).catch(function(e){throw e})},b=function(e,s){try{t.setItem(e,s)}catch(e){}},i=function(e){function s(e){return e<10?"0"+e:e}return e=Date.parse(new Date(e)),(e=new Date(e+288e5)).getFullYear()+"-"+s(e.getMonth()+1)+"-"+s(e.getDate())+" "+s(e.getHours())+":"+s(e.getMinutes())};function e(){var e;s.DISQUS?s.DISQUS.reset({reload:!0,config:function(){this.page.identifier=D.config.identifier,this.page.url=D.config.url,this.page.title=D.config.title}}):(e=p.createElement("script"),q(d).innerHTML='
    评论完整模式加载中... 如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或切换至 评论基础模式
    '+l+"
    ",q("dsqjs-force-dsqjs").addEventListener(v,T),e.src="https://"+D.config.shortname+".disqus.com/embed.js",e.setAttribute("data-timestamp",+new Date),(p.head||p.body).appendChild(e))}function y(){q(d).innerHTML='
    正在检查 Disqus 能否访问...
    '+l+"
    ";for(var e=["disqus.com",D.config.shortname+".disqus.com"],r=0,n=0,a=function(){e.length===r&&r===n?w():e.length===r&&T()},s=0,t=e;s
    评论基础模式加载中... '+g+"
    "+u(o,D.config.siteName)+'

      评论列表加载中...

    加载更多评论
    '+l+"
    ",L(),q("dsqjs-order-"+D.sortType).setAttribute("checked","true"),i()}else{if(0!==s.code||1===s.response.length)throw new Error;h('当前 Thread 尚未创建。是否切换至 完整 Disqus 模式?'),q("dsqjs-force-disqus").addEventListener(v,w)}}).catch(E);function s(e){function a(e){return{comment:e,author:e.author.name,isPrimary:!!D.config.admin&&e.author.username===D.config.admin,children:t(+e.id),hasMore:e.hasMore}}var s=[],o=[],t=function(e){if(0===o.length)return null;for(var s,t=[],r=_createForOfIteratorHelperLoose(o);!(s=r()).done;){var n=s.value;n.parent===e&&t.unshift(a(n))}return t.length?t:null};return e.forEach(function(e){(e.parent?o:s).push(e)}),s.map(a)}var i=function t(e){void 0===e&&(e="");function r(){for(var e,s=_createForOfIteratorHelperLoose(d);!(e=s()).done;){e.value.removeEventListener("change",u)}i.removeEventListener(v,l);for(var t,r=_createForOfIteratorHelperLoose(c);!(t=r()).done;){t.value.removeEventListener(v,y)}}var i=q("dsqjs-load-more"),d=p.getElementsByClassName("dsqjs-order-radio"),c=p.getElementsByClassName("dsqjs-has-more-btn"),l=function(){r(),t(D.page.next)},u=function(e){var s=e.target;D.sortType=s.getAttribute("value"),b(o,D.sortType),r(),D.page.comment=[],D.page.next="",q("dsqjs-post-container").innerHTML='

    正在切换排序方式...

    ',i.classList.add("dsqjs-hide"),t()},s=""===e?"":"&cursor="+e;i.classList.add("dsqjs-disabled");function n(e){var s=e.createdAt;return Date.parse(new Date(s))}function m(e,s){return e.parent&&s.parent?n(e)-n(s):0}var a=D.config.api+"3.0/threads/listPostsThreaded?forum="+D.config.shortname+"&thread="+D.page.id+s+"&api_key="+H()+"&order="+D.sortType;j(a).then(function(e){var s,t=e.data;if(0===t.code&&0",L(),q("dsqjs-force-disqus").addEventListener(v,T)}}).catch(function(){""===e?E():(i.classList.remove("dsqjs-disabled"),i.innerHTML="加载更多评论失败,点击重试",i.addEventListener(v,l))})},f=function(e){function a(e){return e.comment.author.profileUrl?(e.comment.avatarEl='",e.comment.authorEl='"+e.comment.author.name+""):(e.comment.avatarEl='',e.comment.authorEl=''+e.comment.author.name+""),D.config.adminLabel&&e.isPrimary&&(e.comment.authorEl+=''+D.config.adminLabel+""),e}function o(e){var s="",t="",t=e.isDeleted?"此评论已被删除":(s=e.authorEl+'',function(e){var s=p.createElement("div");s.innerHTML=e;for(var t,r=_createForOfIteratorHelperLoose(s.getElementsByTagName("a"));!(t=r()).done;){var n=t.value,a=decodeURIComponent(n.href.replace(/https:\/\/disq.us\/url\?url=/g,"")).replace(/(.*):.+cuid=.*/,"$1");n.href=a,n.innerHTML=a,n.rel="external noopener nofollow noreferrer",n.target="_blank"}return s.innerHTML}(r(e.message)));return m(e,s,t)}var r=function(e){return e.replace("/a.disquscdn.com/ig","c.disquscdn.com")},t="";s(e).map(function(e){e.children&&(e.nesting=1);var s="";(e=a(e)).hasMore&&(s='

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

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

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

      '),n+='
    • '+o(e.comment)+t(e)+s+"
    • "}),0!==(n+="
    ").length?n:void 0}}(e)+s+"
  • "}),h("你可能无法访问 Disqus,已启用评论基础模式。"+g),q("dsqjs-post-container").innerHTML=t,L()}}function E(e){console.log(e),h('评论基础模式加载失败,是否 重载尝试完整 Disqus 模式 ?'),q("dsqjs-reload-dsqjs").addEventListener(v,f),q("dsqjs-reload-disqus").addEventListener(v,y)}function T(){b("dsqjs_mode","dsqjs"),f()}function w(){b("dsqjs_mode","disqus"),e()}var D={},_=p.location.origin+p.location.pathname+p.location.search;D.config=a({api:"https://disqus.skk.moe/disqus/",identifier:_,url:_,title:p.title,siteName:"",nesting:parseInt(M.nesting)||4,nocomment:"这里冷冷清清的,一条评论都没有"},M),D.page={};var I=D.config.apikey,H=function(){return Array.isArray(I)?I[Math.floor(Math.random()*I.length)]:I};s.disqus_config=function(){this.page.url=D.config.url,this.page.identifier=D.config.identifier,this.page.title=D.config.title},q(d).innerHTML='
    '+l+"
    ",r&&t&&n?(D.mode=t.getItem("dsqjs_mode"),D.sortType=t.getItem(o)||t.getItem("disqus.sort"),D.sortType||(b(o,"desc"),D.sortType="desc"),("disqus"===D.mode?e:"dsqjs"===D.mode?f:y)()):(h("你的浏览器版本过低,不兼容评论基础模式。"+g),L())}(window,document,localStorage,fetch,Promise)}try{module.exports=DisqusJS}catch(e){} \ No newline at end of file diff --git a/dist/disqusjs.css b/dist/disqusjs.css index 6a00529..22c0842 100644 --- a/dist/disqusjs.css +++ b/dist/disqusjs.css @@ -1,6 +1 @@ -/*! - * DisqusJS - Default Theme | v1.2.6 - * Author: SukkaW - * Link: https://github.com/SukkaW/DisqusJS - * License: MIT - */#dsqjs *{margin:0;padding:0}#dsqjs a{text-decoration:none;color:#076dd0}#dsqjs .dsqjs-hide{display:none!important}#dsqjs .dsqjs-disabled{cursor:not-allowed;opacity:.5}#dsqjs #dsqjs-msg{text-align:center;margin-top:4px;margin-bottom:4px;font-size:14px}#dsqjs #dsqjs-msg .dsqjs-msg-btn{cursor:pointer}#dsqjs .dsqjs-bullet{line-height:1.4;margin:0 2px}#dsqjs .dsqjs-bullet::after{color:#c2c6cc;content:"·";font-weight:700}#dsqjs .dsqjs-clearfix:after,#dsqjs .dsqjs-clearfix:before{display:table;content:"";line-height:0;clear:both}#dsqjs .dsqjs-nav{position:relative;margin:0 0 20px;border-bottom:2px solid #e7e9ee}#dsqjs ol,#dsqjs ul{list-style:none;list-style-type:none}#dsqjs .dsqjs-no-comment{text-align:center;font-size:16px;line-height:1.5;word-wrap:break-word;overflow:hidden;color:#2a2e2e;margin-bottom:6px}#dsqjs .dsqjs-nav-tab{float:left;text-transform:capitalize;font-size:15px;padding:12px 0;color:#656c7a;display:block;margin:0 15px 0 0;font-weight:700;line-height:1;position:relative;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#dsqjs .dsqjs-nav-tab:last-child{margin:0}#dsqjs .dsqjs-tab-active{color:#2a2e2e}#dsqjs .dsqjs-tab-active>span:after{content:" ";display:block;height:2px;background-color:#076dd0!important;position:absolute;bottom:-2px;left:0;right:0}#dsqjs .dsqjs-post-list .dsqjs-post-item{position:relative;margin-bottom:16px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar{float:left;margin-right:10px;position:relative;background:#dbdfe4;padding:0;display:block;border-radius:4px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar img{width:44px;height:44px;display:block;border-radius:4px}#dsqjs .dsqjs-post-list .dsqjs-post-header{line-height:1;font-size:14px;margin-bottom:3px}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-post-author{color:#656c7a;font-weight:700}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-admin-badge{color:#fff;background:#687a86;padding:1px 3px;margin-left:4px;font-size:12px;line-height:1;font-weight:700;border-radius:3px;display:inline-block;position:relative;top:-1px;left:1px}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-meta{display:inline-block;font-size:12px;color:#656c7a}#dsqjs .dsqjs-post-body{font-size:15px;line-height:1.5;word-wrap:break-word;overflow:hidden;color:#2a2e2e}#dsqjs .dsqjs-post-body code{padding:.2em .4em;margin:0;font-size:85%;background:#f5f5f5;color:inherit;border-radius:3px}#dsqjs .dsqjs-post-body pre{padding:.5em;overflow:auto;font-size:85%;line-height:1.45;border-radius:3px;background:#f5f5f5;margin:.5em 0}#dsqjs .dsqjs-post-body blockquote{padding:0 .8em;margin:.5em 0;color:#6a737d;border-left:.25em solid #dfe2e5}#dsqjs .dsqjs-post-body p:last-child{margin:0}#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:30px}@media (min-width:768px){#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:48px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar{margin-right:12px}#dsqjs .dsqjs-post-list .dsqjs-post-item{margin-bottom:20px}}@media (min-width:1024px){#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:60px}}#dsqjs .dsqjs-post-list.dsqjs-children .dsqjs-post-avatar img{width:38px;height:38px}#dsqjs .dsqjs-load-more{font-size:14px;font-weight:400;display:block;text-align:center;padding:11px 14px;margin:0 0 24px;background:#687a86;color:#fff;cursor:pointer}#dsqjs .dsqjs-load-more:hover{opacity:.8}#dsqjs footer{text-align:right;line-height:1.5;padding-top:12px;font-weight:700;font-size:16px;color:#555}#dsqjs .dsqjs-disqus-logo{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 438 80'%3e%3cpath fill='%23575B5D' d='M30.2 1.6H1v76h28.9C57 77.6 73 61.3 73 39.4v-.2c0-22-15.7-37.6-42.9-37.6zm21.3 38.1c0 12.3-8.4 19.3-21 19.3H22V20.3h8.5c12.6 0 21 7 21 19.2v.2zm35.6 38h21.2V1.5H87.1v76zm70-47.4c-10.4-2.4-13-4-13-7.4v-.2c0-2.7 2.4-5 7.6-5 6.7 0 14.3 2.7 21.2 7.6l10.6-14.9A47.9 47.9 0 0 0 152.2.3c-18.3 0-29.4 10.2-29.4 24.3v.2c0 15.7 12.4 20.3 28.6 24 10.4 2.3 12.9 4 12.9 7.2v.2c0 3.3-3 5.2-8.7 5.2-8.8 0-17.2-3.1-24.7-9l-11.7 14a53.1 53.1 0 0 0 35.6 12.5c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7zm120.7 9.3v-.2A39.5 39.5 0 0 0 236.9.1c-23.4 0-41 17.7-41 39.5v.2a39.5 39.5 0 0 0 40.8 39.4c8.7 0 16.6-2.5 23.1-6.8l8.4 7.5L279 68.1l-7.9-6.6a38 38 0 0 0 6.8-21.9zm-21.4.5c0 2.6-.5 5-1.3 7.3l-10.4-9.3-10.6 12 10.5 9a21.7 21.7 0 0 1-7.7 1.4c-11.6 0-19.4-9.7-19.4-20.7v-.2c0-11 7.7-20.5 19.2-20.5 11.7 0 19.7 9.7 19.7 20.7v.3zm83.5 4.3c0 10.6-5.5 15.6-14 15.6s-14-5.2-14-16.1V1.6h-21.4v42.7C290.5 68 304 79 325.7 79s35.6-10.8 35.6-35.3V1.5h-21.4v42.8zm68.9-14.1c-10.6-2.4-13.2-4-13.2-7.4v-.2c0-2.7 2.5-5 7.6-5 6.8 0 14.4 2.7 21.3 7.6l10.6-14.9A47.9 47.9 0 0 0 403.8.3c-18.3 0-29.5 10.2-29.5 24.3v.2c0 15.7 12.5 20.3 28.7 24 10.3 2.3 12.8 4 12.8 7.2v.2c0 3.3-3 5.3-8.7 5.3-8.8 0-17.1-3.2-24.6-9.2l-11.7 14A53.1 53.1 0 0 0 406.4 79c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7z'/%3e%3c/svg%3e");background-position:50% 50%;background-repeat:no-repeat;display:inline-block;height:12px;width:65.7px}#dsqjs .dsqjs-order{display:-webkit-box;display:-ms-flexbox;display:flex;float:right;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-top:10px;margin-bottom:12px}#dsqjs .dsqjs-order-radio{display:none}#dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label{color:#fff;background-color:#888}#dsqjs .dsqjs-order-label{display:block;height:20px;line-height:20px;margin-right:10px;font-size:12px;border-radius:2px;padding:0 5px;background-color:#dcdcdc;cursor:pointer}#dsqjs p.dsqjs-has-more{margin-bottom:24px;margin-left:48px;font-size:13px;line-height:15px}#dsqjs p.dsqjs-has-more a.dsqjs-has-more-btn{color:#656c7a;text-decoration:underline;cursor:pointer} \ No newline at end of file +/*! DisqusJS - Default Theme | v1.3.0 | Sukka (https://skk.moe) | https://disqusjs.skk.moe | MIT License */#dsqjs *{margin:0;padding:0}#dsqjs a{text-decoration:none;color:#076dd0}#dsqjs .dsqjs-hide{display:none!important}#dsqjs .dsqjs-disabled{cursor:not-allowed;opacity:.5}#dsqjs #dsqjs-msg{text-align:center;margin-top:4px;margin-bottom:4px;font-size:14px}#dsqjs #dsqjs-msg .dsqjs-msg-btn{cursor:pointer}#dsqjs .dsqjs-bullet{line-height:1.4;margin:0 2px}#dsqjs .dsqjs-bullet::after{color:#c2c6cc;content:"·";font-weight:700}#dsqjs .dsqjs-clearfix:after,#dsqjs .dsqjs-clearfix:before{display:table;content:"";line-height:0;clear:both}#dsqjs .dsqjs-nav{position:relative;margin:0 0 20px;border-bottom:2px solid #e7e9ee}#dsqjs ol,#dsqjs ul{list-style:none;list-style-type:none}#dsqjs .dsqjs-no-comment{text-align:center;font-size:16px;line-height:1.5;word-wrap:break-word;overflow:hidden;color:#2a2e2e;margin-bottom:6px}#dsqjs .dsqjs-nav-tab{float:left;text-transform:capitalize;font-size:15px;padding:12px 8px;color:#656c7a;display:block;margin:0 15px 0 0;font-weight:700;line-height:1;position:relative;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#dsqjs .dsqjs-nav-tab:last-child{margin:0}#dsqjs .dsqjs-tab-active{color:#2a2e2e}#dsqjs .dsqjs-tab-active>span:after{content:" ";display:block;height:2px;background-color:#076dd0!important;position:absolute;bottom:-5px;left:0;right:0}#dsqjs .dsqjs-post-list .dsqjs-post-item{position:relative;margin-bottom:16px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar{float:left;margin-right:10px;position:relative;background:#dbdfe4;padding:0;display:block;border-radius:4px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar img{width:44px;height:44px;display:block;border-radius:4px}#dsqjs .dsqjs-post-list .dsqjs-post-header{line-height:1;font-size:14px;margin-bottom:3px}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-post-author{color:#656c7a;font-weight:700}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-admin-badge{color:#fff;background:#687a86;padding:1px 3px;margin-left:4px;font-size:12px;line-height:1;font-weight:700;border-radius:3px;display:inline-block;position:relative;top:-1px;left:1px}#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-meta{display:inline-block;font-size:12px;color:#656c7a}#dsqjs .dsqjs-post-body{font-size:15px;line-height:1.5;word-wrap:break-word;overflow:hidden;color:#2a2e2e}#dsqjs .dsqjs-post-body code{padding:.2em .4em;margin:0;font-size:85%;background:#f5f5f5;color:inherit;border-radius:3px}#dsqjs .dsqjs-post-body pre{padding:.5em;overflow:auto;font-size:85%;line-height:1.45;border-radius:3px;background:#f5f5f5;margin:.5em 0}#dsqjs .dsqjs-post-body blockquote{padding:0 .8em;margin:.5em 0;color:#6a737d;border-left:.25em solid #dfe2e5}#dsqjs .dsqjs-post-body p:last-child{margin:0}#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:30px}@media (min-width:768px){#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:48px}#dsqjs .dsqjs-post-list .dsqjs-post-avatar{margin-right:12px}#dsqjs .dsqjs-post-list .dsqjs-post-item{margin-bottom:20px}}@media (min-width:1024px){#dsqjs .dsqjs-post-list.dsqjs-children>li{margin-left:60px}}#dsqjs .dsqjs-post-list.dsqjs-children .dsqjs-post-avatar img{width:38px;height:38px}#dsqjs .dsqjs-load-more{font-size:14px;font-weight:400;display:block;text-align:center;padding:11px 14px;margin:0 0 24px;background:#687a86;color:#fff;cursor:pointer}#dsqjs .dsqjs-load-more:hover{opacity:.8}#dsqjs footer{text-align:right;line-height:1.5;padding-top:10px;padding-right:10px;border-top:2px solid #e7e9ee;margin-top:12px;font-weight:700;font-size:16px;color:#555}#dsqjs .dsqjs-disqus-logo{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 438 80'%3e%3cpath fill='%23575B5D' d='M30.2 1.6H1v76h28.9C57 77.6 73 61.3 73 39.4v-.2c0-22-15.7-37.6-42.9-37.6zm21.3 38.1c0 12.3-8.4 19.3-21 19.3H22V20.3h8.5c12.6 0 21 7 21 19.2v.2zm35.6 38h21.2V1.5H87.1v76zm70-47.4c-10.4-2.4-13-4-13-7.4v-.2c0-2.7 2.4-5 7.6-5 6.7 0 14.3 2.7 21.2 7.6l10.6-14.9A47.9 47.9 0 0 0 152.2.3c-18.3 0-29.4 10.2-29.4 24.3v.2c0 15.7 12.4 20.3 28.6 24 10.4 2.3 12.9 4 12.9 7.2v.2c0 3.3-3 5.2-8.7 5.2-8.8 0-17.2-3.1-24.7-9l-11.7 14a53.1 53.1 0 0 0 35.6 12.5c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7zm120.7 9.3v-.2A39.5 39.5 0 0 0 236.9.1c-23.4 0-41 17.7-41 39.5v.2a39.5 39.5 0 0 0 40.8 39.4c8.7 0 16.6-2.5 23.1-6.8l8.4 7.5L279 68.1l-7.9-6.6a38 38 0 0 0 6.8-21.9zm-21.4.5c0 2.6-.5 5-1.3 7.3l-10.4-9.3-10.6 12 10.5 9a21.7 21.7 0 0 1-7.7 1.4c-11.6 0-19.4-9.7-19.4-20.7v-.2c0-11 7.7-20.5 19.2-20.5 11.7 0 19.7 9.7 19.7 20.7v.3zm83.5 4.3c0 10.6-5.5 15.6-14 15.6s-14-5.2-14-16.1V1.6h-21.4v42.7C290.5 68 304 79 325.7 79s35.6-10.8 35.6-35.3V1.5h-21.4v42.8zm68.9-14.1c-10.6-2.4-13.2-4-13.2-7.4v-.2c0-2.7 2.5-5 7.6-5 6.8 0 14.4 2.7 21.3 7.6l10.6-14.9A47.9 47.9 0 0 0 403.8.3c-18.3 0-29.5 10.2-29.5 24.3v.2c0 15.7 12.5 20.3 28.7 24 10.3 2.3 12.8 4 12.8 7.2v.2c0 3.3-3 5.3-8.7 5.3-8.8 0-17.1-3.2-24.6-9.2l-11.7 14A53.1 53.1 0 0 0 406.4 79c18.5 0 30.7-9.2 30.7-24.7V54c0-14.3-10.8-20-28.3-23.7z'/%3e%3c/svg%3e");background-position:50% 50%;background-repeat:no-repeat;display:inline-block;height:12px;width:65.7px}#dsqjs .dsqjs-order{display:-webkit-box;display:-ms-flexbox;display:flex;float:right;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-top:10px;margin-bottom:12px}#dsqjs .dsqjs-order-radio{display:none}#dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label{color:#fff;background-color:#888}#dsqjs .dsqjs-order-label{display:block;height:20px;line-height:20px;margin-right:10px;font-size:12px;border-radius:2px;padding:0 5px;background-color:#dcdcdc;cursor:pointer}#dsqjs p.dsqjs-has-more{margin-bottom:24px;margin-left:48px;font-size:13px;line-height:15px}#dsqjs p.dsqjs-has-more a.dsqjs-has-more-btn{color:#656c7a;text-decoration:underline;cursor:pointer} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index c102870..23a1265 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,7 +11,7 @@ - +