fix 代码段背景显示

This commit is contained in:
deepzz0 committed 2016-10-12 23:31:42 +08:00
1 parent c24fa8bb22
commit cbaa123b22
1 file changed
+1 -1
+1 -1
View File
@@ -1,3 +1,3 @@
{{define "blog_js"}}
$(".entry-content > pre code").each(function(i,block){hljs.highlightBlock(block)});var stringProto=String.prototype;stringProto.stripTags=function(){return this.replace(/<[^>]*>/gi,"")},stringProto.decode4Html=function(){var t=document.createElement("div");return t.innerHTML=this.stripTags(),t.childNodes[0]?t.childNodes[0].nodeValue||"":""},function(t){t.disqus_shortname="deepzz",$.each(["CURRENT_PAGE","CDN_DOMAIN"],function(a,e){t[e]="";var s=$("#"+e);s&&(t[e]=s.val())})}(this),function(t){function a(a){var e,s,n={selector:null,height:200};n=$.extend(n,a),e=n.height,s=function(){var a=$(t).scrollTop(),s=$(t).height()+a;$(n.selector).find("img[data-src]").each(function(){var t=$(this);setTimeout(function(){var n,i=t.offset(),o=t.height();i.top>s+e||i.top+o<a-e||(n=t.data("src"),n&&(t.on("load",function(){t.addClass("loaded")}),t.attr("src",n),t.removeAttr("data-src")))},0)})},$(t).on("resize",s),$(t).on("scroll",s),s()}t.lazyLoad=a}(this),function(t){function a(a){var e='<li class="post" id="post-'+a.id+'"><div class="post-content clearfix"><div class="indicator"></div><div class="avatar"><div class="user">'+(a.url?'<a href="'+a.url+'"><img data-src="'+a.avatar+'" /></a>':'<img data-src="'+t.CDN_DOMAIN+'/static/img/default_avatar.png" />')+'</div></div><div class="post-body"><header class="post-header"><span class="post-byline"><span class="author publisher-anchor-color">'+(a.url?'<a href="'+a.url+'">'+a.name+"</a>":a.name)+'</span></span><span class="post-meta"><span class="bullet"> • </span><a data-id="'+a.id+'" href="'+location.href.replace(/#.*$/,"")+"#comment-"+a.id+'" class="time-ago" title="'+a.createdAt+'">'+a.createdAtStr+'</a></span></header><div class="post-body-inner">'+a.message+'</div></div></div><ul class="children" data-id="'+a.id+'"></ul></li>';return e}function e(t){for(;t.length;){var e=[];t.forEach(function(t){var s=t.parent,n=i.find('ul[data-id="'+s+'"]');return n.length?void n.append(a(t)):void e.push(t)}),t=e}}function s(t){var a="";a=t.comments.length?'<div class="thread"><header><nav class="nav clearfix"><ul><li class="nav-tab tab-conversation active"><a class="publisher-nav-color"><span>'+t.total+' </span>Comments</span></a></li></ul></nav></header><section><ul class="post-list" data-id="0"></ul><div class="load-more"><a href="#" class="btn">Load more comments</a></div></section></div>':'<p class="no-result">没有找到任何评论数据~<br /><br /><a href="#disqus_thread">点此发表评论 \xbb</a></p>',i.html(a)}function n(){if(!o){o=!0;var a;a=r?"/disqus/"+t.simple_config.id+"/"+encodeURIComponent(r):"/disqus/"+t.simple_config.id,$.get(a,{},function(a){var n;o=!1,a&&0==a.errno?(r?e(a.data.comments):(s(a.data),e(a.data.comments),$(t).trigger("hashchange","scrollIntoView")),n=i.find(".load-more a"),a.data.next?n.removeClass("busy"):n.hide(),r=a.data.next,$(t).trigger("scroll")):i.html('<p class="no-result">获取数据失败,请稍后再试!</p>')})}}var i=$("#simple_thread"),o=!1,r="";i.on("click",".load-more a",function(t){t.preventDefault(),$(this).addClass("busy"),n()}).on("click",".time-ago",function(t){t.preventDefault(),location.hash="simple-"+$(this).data("id")}),$(t).on("hashchange",function(a,e){var s,n=location.hash.match(/#(?:comment|simple)-(\d+)/);n&&(s=i.find("#post-"+n[1]),s.length&&(i.find(".post-content.target").removeClass("target"),s.find("> .post-content").addClass("target"),e&&$(t).scrollTop(s.offset().top-90)))}),/(iPhone|Android)/.test(navigator.userAgent)&&i.addClass("mobile"),t.initSimpleThread=n}(window,document),function(t,a){return"127.0.0.1"!=a.domain&&"deepzz.com"!=a.domain?void (location.href=location.href.replace(/(https?:\/\/[^\/]+)\//i,"//deepzz.com/")):void $(function(){lazyLoad({selector:"#content",height:100}),function(){var t=$("#content"),a=t.find("img"),e=t.width();a.each(function(){var t=$(this),a=0|t.attr("width"),s=0|t.attr("height"),n=t.prop("complete");a>e&&t.attr("height",Math.ceil(s/a*e)),t.prop("src")&&(n?t.addClass("loaded"):t.on("load",function(){t.addClass("loaded")}))})}(),function(){if("search-post"==CURRENT_PAGE){var t=$("#keyword");t.val()||t.focus()}}(),function(){var a,e,s,n=$("#disqus_thread"),i=$("#simple_thread"),o=!1,r=!1,c=$("#switch_thread_mode");c.length&&(t.disqus_config=function(){this.language="en",this.page.url=n.data("url"),this.page.identifier=n.data("identifier")},t.simple_config={id:i.data("id")},a=function(){n.show(),i.hide(),c.html('「<a href="#simple_thread">切换到评论浏览模式</a>」'),localStorage.comment_type="disqus_thread",o||(o=!0,n.html("评论加载中...<br /><br />注:如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理;或者切换到评论浏览模式。"),$.ajax({url:t.CDN_DOMAIN+"/static/js/disqus_f7ce60.js",dataType:"script",cache:!0}))},e=function(){n.hide(),i.show(),c.html('「<a href="#disqus_thread">切换到评论完整模式</a>」'),localStorage.comment_type="simple_thread",r||(r=!0,i.html("评论加载中...<br /><br />注Line truncated
var stringProto=String.prototype;stringProto.stripTags=function(){return this.replace(/<[^>]*>/gi,"")},stringProto.decode4Html=function(){var t=document.createElement("div");return t.innerHTML=this.stripTags(),t.childNodes[0]?t.childNodes[0].nodeValue||"":""},function(t){t.disqus_shortname="deepzz",$.each(["CURRENT_PAGE","CDN_DOMAIN"],function(a,e){t[e]="";var s=$("#"+e);s&&(t[e]=s.val())})}(this),function(t){function a(a){var e,s,n={selector:null,height:200};n=$.extend(n,a),e=n.height,s=function(){var a=$(t).scrollTop(),s=$(t).height()+a;$(n.selector).find("img[data-src]").each(function(){var t=$(this);setTimeout(function(){var n,i=t.offset(),o=t.height();i.top>s+e||i.top+o<a-e||(n=t.data("src"),n&&(t.on("load",function(){t.addClass("loaded")}),t.attr("src",n),t.removeAttr("data-src")))},0)})},$(t).on("resize",s),$(t).on("scroll",s),s()}t.lazyLoad=a}(this),function(t){function a(a){var e='<li class="post" id="post-'+a.id+'"><div class="post-content clearfix"><div class="indicator"></div><div class="avatar"><div class="user">'+(a.url?'<a href="'+a.url+'"><img data-src="'+a.avatar+'" /></a>':'<img data-src="'+t.CDN_DOMAIN+'/static/img/default_avatar.png" />')+'</div></div><div class="post-body"><header class="post-header"><span class="post-byline"><span class="author publisher-anchor-color">'+(a.url?'<a href="'+a.url+'">'+a.name+"</a>":a.name)+'</span></span><span class="post-meta"><span class="bullet"> • </span><a data-id="'+a.id+'" href="'+location.href.replace(/#.*$/,"")+"#comment-"+a.id+'" class="time-ago" title="'+a.createdAt+'">'+a.createdAtStr+'</a></span></header><div class="post-body-inner">'+a.message+'</div></div></div><ul class="children" data-id="'+a.id+'"></ul></li>';return e}function e(t){for(;t.length;){var e=[];t.forEach(function(t){var s=t.parent,n=i.find('ul[data-id="'+s+'"]');return n.length?void n.append(a(t)):void e.push(t)}),t=e}}function s(t){var a="";a=t.comments.length?'<div class="thread"><header><nav class="nav clearfix"><ul><li class="nav-tab tab-conversation active"><a class="publisher-nav-color"><span>'+t.total+' </span>Comments</span></a></li></ul></nav></header><section><ul class="post-list" data-id="0"></ul><div class="load-more"><a href="#" class="btn">Load more comments</a></div></section></div>':'<p class="no-result">没有找到任何评论数据~<br /><br /><a href="#disqus_thread">点此发表评论 \xbb</a></p>',i.html(a)}function n(){if(!o){o=!0;var a;a=r?"/disqus/"+t.simple_config.id+"/"+encodeURIComponent(r):"/disqus/"+t.simple_config.id,$.get(a,{},function(a){var n;o=!1,a&&0==a.errno?(r?e(a.data.comments):(s(a.data),e(a.data.comments),$(t).trigger("hashchange","scrollIntoView")),n=i.find(".load-more a"),a.data.next?n.removeClass("busy"):n.hide(),r=a.data.next,$(t).trigger("scroll")):i.html('<p class="no-result">获取数据失败,请稍后再试!</p>')})}}var i=$("#simple_thread"),o=!1,r="";i.on("click",".load-more a",function(t){t.preventDefault(),$(this).addClass("busy"),n()}).on("click",".time-ago",function(t){t.preventDefault(),location.hash="simple-"+$(this).data("id")}),$(t).on("hashchange",function(a,e){var s,n=location.hash.match(/#(?:comment|simple)-(\d+)/);n&&(s=i.find("#post-"+n[1]),s.length&&(i.find(".post-content.target").removeClass("target"),s.find("> .post-content").addClass("target"),e&&$(t).scrollTop(s.offset().top-90)))}),/(iPhone|Android)/.test(navigator.userAgent)&&i.addClass("mobile"),t.initSimpleThread=n}(window,document),function(t,a){return"127.0.0.1"!=a.domain&&"deepzz.com"!=a.domain?void (location.href=location.href.replace(/(https?:\/\/[^\/]+)\//i,"//deepzz.com/")):void $(function(){lazyLoad({selector:"#content",height:100}),function(){var t=$("#content"),a=t.find("img"),e=t.width();a.each(function(){var t=$(this),a=0|t.attr("width"),s=0|t.attr("height"),n=t.prop("complete");a>e&&t.attr("height",Math.ceil(s/a*e)),t.prop("src")&&(n?t.addClass("loaded"):t.on("load",function(){t.addClass("loaded")}))})}(),function(){if("search-post"==CURRENT_PAGE){var t=$("#keyword");t.val()||t.focus()}}(),function(){var a,e,s,n=$("#disqus_thread"),i=$("#simple_thread"),o=!1,r=!1,c=$("#switch_thread_mode");c.length&&(t.disqus_config=function(){this.language="en",this.page.url=n.data("url"),this.page.identifier=n.data("identifier")},t.simple_config={id:i.data("id")},a=function(){n.show(),i.hide(),c.html('「<a href="#simple_thread">切换到评论浏览模式</a>」'),localStorage.comment_type="disqus_thread",o||(o=!0,n.html("评论加载中...<br /><br />注:如果长时间无法加载,请针对 disq.us | disquscdn.com | disqus.com 启用代理;或者切换到评论浏览模式。"),$.ajax({url:t.CDN_DOMAIN+"/static/js/disqus_f7ce60.js",dataType:"script",cache:!0}))},e=function(){n.hide(),i.show(),c.html('「<a href="#disqus_thread">切换到评论完整模式</a>」'),localStorage.comment_type="simple_thread",r||(r=!0,i.html("评论加载中...<br /><br />注:本模式仅供浏览,如需发表评论请切换到评论完整模式。"),t.inLine truncated
{{end}}