Commit 73ab6437 authored by Van's avatar Van

🐛 Bubble skin

parent 1e2106e7
var Page=function(t){this.currentCommentId="",this.tips=t};$.extend(Page.prototype,{share:function(){var t=$(".article__share");if(0!==t.length){var e=t.find(".item__qr"),o=t.data("url"),i=t.data("avatar"),n=encodeURIComponent(t.data("title")+" - "+t.data("blogtitle")),r=encodeURIComponent(o),a={};a.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+n+"&url="+r+"&pic="+i,a.weibo="http://v.t.sina.com.cn/share/share.php?title="+n+"&url="+r+"&pic="+i,a.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+r+"&sharesource=qzone&title="+n+"&pics="+i,a.twitter="https://twitter.com/intent/tweet?status="+n+" "+r,t.find("span").click(function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===e.find("canvas").length?(Util.addScript(Label.staticServePath+"/js/lib/jquery.qrcode.min.js","qrcodeScript"),e.qrcode({width:128,height:128,text:o})):e.slideToggle(),!1):void window.open(a[t],"_blank","top=100,left=200,width=648,height=618")})}},load:function(){var t=this;$("#comment").click(function(){t.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){t.toggleEditor()}),$("#soloEditorAdd").click(function(){t.submitComment()})},toggleEditor:function(t,e){var o=$("#soloEditor");if(0!==o.length){if(!$("#soloEditorComment").hasClass("vditor")){Util.addScript("https://cdn.jsdelivr.net/npm/vditor@1.5.12/dist/index.min.js","vditorScript"),window.vditor=new Vditor("soloEditorComment",{placeholder:this.tips.commentContentCannotEmptyLabel,height:180,tab:"\t",hint:{emojiPath:Label.staticServePath+"/images/emoji"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:Label.servePath+"/console/markdown/2html",hljs:{enable:!0,style:Label.hljsStyle},parse:function(t){"none"!==t.style.display&&Util.parseLanguage()}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:Label.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"]}),vditor.focus()}"0px"===$("body").css("padding-bottom")||t?($("#soloEditorError").text(""),o.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=t,$("#soloEditorReplyTarget").text(e?"@"+e:""),"undefined"!=typeof vditor&&vditor.focus()):(o.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0))}else location.href=Label.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(t,e){var o=t.randomArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],a=r.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+Label.servePath+r.articlePermalink+"'>"+a+"</a></li>"}var l=(s||"<h4>"+c+"</h4>")+"<ul>"+i+"</ul>";$("#randomArticles").append(l)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(t,s){$.ajax({url:Label.servePath+"/article/id/"+t+"/relevant/articles",type:"GET",success:function(t,e){var o=t.relevantArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],a=r.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+Label.servePath+r.articlePermalink+"'>"+a+"</a></li>"}var l=s+"<ul>"+i+"</ul>";$("#relevantArticles").append(l)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(t,s){var c=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+t+"&blogHost="+c.blogHost+"&paginationPageSize="+c.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(t,e){var o=t.articles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],a=r.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' target='_blank' href='"+r.articlePermalink+"'>"+a+"</a></li>"}var l=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+i+"</ul>";$("#externalRelevantArticles").append(l)}else $("#externalRelevantArticles").remove()}})}catch(t){}},submitComment:function(){var e=this,t=this.tips;if(1<vditor.getValue().length&&vditor.getValue().length<500){$("#soloEditorAdd").attr("disabled","disabled");var o={oId:t.oId,commentContent:vditor.getValue()};this.currentCommentId&&(o.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:Label.servePath+"/article/comments",cache:!1,contentType:"application/json",data:JSON.stringify(o),success:function(t){$("#soloEditorAdd").removeAttr("disabled"),t.sc?(e.toggleEditor(),vditor.setValue(""),e.addCommentAjax(t.cmtTpl)):$("#soloEditorError").html(t.msg)}})}else $("#soloEditorError").text(e.tips.commentContentCannotEmptyLabel)},addReplyForm:function(t,e){this.currentCommentId=t,this.toggleEditor(t,e)},hideComment:function(t){$("#commentRef"+t).hide()},showComment:function(t,e,o,i){var n=parseInt($(t).position().top);if(i&&(n=parseInt($(t).parents(i).position().top)),0<$("#commentRef"+e).length)$("#commentRef"+e).show().css("top",n+o+"px");else{var r=$("#"+e).clone();r.addClass("comment-body-ref").attr("id","commentRef"+e),r.find("#replyForm").remove(),$("#comments").append(r),$("#commentRef"+e).css("top",n+o+"px")}},addCommentAjax:function(t){0<$("#comments").children().length?$($("#comments").children()[0]).before(t):$("#comments").html(t),Util.parseMarkdown(),Util.parseLanguage(),window.location.hash="#comments"}});
\ No newline at end of file
var Page=function(t){this.currentCommentId="",this.tips=t};$.extend(Page.prototype,{share:function(){var t=$(".article__share");if(0!==t.length){var e=t.find(".item__qr"),o=t.data("url"),i=t.data("avatar"),n=encodeURIComponent(t.data("title")+" - "+t.data("blogtitle")),r=encodeURIComponent(o),l={};l.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+n+"&url="+r+"&pic="+i,l.weibo="http://v.t.sina.com.cn/share/share.php?title="+n+"&url="+r+"&pic="+i,l.qqz="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+r+"&sharesource=qzone&title="+n+"&pics="+i,l.twitter="https://twitter.com/intent/tweet?status="+n+" "+r,t.find("span").click(function(){var t=$(this).data("type");if(t)return"wechat"===t?(0===e.find("canvas").length?(Util.addScript(Label.staticServePath+"/js/lib/jquery.qrcode.min.js","qrcodeScript"),e.qrcode({width:128,height:128,text:o})):e.slideToggle(),!1):void window.open(l[t],"_blank","top=100,left=200,width=648,height=618")})}},load:function(){var t=this;$("#comment").click(function(){t.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){t.toggleEditor()}),$("#soloEditorAdd").click(function(){t.submitComment()})},toggleEditor:function(t,e){var o=$("#soloEditor");if(0!==o.length){if(!$("#soloEditorComment").hasClass("vditor")){Util.addScript("https://cdn.jsdelivr.net/npm/vditor@1.5.12/dist/index.min.js","vditorScript");var i=["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"],n=!0;$(window).width()<768&&(n=!(i=["emoji","line","quote","list","ordered-list","check","link","preview","info","help"])),window.vditor=new Vditor("soloEditorComment",{placeholder:this.tips.commentContentCannotEmptyLabel,height:180,tab:"\t",hint:{emojiPath:Label.staticServePath+"/images/emoji"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:Label.servePath+"/console/markdown/2html",hljs:{enable:!0,style:Label.hljsStyle},parse:function(t){"none"!==t.style.display&&Util.parseLanguage()}},counter:500,resize:{enable:n,position:"top"},lang:Label.langLabel,toolbar:i}),vditor.focus()}"-300px"===o.css("bottom")||t?($("#soloEditorError").text(""),$(window).width()<768?o.css({top:"0",bottom:"auto",opacity:1}):o.css({bottom:"0",top:"auto",opacity:1}),this.currentCommentId=t,$("#soloEditorReplyTarget").text(e?"@"+e:""),"undefined"!=typeof vditor&&vditor.focus()):o.css({bottom:"-300px",top:"auto",opacity:0})}else location.href=Label.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(t,e){var o=t.randomArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],l=r.articleTitle;i+="<li><a rel='nofollow' title='"+l+"' href='"+Label.servePath+r.articlePermalink+"'>"+l+"</a></li>"}var a=(s||"<h4>"+c+"</h4>")+"<ul>"+i+"</ul>";$("#randomArticles").append(a)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(t,s){$.ajax({url:Label.servePath+"/article/id/"+t+"/relevant/articles",type:"GET",success:function(t,e){var o=t.relevantArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],l=r.articleTitle;i+="<li><a rel='nofollow' title='"+l+"' href='"+Label.servePath+r.articlePermalink+"'>"+l+"</a></li>"}var a=s+"<ul>"+i+"</ul>";$("#relevantArticles").append(a)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(t,s){var c=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+t+"&blogHost="+c.blogHost+"&paginationPageSize="+c.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(t,e){var o=t.articles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var r=o[n],l=r.articleTitle;i+="<li><a rel='nofollow' title='"+l+"' target='_blank' href='"+r.articlePermalink+"'>"+l+"</a></li>"}var a=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+i+"</ul>";$("#externalRelevantArticles").append(a)}else $("#externalRelevantArticles").remove()}})}catch(t){}},submitComment:function(){var e=this,t=this.tips;if(1<vditor.getValue().length&&vditor.getValue().length<500){$("#soloEditorAdd").attr("disabled","disabled");var o={oId:t.oId,commentContent:vditor.getValue()};this.currentCommentId&&(o.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:Label.servePath+"/article/comments",cache:!1,contentType:"application/json",data:JSON.stringify(o),success:function(t){$("#soloEditorAdd").removeAttr("disabled"),t.sc?(e.toggleEditor(),vditor.setValue(""),e.addCommentAjax(t.cmtTpl)):$("#soloEditorError").html(t.msg)}})}else $("#soloEditorError").text(e.tips.commentContentCannotEmptyLabel)},addReplyForm:function(t,e){this.currentCommentId=t,this.toggleEditor(t,e)},hideComment:function(t){$("#commentRef"+t).hide()},showComment:function(t,e,o,i){var n=parseInt($(t).position().top);if(i&&(n=parseInt($(t).parents(i).position().top)),0<$("#commentRef"+e).length)$("#commentRef"+e).show().css("top",n+o+"px");else{var r=$("#"+e).clone();r.addClass("comment-body-ref").attr("id","commentRef"+e),r.find("#replyForm").remove(),$("#comments").append(r),$("#commentRef"+e).css("top",n+o+"px")}},addCommentAjax:function(t){0<$("#comments").children().length?$($("#comments").children()[0]).before(t):$("#comments").html(t),Util.parseMarkdown(),Util.parseLanguage(),window.location.hash="#comments"}});
\ No newline at end of file
Subproject commit 82ff77d95c54a44fe5ac5267755d0f92ea9ba976
Subproject commit e3ec33eb9941962ba62703bf229d6412beccb9e5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment