From e5c9f6909981917cb6e09e2ce5d35733ec8889b7 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Fri, 12 Oct 2018 11:55:09 +0800 Subject: [PATCH] release 0.2.0 --- README.md | 8 ++++---- dist/disqus.js | 4 ++-- dist/disqusjs.css | 4 ++-- docs/index.html | 4 ++-- package.json | 2 +- src/disqus.js | 2 +- src/disqusjs.css | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7217a67..7600613 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,12 @@ ```html - - + + - - + + ``` 在需要显示评论的地方插入下述代码: diff --git a/dist/disqus.js b/dist/disqus.js index c1fecd9..5f33a50 100644 --- a/dist/disqus.js +++ b/dist/disqus.js @@ -1,6 +1,6 @@ /*! - * DisqusJS | v0.1.4 + * DisqusJS | v0.2.0 * Author: SukkaW * Link: https://github.com/SukkaW/DisqusJS * License: GPL-3.0 - */"use strict";!function(){disqusjs.page=[],window.disqus_config=function(){this.page.url=disqusjs.config.url,this.page.identifier=disqusjs.config.identifier};var e=new XMLHttpRequest,i=function(s,e){try{localStorage.setItem(s,e)}catch(s){console.log(s),console.log("Failed to set localStorage item")}};Date.prototype.Format=function(s){var e={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var t in/(y+)/.test(s)&&(s=s.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),e)new RegExp("("+t+")").test(s)&&(s=s.replace(RegExp.$1,1==RegExp.$1.length?e[t]:("00"+e[t]).substr((""+e[t]).length)));return s};var t=function(){var e=new Image,t=setTimeout(function(){e.onerror=e.onload=null,i("disqusjs_mode","dsqjs")},2e3);e.onerror=function(){clearTimeout(t),i("disqusjs_mode","dsqjs"),u()},e.onload=function(){clearTimeout(t);var s=setTimeout(function(){e.onerror=e.onload=null,i("disqusjs_mode","dsqjs")},2e3);e.onerror=function(){clearTimeout(s),i("disqusjs_mode","dsqjs"),u()},e.onload=function(){clearTimeout(s),i("disqusjs_mode","disqus"),u()},e.src="https://"+disqusjs.config.shortname+".disqus.com/favicon.ico?"+ +new Date},e.src="https://disqus.com/favicon.ico?"+ +new Date},a=function(){i("disqusjs_mode","dsqjs"),u()},n=function(){i("disqusjs_mode","disqus"),u()},o=function(){document.getElementById("dsqjs-load-error").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-loading-dsqjs").classList.add("dsqjs-hide"),document.getElementById("dsqjs-reload").addEventListener("click",d)},d=function(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",n),document.getElementById("dsqjs-reload-disqus").addEventListener("click",t);var s=disqusjs.config.api+"3.0/threads/list.json?forum="+disqusjs.config.shortname+"&thread=ident:"+disqusjs.config.identifier+"&api_key="+disqusjs.config.apikey;e.open("GET",s,!0),e.timeout=4e3,e.send(),e.onload=function(){if(200==this.status||304==this.status){var s=JSON.parse(this.responseText).response;if(console.log(s.length),1===s.length){var e=s[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},r()}else document.getElementById("dsqjs-thread-not-init").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-init-thread").addEventListener("click",n)}},e.ontimeout=function(s){o()},e.onerror=function(s){o()}},r=function(){var s=disqusjs.config.api+"3.0/posts/list.json?forum="+disqusjs.config.shortname+"&thread="+disqusjs.page.id+"&api_key="+disqusjs.config.apikey;e.open("GET",s,!0),e.timeout=4e3,e.send(),e.onload=function(){if(200==this.status||304==this.status){var s=JSON.parse(this.responseText);0===s.code&&0
'.concat(s.avatarEl,'
').concat(s.authorEl,'
').concat(s.message,"
")};s.map(function(s){var e=s.comment;e.author.profileUrl?(e.avatarEl=''),e.authorEl='').concat(e.author.name,"")):(e.avatarEl=''),e.authorEl="".concat(e.author.name)),s.isPrimary&&(e.authorEl+=''.concat(disqusjs.config.adminLabel,"")),s.children&&(s.nesting=1);var t='
  • ');t+=n(e),t+="".concat(function t(s){var i=s.nesting,e=s.children||[];if("null"!=typeof e){if(i<4)var a='
      ';else a='
        ';return e.map(function(s){var e=s.comment;e.author.profileUrl?(e.avatarEl=''),e.authorEl='').concat(e.author.name,"")):(e.avatarEl=''),e.authorEl="".concat(e.author.name)),s.isPrimary&&(e.authorEl+=''.concat(disqusjs.config.adminLabel,"")),s.nesting=i+1,a+='
      • '),a+=n(e),a+="".concat(t(s),"
      • ")}),0!==(a+="
      ").length?a:void 0}}(s),""),document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",t)})},u=function(){var s;document.getElementById("disqus_thread").innerHTML='

      评论完整模式加载中...如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理,或使用评论基础模式

      你可能无法访问 Disqus,已启用评论基础模式。如需完整体验请针对 disq.us | disquscdn.com | disqus.com 启用代理并尝试完整 Disqus 模式 | 强制完整 Disqus 模式

      该 Thread 并没有初始化,是否 切换到完整 Disqus 模式 进行初始化?

      评论基础模式出现错误,是否重载

      这里冷冷清清的,一条评论都没有

        ',disqusjs.mode=(s="disqusjs_mode",localStorage.getItem(s)),"disqus"===disqusjs.mode?function(){var s=document;s.getElementById("dsqjs-load-disqus").classList.remove("dsqjs-hide"),s.getElementById("dsqjs-force-dsqjs").addEventListener("click",a);var e=s.createElement("script");e.src="https://"+disqusjs.config.shortname+".disqus.com/embed.js",e.setAttribute("data-timestamp",+new Date),(s.head||s.body).appendChild(e)}():"dsqjs"===disqusjs.mode?d():t()};u()}(); \ No newline at end of file + */"use strict";!function(){disqusjs.page=[],window.disqus_config=function(){this.page.url=disqusjs.config.url,this.page.identifier=disqusjs.config.identifier};var n=new XMLHttpRequest;function o(s,e){try{localStorage.setItem(s,e)}catch(s){console.log("Failed to set localStorage item")}}function e(){var e=new Image,t=setTimeout(function(){e.onerror=e.onload=null,o("disqusjs_mode","dsqjs")},2e3);e.onerror=function(){clearTimeout(t),o("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(t);var s=setTimeout(function(){e.onerror=e.onload=null,o("disqusjs_mode","dsqjs")},2e3);e.onerror=function(){clearTimeout(s),o("disqusjs_mode","dsqjs"),r()},e.onload=function(){clearTimeout(s),o("disqusjs_mode","disqus"),r()},e.src="https://".concat(disqusjs.config.shortname,".disqus.com/favicon.ico?").concat(+new Date)},e.src="https://disqus.com/favicon.ico?".concat(+new Date)}function t(){o("disqusjs_mode","dsqjs"),r()}function d(){o("disqusjs_mode","disqus"),r()}function i(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-load-error").classList.add("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",d),document.getElementById("dsqjs-reload-disqus").addEventListener("click",e);var s="".concat(disqusjs.config.api,"3.0/threads/list.json?forum=").concat(disqusjs.config.shortname,"&thread=ident:").concat(disqusjs.config.identifier,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",s,!0),n.timeout=4e3,n.send(),n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText).response;if(1===s.length){var e=s[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},function e(s){s=s?"&cursor=".concat(s):"";var t="".concat(disqusjs.config.api,"3.0/posts/list.json?forum=").concat(disqusjs.config.shortname,"&thread=").concat(disqusjs.page.id).concat(s,"&api_key=").concat(disqusjs.config.apikey);n.open("GET",t,!0);n.timeout=4e3;n.send();n.onload=function(){if(200===this.status||304===this.status){var s=JSON.parse(this.responseText);0===s.code&&0'),s.comment.authorEl='').concat(s.comment.author.name,"")):(s.comment.avatarEl=''),s.comment.authorEl="".concat(s.comment.author.name)),s.isPrimary&&(s.comment.authorEl+=''.concat(disqusjs.config.adminLabel,"")),s.children&&(s.nesting=1),s}function i(s){var e,t='
        '.concat(s.avatarEl,'
        ').concat(s.authorEl,'
        ').concat(s.message,"
        ");return t}s.map(function(s){s=d(s);var e='
      • ').concat(i(s.comment)).concat(function e(s){var t=s.nesting,n=s.children||[];if(!n)return;var o=t<4?'
          ':'
            ';o+=n.map(function(s){return(s=d(s)).nesting=t+1,'
          • ').concat(i(s.comment)).concat(e(s),"
          • ")});o+="
          ";return 0!==o.length?o:void 0}(s),"");document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",e)})}(e.map(function(s){return{comment:s,author:s.author.name,isPrimary:s.author.username===disqusjs.config.admin.toLowerCase(),children:function s(e){if(0===d.length)return null;var t=[];for(var n=0;n*{margin:0;padding:0}#dsqjs .dsqjs-container *{margin:0;padding:0}#dsqjs .dsqjs-container{margin:20px 0 0}#dsqjs ul.dsqjs-list{list-style:none;list-style-type:none}#dsqjs .dsqjs-item-container{position:relative;margin-bottom:24px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#dsqjs .dsqjs-item-container:after,#dsqjs .dsqjs-item-container:before{display:table;content:"";line-height:0;clear:both}#dsqjs .dsqjs-avater{margin-right:12px;float:left;position:relative;z-index:100;padding:0}#dsqjs a{text-decoration:none;color:#076dd0}#dsqjs .dsqjs-avater img{width:42px;height:42px;display:block;border-radius:4px}#dsqjs .dsqjs-body{overflow:hidden}#dsqjs .dsqjs-header{line-height:1;font-size:13px}#dsqjs .dsqjs-bullet{line-height:1.4;margin:0 4px}#dsqjs .dsqjs-bullet::after{color:#c2c6cc;content:"•"}#dsqjs .dsqjs-author{line-height:1;color:#2479cc;font-weight:700}#dsqjs .dsqjs-author .dsqjs-admin-badge{color:#fff;background:#687a86;padding:1px 3px;margin-left:4px;font-size:12px;line-height:1.1;font-weight:700;border-radius:3px;display:inline-block;position:relative;top:-1px;left:1px}#dsqjs .dsqjs-meta{font-size:12px;color:#656c7a}#dsqjs .dsqjs-content p:last-child{margin:0}#dsqjs .dsqjs-content p{font-size:15px;line-height:21px;margin:0 0 12px;word-wrap:break-word}#dsqjs .dsqjs-children>.dsqjs-item{margin-left:60px}#dsqjs .dsqjs-children .dsqjs-avater img{width:38px;height:38px}#dsqjs .dsqjs-message{text-align:center;margin-top:4px;margin-bottom:4px;font-size:14px}#dsqjs .dsqjs-no-comment{text-align:center;margin-top:8px;margin-bottom:4px;font-size:18px;font-weight:700}#dsqjs .dsqjs-message a{margin-left:2px;margin-right:2px}.dsqjs-hide{display:none!important}#dsqjs .dsqjs-footer{width:100%;font-weight:700;font-size:14px;color:#555;opacity:.9}#dsqjs .dsqjs-footer .dsqjs-footer-right{text-align:right;float:right;line-height:1.5;padding-right:6px} \ No newline at end of file + */#dsqjs *{margin:0;padding:0;font-family:-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#2a2e2e}#dsqjs code{font-family:"SF Mono","Segoe UI Mono",Consolas,"Roboto Mono","Liberation Mono",Menlo,Courier,'Courier New',monospace!important}#dsqjs ul{list-style:none;list-style-type:none}#dsqjs .dsqjs-container{margin:20px 0 0}#dsqjs .dsqjs-item-container{position:relative;margin-bottom:24px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}#dsqjs .dsqjs-item-container:after,#dsqjs .dsqjs-item-container:before{display:table;content:"";line-height:0;clear:both}#dsqjs .dsqjs-avater{margin-right:12px;float:left;position:relative;z-index:100;padding:0}#dsqjs a{text-decoration:none;color:#076dd0}#dsqjs .dsqjs-avater img{width:42px;height:42px;display:block;border-radius:4px}#dsqjs .dsqjs-body{overflow:hidden}#dsqjs .dsqjs-header{line-height:1;font-size:13px}#dsqjs .dsqjs-bullet{line-height:1.4;margin:0 4px}#dsqjs .dsqjs-bullet::after{color:#c2c6cc;content:"•"}#dsqjs .dsqjs-author{line-height:1;color:#2479cc;font-weight:700}#dsqjs .dsqjs-author .dsqjs-admin-badge{color:#fff;background:#687a86;padding:1px 3px;margin-left:4px;font-size:12px;line-height:1.1;font-weight:700;border-radius:3px;display:inline-block;position:relative;top:-1px;left:1px}#dsqjs .dsqjs-meta{font-size:12px;color:#656c7a}#dsqjs .dsqjs-content p:last-child{margin:0}#dsqjs .dsqjs-content p{font-size:15px;line-height:21px;margin:0 0 12px;word-wrap:break-word}#dsqjs .dsqjs-children>.dsqjs-item{margin-left:60px}#dsqjs .dsqjs-children .dsqjs-avater img{width:38px;height:38px}#dsqjs .dsqjs-message{text-align:center;margin-top:4px;margin-bottom:4px;font-size:14px}#dsqjs .dsqjs-no-comment{text-align:center;margin-top:8px;margin-bottom:4px;font-size:18px;font-weight:700}#dsqjs .dsqjs-message a{margin-left:2px;margin-right:2px;cursor:pointer}#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-hide{display:none!important}#dsqjs .dsqjs-footer{width:100%;font-weight:700;font-size:14px;color:#555;opacity:.9}#dsqjs .dsqjs-footer .dsqjs-footer-right{text-align:right;line-height:1.5;padding-right:6px} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 09c3ecd..0a54e94 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,7 +11,7 @@ - +