From f8998561c53b695693000f83ecdd361423626881 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 8 Oct 2018 21:45:29 +0800 Subject: [PATCH] fix: btn href to #disqus_thread --- dist/disqus.js | 2 +- package.json | 2 +- src/disqus.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/disqus.js b/dist/disqus.js index ad6ea8a..dee93ae 100644 --- a/dist/disqus.js +++ b/dist/disqus.js @@ -6,4 +6,4 @@ * Link: https://github.com/SukkaW/DisqusJS * License: GPL-3.0 */ -function(){disqusjs.page=[],window.disqus_config=function(){this.page.url=disqusjs.config.url,this.page.identifier=disqusjs.config.identifier};var s=new XMLHttpRequest,n=function(e,s){try{localStorage.setItem(e,s)}catch(e){console.log(e),console.log("Failed to set localStorage item")}};Date.prototype.Format=function(e){var s={"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(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),s)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[t]:("00"+s[t]).substr((""+s[t]).length)));return e};var t=function(){var s=new Image,t=setTimeout(function(){s.onerror=s.onload=null,n("disqusjs_mode","dsqjs")},2e3);s.onerror=function(){clearTimeout(t),n("disqusjs_mode","dsqjs"),u()},s.onload=function(){clearTimeout(t);var e=setTimeout(function(){s.onerror=s.onload=null,n("disqusjs_mode","dsqjs")},2e3);s.onerror=function(){clearTimeout(e),n("disqusjs_mode","dsqjs"),u()},s.onload=function(){clearTimeout(e),n("disqusjs_mode","disqus"),u()},s.src="https://"+disqusjs.config.shortname+".disqus.com/favicon.ico?"+ +new Date},s.src="https://disqus.com/favicon.ico?"+ +new Date},a=function(){n("disqusjs_mode","dsqjs"),u()},o=function(){n("disqusjs_mode","disqus"),u()},i=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",r)},r=function(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",o),document.getElementById("dsqjs-reload-disqus").addEventListener("click",t);var e=disqusjs.config.api+"3.0/threads/list.json?forum="+disqusjs.config.shortname+"&thread=ident:"+disqusjs.config.identifier+"&api_key="+disqusjs.config.apikey;s.open("GET",e,!0),s.timeout=4e3,s.send(),s.onload=function(){if(200==this.status||304==this.status){var e=JSON.parse(this.responseText).response[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},d()}},s.ontimeout=function(e){i()},s.onerror=function(e){i()}},d=function(){var e=disqusjs.config.api+"3.0/posts/list.json?forum="+disqusjs.config.shortname+"&thread="+disqusjs.page.id+"&api_key="+disqusjs.config.apikey;s.open("GET",e,!0),s.timeout=4e3,s.send(),s.onload=function(){if(200==this.status||304==this.status){var e=JSON.parse(this.responseText);0===e.code&&0'),s.authorEl='').concat(s.author.name,"")):(s.avatarEl=''),s.authorEl="".concat(s.author.name)),s.author.name===disqusjs.config.admin&&(s.authorEl+=''.concat(disqusjs.config.adminLabel,"")),e.children&&(e.nesting=1);var t='
  • ');t+=baidu.template(o,s),t+="".concat(function t(e){var n=e.nesting,s=e.children||[];if("null"!=typeof s){if(n<4)var a='
      ';else a='
        ';return s.map(function(e){var s=e.comment;s.author.profileUrl?(s.avatarEl=''),s.authorEl='').concat(s.author.name,"")):(s.avatarEl=''),s.authorEl="".concat(s.author.name)),s.author.name===disqusjs.config.admin&&(s.authorEl+=''.concat(disqusjs.config.adminLabel,"")),e.nesting=n+1,a+='
      • '),a+=baidu.template(o,s),a+="".concat(t(e),"
      • ")}),0!==(a+="
      ").length?a:void 0}}(e),""),document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",t)})},u=function(){var e;document.getElementById("disqus_thread").innerHTML='

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

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

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

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

        ',disqusjs.mode=(e="disqusjs_mode",localStorage.getItem(e)),"disqus"===disqusjs.mode?function(){var e=document;e.getElementById("dsqjs-load-disqus").classList.remove("dsqjs-hide"),e.getElementById("dsqjs-force-dsqjs").addEventListener("click",a);var s=e.createElement("script");s.src="https://"+disqusjs.config.shortname+".disqus.com/embed.js",s.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(s)}():"dsqjs"===disqusjs.mode?r():t()};u()}(); \ No newline at end of file +function(){disqusjs.page=[],window.disqus_config=function(){this.page.url=disqusjs.config.url,this.page.identifier=disqusjs.config.identifier};var s=new XMLHttpRequest,n=function(e,s){try{localStorage.setItem(e,s)}catch(e){console.log(e),console.log("Failed to set localStorage item")}};Date.prototype.Format=function(e){var s={"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(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),s)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[t]:("00"+s[t]).substr((""+s[t]).length)));return e};var t=function(){var s=new Image,t=setTimeout(function(){s.onerror=s.onload=null,n("disqusjs_mode","dsqjs")},2e3);s.onerror=function(){clearTimeout(t),n("disqusjs_mode","dsqjs"),u()},s.onload=function(){clearTimeout(t);var e=setTimeout(function(){s.onerror=s.onload=null,n("disqusjs_mode","dsqjs")},2e3);s.onerror=function(){clearTimeout(e),n("disqusjs_mode","dsqjs"),u()},s.onload=function(){clearTimeout(e),n("disqusjs_mode","disqus"),u()},s.src="https://"+disqusjs.config.shortname+".disqus.com/favicon.ico?"+ +new Date},s.src="https://disqus.com/favicon.ico?"+ +new Date},a=function(){n("disqusjs_mode","dsqjs"),u()},o=function(){n("disqusjs_mode","disqus"),u()},i=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",r)},r=function(){document.getElementById("dsqjs-loading-dsqjs").classList.remove("dsqjs-hide"),document.getElementById("dsqjs-force-disqus").addEventListener("click",o),document.getElementById("dsqjs-reload-disqus").addEventListener("click",t);var e=disqusjs.config.api+"3.0/threads/list.json?forum="+disqusjs.config.shortname+"&thread=ident:"+disqusjs.config.identifier+"&api_key="+disqusjs.config.apikey;s.open("GET",e,!0),s.timeout=4e3,s.send(),s.onload=function(){if(200==this.status||304==this.status){var e=JSON.parse(this.responseText).response[0];disqusjs.page={id:e.id,title:e.title,isClosed:e.isClosed,length:e.posts},d()}},s.ontimeout=function(e){i()},s.onerror=function(e){i()}},d=function(){var e=disqusjs.config.api+"3.0/posts/list.json?forum="+disqusjs.config.shortname+"&thread="+disqusjs.page.id+"&api_key="+disqusjs.config.apikey;s.open("GET",e,!0),s.timeout=4e3,s.send(),s.onload=function(){if(200==this.status||304==this.status){var e=JSON.parse(this.responseText);0===e.code&&0'),s.authorEl='').concat(s.author.name,"")):(s.avatarEl=''),s.authorEl="".concat(s.author.name)),s.author.name===disqusjs.config.admin&&(s.authorEl+=''.concat(disqusjs.config.adminLabel,"")),e.children&&(e.nesting=1);var t='
      • ');t+=baidu.template(o,s),t+="".concat(function t(e){var n=e.nesting,s=e.children||[];if("null"!=typeof s){if(n<4)var a='
          ';else a='
            ';return s.map(function(e){var s=e.comment;s.author.profileUrl?(s.avatarEl=''),s.authorEl='').concat(s.author.name,"")):(s.avatarEl=''),s.authorEl="".concat(s.author.name)),s.author.name===disqusjs.config.admin&&(s.authorEl+=''.concat(disqusjs.config.adminLabel,"")),e.nesting=n+1,a+='
          • '),a+=baidu.template(o,s),a+="".concat(t(e),"
          • ")}),0!==(a+="
          ").length?a:void 0}}(e),""),document.getElementById("dsqjs-list").insertAdjacentHTML("beforeend",t)})},u=function(){var e;document.getElementById("disqus_thread").innerHTML='

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

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

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

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

            ',disqusjs.mode=(e="disqusjs_mode",localStorage.getItem(e)),"disqus"===disqusjs.mode?function(){var e=document;e.getElementById("dsqjs-load-disqus").classList.remove("dsqjs-hide"),e.getElementById("dsqjs-force-dsqjs").addEventListener("click",a);var s=e.createElement("script");s.src="https://"+disqusjs.config.shortname+".disqus.com/embed.js",s.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(s)}():"dsqjs"===disqusjs.mode?r():t()};u()}(); \ No newline at end of file diff --git a/package.json b/package.json index 9a7face..7d09d03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "disqusjs", - "version": "0.1.0-alpha-8", + "version": "0.1.0-alpha-9", "description": "Show comments list from Disqus API", "main": "dist/disqus.js", "scripts": { diff --git a/src/disqus.js b/src/disqus.js index b60ba12..090d1e7 100644 --- a/src/disqus.js +++ b/src/disqus.js @@ -609,15 +609,15 @@
            -

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

            -

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

            -

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

            +

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

            +

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

            +

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

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

              */ - var disqusjsBaseTpl = `

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

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

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

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

                `; + var disqusjsBaseTpl = `

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

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

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

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

                  `; document.getElementById('disqus_thread').innerHTML = disqusjsBaseTpl; disqusjs.mode = getLS('disqusjs_mode');