compress js

This commit is contained in:
Van 2016-11-09 22:36:08 +08:00
parent 73b2d5bb50
commit 0bd127eff6
7 changed files with 196 additions and 6 deletions

File diff suppressed because one or more lines are too long

17
ease/js/ease.min.js vendored
View File

@ -1 +1,16 @@
var goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},getNextPage=function(){var e=$(".article-next");currentPage+=1;var t="/articles/";if(1===$("#tag").length){var a=location.pathname.split("/");t="/articles/tags/"+a[a.length-1]+"/"}else if(1===$("#archive").length){var a=location.pathname.split("/");t="/articles/archives/"+a[a.length-2]+"/"+a[a.length-1]+"/"}else if(1===$("#author").length){var a=location.pathname.split("/");t="/articles/authors/"+a[a.length-1]+"/"}$.ajax({url:latkeConfig.servePath+t+currentPage,type:"GET",beforeSend:function(){e.css("background","url("+latkeConfig.staticServePath+"/skins/ease/images/ajax-loader.gif) no-repeat scroll center center #fefefe")},success:function(t,a){if(t.sc){for(var i="",r=t.rslts.pagination,n=0;n<t.rslts.articles.length;n++){var l=t.rslts.articles[n],s="";t.rslts.articles.length-1===n&&(s=" article-last"),i+='<li class="article'+s+'"><div class="article-title"><h2><a rel="bookmark" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'">'+l.articleTitle+"</a>",l.hasUpdated&&(i+="<sup>"+Label.updatedLabel+"</sup>"),l.articlePutTop&&(i+="<sup>"+Label.topArticleLabel+"</sup>"),i+='</h2><div class="right"><a rel="nofollow" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'#comments">'+ +l.articleCommentCount+"&nbsp;&nbsp;"+Label.commentLabel+'</a>&nbsp;&nbsp;<a rel="nofollow" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'">'+l.articleViewCount+"&nbsp;&nbsp;"+Label.viewLabel+'</a></div><div class="clear"></div></div><div class="article-body"><div id="abstract'+l.oId+'">'+l.articleAbstract+'</div><div id="content'+l.oId+'" class="none"></div></div><div class="right ft-gray">',i+=l.hasUpdated?Util.toDate(l.articleUpdateTime,"yy-MM-dd HH:mm"):Util.toDate(l.articleCreateTime,"yy-MM-dd HH:mm"),i+=' <a href="'+latkeConfig.servePath+"/authors/"+l.authorId+'">'+l.authorName+'</a></div><div class="left ft-gray">'+Label.tag1Label+" ";for(var o=l.articleTags.split(","),c=0;c<o.length;c++)i+='<a rel="tag" href="'+latkeConfig.servePath+"/tags/"+encodeURIComponent(o[c])+'">'+o[c]+"</a>",c<o.length-1&&(i+=", ");i+='</div><div class="clear"></div></li>'}$(".article-last").removeClass("article-last"),$(".main>.wrapper>ul").append(i),r.paginationPageCount===currentPage?e.remove():e.css("background","none")}}})},ease={$header:$(".header"),headerH:103,$body:$(".main > .wrapper"),$nav:$(".nav"),getCurrentPage:function(){var e=$(".article-next");e.length>0&&(window.currentPage=e.data("page"))},setNavCurrent:function(){$(".nav ul a").each(function(){var e=$(this);e.attr("href")===location.href?e.addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")})},initCommon:function(){Util.init(),Util.replaceSideEm($(".recent-comments-content")),Util.buildTags("tagsSide")},initArchives:function(){var e=$(".archives");if(!(e.length<1)){$(".footer").css("marginTop","30px");for(var t=[],a=e.find("span").each(function(){for(var e=$(this).data("year"),a=!0,i=0;i<t.length;i++)if(e===t[i]){a=!1;break}a&&t.push(e)}),i="",r=0;r<t.length;r++){for(var n="",l=0;l<a.length;l++){var s=$(a[l]);s.data("year")===t[r]&&(n+=s.html())}i+="<div><h3 class='ft-gray'>"+t[r]+"</h3>"+n+"</div>"}e.html(i);for(var o=$(".archives>div"),c=0,h=0,g=[],d=0;d<o.length;d++){for(var f=0;3>f&&!(d>=o.length);f++)o[d].style.left=310*f+"px",c>0?(""!==o[d-3].style.top&&(h=parseInt(o[d-3].style.top)),o[d].style.top=$(o[d-3]).height()+60+h+"px",g[f]=parseInt(o[d].style.top)+$(o[d]).height()+60):g[f]=$(o[d]).height()+60,2>f&&(d+=1);c+=1}e.height(g.sort()[g.length-1])}},scrollEvent:function(){var e=this;$(window).scroll(function(){var t=$(window).scrollTop();if(t>e.headerH){var a=$(window).height(),i=t+a-21;$("body").height()-58<=t+a&&(i=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",i)}else $("#goTop").hide()})},setDynamic:function(){var e=$(".dynamic");if(!($(".dynamic").length<1)){var t=e.find(".side-comments"),a=e.find(".side-tags"),i=e.find(".side-most-comment"),r=e.find(".side-most-view");t.height()>a.height()?a.height(t.height()):t.height(a.height()),i.height()>r.height()?r.height(i.height()):i.height(r.height()),$(".article-body").each(function(){this.innerHTML=Util.replaceEmString($(this).html())})}}};!function(){ease.getCurrentPage(),ease.initCommon(),ease.scrollEvent(),ease.setNavCurrent(),ease.initArchives(),ease.setDynamic()}();
/*
* Copyright (c) 2010-2016, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},getNextPage=function(){var e=$(".article-next");currentPage+=1;var t="/articles/";if(1===$("#tag").length){var a=location.pathname.split("/");t="/articles/tags/"+a[a.length-1]+"/"}else if(1===$("#archive").length){var a=location.pathname.split("/");t="/articles/archives/"+a[a.length-2]+"/"+a[a.length-1]+"/"}else if(1===$("#author").length){var a=location.pathname.split("/");t="/articles/authors/"+a[a.length-1]+"/"}$.ajax({url:latkeConfig.servePath+t+currentPage,type:"GET",beforeSend:function(){e.css("background","url("+latkeConfig.staticServePath+"/skins/ease/images/ajax-loader.gif) no-repeat scroll center center #fefefe")},success:function(t,a){if(t.sc){for(var i="",r=t.rslts.pagination,n=0;n<t.rslts.articles.length;n++){var l=t.rslts.articles[n],s="";t.rslts.articles.length-1===n&&(s=" article-last"),i+='<li class="article'+s+'"><div class="article-title"><h2><a rel="bookmark" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'">'+l.articleTitle+"</a>",l.hasUpdated&&(i+="<sup>"+Label.updatedLabel+"</sup>"),l.articlePutTop&&(i+="<sup>"+Label.topArticleLabel+"</sup>"),i+='</h2><div class="right"><a rel="nofollow" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'#comments">'+ +l.articleCommentCount+"&nbsp;&nbsp;"+Label.commentLabel+'</a>&nbsp;&nbsp;<a rel="nofollow" class="ft-gray" href="'+latkeConfig.servePath+l.articlePermalink+'">'+l.articleViewCount+"&nbsp;&nbsp;"+Label.viewLabel+'</a></div><div class="clear"></div></div><div class="article-body"><div id="abstract'+l.oId+'">'+l.articleAbstract+'</div><div id="content'+l.oId+'" class="none"></div></div><div class="right ft-gray">',i+=l.hasUpdated?Util.toDate(l.articleUpdateTime,"yy-MM-dd HH:mm"):Util.toDate(l.articleCreateTime,"yy-MM-dd HH:mm"),i+=' <a href="'+latkeConfig.servePath+"/authors/"+l.authorId+'">'+l.authorName+'</a></div><div class="left ft-gray">'+Label.tag1Label+" ";for(var o=l.articleTags.split(","),c=0;c<o.length;c++)i+='<a rel="tag" href="'+latkeConfig.servePath+"/tags/"+encodeURIComponent(o[c])+'">'+o[c]+"</a>",c<o.length-1&&(i+=", ");i+='</div><div class="clear"></div></li>'}$(".article-last").removeClass("article-last"),$(".main>.wrapper>ul").append(i),r.paginationPageCount===currentPage?e.remove():e.css("background","none")}}})},ease={$header:$(".header"),headerH:103,$body:$(".main > .wrapper"),$nav:$(".nav"),getCurrentPage:function(){var e=$(".article-next");e.length>0&&(window.currentPage=e.data("page"))},setNavCurrent:function(){$(".nav ul a").each(function(){var e=$(this);e.attr("href")===location.href?e.addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")})},initCommon:function(){Util.init(),Util.replaceSideEm($(".recent-comments-content")),Util.buildTags("tagsSide")},initArchives:function(){var e=$(".archives");if(!(e.length<1)){$(".footer").css("marginTop","30px");for(var t=[],a=e.find("span").each(function(){for(var e=$(this).data("year"),a=!0,i=0;i<t.length;i++)if(e===t[i]){a=!1;break}a&&t.push(e)}),i="",r=0;r<t.length;r++){for(var n="",l=0;l<a.length;l++){var s=$(a[l]);s.data("year")===t[r]&&(n+=s.html())}i+="<div><h3 class='ft-gray'>"+t[r]+"</h3>"+n+"</div>"}e.html(i);for(var o=$(".archives>div"),c=0,h=0,g=[],d=0;d<o.length;d++){for(var f=0;f<3&&!(d>=o.length);f++)o[d].style.left=310*f+"px",c>0?(""!==o[d-3].style.top&&(h=parseInt(o[d-3].style.top)),o[d].style.top=$(o[d-3]).height()+60+h+"px",g[f]=parseInt(o[d].style.top)+$(o[d]).height()+60):g[f]=$(o[d]).height()+60,f<2&&(d+=1);c+=1}e.height(g.sort()[g.length-1])}},scrollEvent:function(){var e=this;$(window).scroll(function(){var t=$(window).scrollTop();if(t>e.headerH){var a=$(window).height(),i=t+a-21;$("body").height()-58<=t+a&&(i=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",i)}else $("#goTop").hide()})},setDynamic:function(){var e=$(".dynamic");if(!($(".dynamic").length<1)){var t=e.find(".side-comments"),a=e.find(".side-tags"),i=e.find(".side-most-comment"),r=e.find(".side-most-view");t.height()>a.height()?a.height(t.height()):t.height(a.height()),i.height()>r.height()?r.height(i.height()):i.height(r.height()),$(".article-body").each(function(){this.innerHTML=Util.replaceEmString($(this).html())})}}};!function(){ease.getCurrentPage(),ease.initCommon(),ease.scrollEvent(),ease.setNavCurrent(),ease.initArchives(),ease.setDynamic()}();

View File

@ -1 +1,16 @@
var Finding={init:function(){Util.killIE(),this._initToc(),$(".scroll-down").click(function(t){t.preventDefault();var o=$(this),n=$("html, body"),a=o.attr("data-offset")?o.attr("data-offset"):!1,i=parseInt(a);n.stop(!0,!1).animate({scrollTop:$(this.hash).offset().top+i},500)}),$("body").click(function(t){0===$(t.target).closest(".nav").length&&$("body").hasClass("nav-opened")&&!$(t.target).hasClass("icon-gotop")&&$("body").removeClass("nav-opened").addClass("nav-closed")}),$(".menu-button").click(function(t){t.stopPropagation(),$("body").toggleClass("nav-opened nav-closed")}),$("body").append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a>'),$(window).scroll(function(){$(window).scrollTop()>$(window).height()?$(".icon-gotop").show():$(".icon-gotop").hide()})},_initToc:function(){return 0===$(".b3-solo-list").length?($(".nav .icon-sitemap, .nav .icon-list").show(),!1):($(".nav .icon-sitemap, .nav .icon-list").show(),$(".nav ul:first").hide(),$(".nav ul:first").after($(".b3-solo-list")),void $("body").toggleClass("nav-opened nav-closed"))},tabNav:function(t){$(".nav .current").removeClass("current"),"toc"===t?($(".nav ul:first").hide(),$(".nav ul:last").show(),$(".icon-list").addClass("current")):($(".nav ul:first").show(),$(".nav ul:last").hide(),$(".icon-sitemap").addClass("current"))},share:function(){$(".share span").click(function(){var t=$(this).data("type"),o=encodeURIComponent($("title").text()),n=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,a=$(".post-content img:eq(0)").attr("src"),i={};i.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+n+"&pic="+a,i.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+n+"&pic="+a,i.google="https://plus.google.com/share?url="+n,i.twitter="https://twitter.com/intent/tweet?status="+o+" "+n,window.open(i[t],"_blank","top=100,left=200,width=648,height=618")})}};Finding.init();
/*
* Copyright (c) 2010-2016, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Finding={init:function(){Util.killIE(),this._initToc(),$(".scroll-down").click(function(t){t.preventDefault();var o=$(this),n=$("html, body"),a=!!o.attr("data-offset")&&o.attr("data-offset"),i=parseInt(a);n.stop(!0,!1).animate({scrollTop:$(this.hash).offset().top+i},500)}),$("body").click(function(t){0===$(t.target).closest(".nav").length&&$("body").hasClass("nav-opened")&&!$(t.target).hasClass("icon-gotop")&&$("body").removeClass("nav-opened").addClass("nav-closed")}),$(".menu-button").click(function(t){t.stopPropagation(),$("body").toggleClass("nav-opened nav-closed")}),$("body").append('<a class="icon-gotop fn-none" href="javascript:Util.goTop()"></a>'),$(window).scroll(function(){$(window).scrollTop()>$(window).height()?$(".icon-gotop").show():$(".icon-gotop").hide()})},_initToc:function(){return 0===$(".b3-solo-list").length?($(".nav .icon-sitemap, .nav .icon-list").show(),!1):($(".nav .icon-sitemap, .nav .icon-list").show(),$(".nav ul:first").hide(),$(".nav ul:first").after($(".b3-solo-list")),void $("body").toggleClass("nav-opened nav-closed"))},tabNav:function(t){$(".nav .current").removeClass("current"),"toc"===t?($(".nav ul:first").hide(),$(".nav ul:last").show(),$(".icon-list").addClass("current")):($(".nav ul:first").show(),$(".nav ul:last").hide(),$(".icon-sitemap").addClass("current"))},share:function(){$(".share span").click(function(){var t=$(this).data("type"),o=encodeURIComponent($("title").text()),n=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,a=$(".post-content img:eq(0)").attr("src"),i={};i.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+o+"&url="+n+"&pic="+a,i.weibo="http://v.t.sina.com.cn/share/share.php?title="+o+"&url="+n+"&pic="+a,i.google="https://plus.google.com/share?url="+n,i.twitter="https://twitter.com/intent/tweet?status="+o+" "+n,window.open(i[t],"_blank","top=100,left=200,width=648,height=618")})}};Finding.init();

File diff suppressed because one or more lines are too long

View File

@ -1 +1,16 @@
/*
* Copyright (c) 2010-2016, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var goTop=function(e){e=e||.1;var a=$(window).scrollTop(),t=1+e;if(window.scrollTo(0,Math.floor(a/t)),a>0){var n="goTop("+e+")";window.setTimeout(n,16)}},collapseArchive=function(e,a){var t=!0;"collapse-ico"===e.className?(e.className="expand-ico",t=!1):e.className="collapse-ico",$("#archiveSide li").each(function(){var e=$(this);e.data("year")===a&&(t?$(this).show():$(this).hide())})},getArticle=function(e,a){var t=$("#abstract"+a),n=$("#content"+a);return""===n.html()?$.ajax({url:"/get-article-content?id="+a,type:"GET",dataType:"html",beforeSend:function(){t.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(a,i){e.className="collapse-ico",n.html(a),t.hide().css("background","none"),n.fadeIn("slow")}}):"expand-ico"===e.className?(t.hide(),n.fadeIn(),e.className="collapse-ico"):(n.hide(),t.fadeIn(),e.className="expand-ico"),!1},goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)};!function(){$(window).scroll(function(){var e=$(window).scrollTop();if(e>182){var a=$(window).height(),t=e+a-21;$("body").height()-58<=e+a&&(t=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",t)}else $("#goTop").hide()});var e=(new Date).getFullYear(),a=e;$("#archiveSide li").each(function(t){var n=$(this);n.data("year")!==e&&$(this).hide(),a!==n.data("year")&&(a=n.data("year"),n.before("<li class='archive-year'><div onclick='collapseArchive(this, "+a+")' class='expand-ico'>"+a+"&nbsp;年</div></li>"))}),$(".recent-comments .expand-ico").click(function(){"expand-ico"===this.className?($(this).parent().next().css({height:"auto","white-space":"normal"}),this.className="collapse-ico"):($(this).parent().next().animate({height:"18px"},function(){$(this).css("white-space","nowrap")}),this.className="expand-ico")}),$(".nav ul li").each(function(){var e=$(this).find("a");e.attr("href")===latkeConfig.servePath+location.pathname?$(this).addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")}),Util.init(),Util.replaceSideEm($(".recent-comments-content")),Util.buildTags("tagsSide"),$(".recent-comments .recent-comments-main").each(function(){$(this).find(".recent-comments-content>a").height()<30?$(this).find(".expand-ico").remove():$(this).find(".expand-ico").parent().next().css({"white-space":"nowrap"})})}();

File diff suppressed because one or more lines are too long

17
yilia/js/yilia.min.js vendored
View File

@ -1 +1,16 @@
var Yilia={init:function(){Util.killIE(),this._initToc(),this.resetTags(),$(window).scroll(function(){$("article").length>0&&0===$("article.post").length&&$("article:not(.show)").each(function(){$(this).offset().top<=$(window).scrollTop()+$(window).height()-$(this).height()/7&&$(this).addClass("show")}),$(window).scrollTop()>$(window).height()?$(".icon-goup").show():$(".icon-goup").hide(),1===$("article.post").length&&$("article.post").addClass("show")}),$(window).scroll()},_initToc:function(){return 0===$(".b3-solo-list li").length?!1:($(".side footer").after('<div class="toc"><a href="javascript:$(\'.side .toc\').hide()" class="close">X</a></div>'),$(".side .toc a").after($(".b3-solo-list")),void $(".side .toc-btn").show())},resetTags:function(){$("a.tag").each(function(t){$(this).addClass("color"+Math.ceil(4*Math.random()))})},share:function(){$(".share span").click(function(){var t=$(this).data("type"),i=encodeURIComponent($("title").text()),o=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,e=$(".post-content img:eq(0)").attr("src"),s={};s.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+i+"&url="+o+"&pic="+e,s.weibo="http://v.t.sina.com.cn/share/share.php?title="+i+"&url="+o+"&pic="+e,s.google="https://plus.google.com/share?url="+o,s.twitter="https://twitter.com/intent/tweet?status="+i+" "+o,window.open(s[t],"_blank","top=100,left=200,width=648,height=618")})}};Yilia.init();
/*
* Copyright (c) 2010-2016, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Yilia={init:function(){Util.killIE(),this._initToc(),this.resetTags(),$(window).scroll(function(){$("article").length>0&&0===$("article.post").length&&$("article:not(.show)").each(function(){$(this).offset().top<=$(window).scrollTop()+$(window).height()-$(this).height()/7&&$(this).addClass("show")}),$(window).scrollTop()>$(window).height()?$(".icon-goup").show():$(".icon-goup").hide(),1===$("article.post").length&&$("article.post").addClass("show")}),$(window).scroll()},_initToc:function(){return 0!==$(".b3-solo-list li").length&&($(".side footer").after('<div class="toc"><a href="javascript:$(\'.side .toc\').hide()" class="close">X</a></div>'),$(".side .toc a").after($(".b3-solo-list")),void $(".side .toc-btn").show())},resetTags:function(){$("a.tag").each(function(t){$(this).addClass("color"+Math.ceil(4*Math.random()))})},share:function(){$(".share span").click(function(){var t=$(this).data("type"),i=encodeURIComponent($("title").text()),o=$(".post-title a").attr("href")?$(".post-title a").attr("href"):location,e=$(".post-content img:eq(0)").attr("src"),s={};s.tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+i+"&url="+o+"&pic="+e,s.weibo="http://v.t.sina.com.cn/share/share.php?title="+i+"&url="+o+"&pic="+e,s.google="https://plus.google.com/share?url="+o,s.twitter="https://twitter.com/intent/tweet?status="+i+" "+o,window.open(s[t],"_blank","top=100,left=200,width=648,height=618")})}};Yilia.init();