From 096ab6c1f2ca154a4be107c9560dbdb3b5682b9c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 23 Feb 2013 12:01:30 +0800 Subject: [PATCH] compress --- community/css/community.min.css | 4 +- ease/js/ease.min.js | 21 +- neoease/js/neoease.min.js | 21 +- timeline/css/timeline.min.css | 2 +- timeline/js/timeline.js | 848 ++++++++++++++++---------------- timeline/js/timeline.min.js | 21 +- 6 files changed, 429 insertions(+), 488 deletions(-) diff --git a/community/css/community.min.css b/community/css/community.min.css index 0df4a13..34ad079 100644 --- a/community/css/community.min.css +++ b/community/css/community.min.css @@ -7,8 +7,8 @@ a:hover{text-decoration:underline;} .content>h2{margin:-20px 0 20px 0;} .hr{background:url("../images/indentline-light.png") repeat-x scroll left top transparent;margin:20px 0 40px;clear:both;height:2px;} .arrow-right{background:url("../images/icon.png") 0px -64px no-repeat;float:left;height:38px;width:14px;} -input[type='button']{border-radius:5px;box-shadow:0 1px 0 rgba(255, 255, 255, 0.3) inset,0 0 2px rgba(255, 255, 255, 0.3) inset,0 1px 2px rgba(0, 0, 0, 0.29);background-color:#000000;background-image:linear-gradient(top, #333333, #000000);background-image:-moz-linear-gradient(top, #333333, #000000);background-image:-ms-linear-gradient(top, #333333, #000000);background-image:-o-linear-gradient(top, #333333, #000000);background-image:-webkit-gradient(linear, left top, left bottom, from(#333333), to(#000000));filter:progid:dximagetransform.microsoft.gradient(startColorstr='#333333', endColorstr='#000000');border:1px solid #000000;color:white;margin:15px 0 0 200px;padding:7px 13px;height:auto;} -input[type='button']:hover{background-color:#333333;background-image:linear-gradient(top, #333333, #212121);background-image:-moz-linear-gradient(top, #333333, #212121);background-image:-ms-linear-gradient(top, #333333, #212121);background-image:-o-linear-gradient(top, #333333, #212121);background-image:-webkit-gradient(linear, left top, left bottom, from(#333333), to(#212121));filter:progid:dximagetransform.microsoft.gradient(startColorstr='#333333', endColorstr='#212121');} +input[type='button']{border-radius:5px;box-shadow:0 1px 0 rgba(255, 255, 255, 0.3) inset,0 0 2px rgba(255, 255, 255, 0.3) inset,0 1px 2px rgba(0, 0, 0, 0.29);background-color:#000000;background-image:linear-gradient(top, #333333, #000000);background-image:-moz-linear-gradient(top, #333333, #000000);background-image:-ms-linear-gradient(top, #333333, #000000);background-image:-o-linear-gradient(top, #333333, #000000);background-image:-webkit-gradient(linear, left top, left bottom, from(#333333), to(#000000));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#000000');border:1px solid #000000;color:white;margin:15px 0 0 200px;padding:7px 13px;height:auto;} +input[type='button']:hover{background-color:#333333;background-image:linear-gradient(top, #333333, #212121);background-image:-moz-linear-gradient(top, #333333, #212121);background-image:-ms-linear-gradient(top, #333333, #212121);background-image:-o-linear-gradient(top, #333333, #212121);background-image:-webkit-gradient(linear, left top, left bottom, from(#333333), to(#212121));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#212121');} .marginBottom40{margin-bottom:40px;} .header-user{background-color:#DEDEDE;padding-top:1px;} .header-navi{background:url("../images/icon.png") 0px -130px repeat-x #333333;margin-bottom:50px;} diff --git a/ease/js/ease.min.js b/ease/js/ease.min.js index 3ccd9d9..60ae32a 100644 --- a/ease/js/ease.min.js +++ b/ease/js/ease.min.js @@ -1,20 +1 @@ -/* - * Copyright (c) 2009, 2010, 2011, 2012, B3log Team - * - * 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. - *//** - * @fileoverview ease js. - * - * @author Liyuan Li - * @version 1.0.1.5, Jan 29, 2013 - */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($("#tag").length===1){var n=location.pathname.split("/");t="/articles/tags/"+n[n.length-1]+"/"}else if($("#archive").length===1){var n=location.pathname.split("/");t="/articles/archives/"+n[n.length-2]+"/"+n[n.length-1]+"/"}else if($("#author").length===1){var n=location.pathname.split("/");t="/articles/authors/"+n[n.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,n){if(!t.sc)return;var r="",i=t.rslts.pagination;for(var s=0;s'+'
'+"

"+''+o.articleTitle+"",o.hasUpdated&&(r+=""+Label.updatedLabel+""),o.articlePutTop&&(r+=""+Label.topArticleLabel+""),r+='

"+'
'+"
"+'
'+'
'+o.articleAbstract+"
"+'
'+"
"+'
',o.hasUpdated?r+=Util.toDate(o.articleUpdateTime,"yy-MM-dd HH:mm"):r+=Util.toDate(o.articleCreateTime,"yy-MM-dd HH:mm"),r+=' '+o.authorName+""+"
"+'
'+Label.tag1Label+" ";var a=o.articleTags.split(",");for(var f=0;f
"}e.html(r);var a=$(".archives>div"),f=0,l=0,c=[];for(var h=0;h=a.length)break;a[h].style.left=p*310+"px",f>0?(a[h-3].style.top!==""&&(l=parseInt(a[h-3].style.top)),a[h].style.top=$(a[h-3]).height()+60+l+"px",c[p]=parseInt(a[h].style.top)+$(a[h]).height()+60):c[p]=$(a[h]).height()+60,p<2&&(h+=1)}f+=1}e.height(c.sort()[c.length-1])},scrollEvent:function(){var e=this;$(window).scroll(function(){var t=$(window).scrollTop(),n=0;$("#top").css("display")==="block"&&(n=$("#top").height()),t>=e.headerH+n?(e.$nav.css("position","fixed"),e.$body.css("marginTop","55px")):(e.$nav.css("position","inherit"),e.$body.css("marginTop","0"));if(t>e.headerH){var r=$(window).height(),i=t+r-21;$("body").height()-58<=t+r&&(i=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",i)}else $("#goTop").hide()})},setDynamic:function(){var e=$(".dynamic");if($(".dynamic").length<1)return;var t=e.find(".side-comments"),n=e.find(".side-tags"),r=e.find(".side-most-comment"),i=e.find(".side-most-view");t.height()>n.height()?n.height(t.height()):t.height(n.height()),r.height()>i.height()?i.height(r.height()):r.height(i.height()),$(".article-body").each(function(){this.innerHTML=Util.replaceEmString($(this).html())})},scrollToCmt:function(){$(window.location.hash).length==1&&$(window).scrollTop($(window.location.hash).offset().top-60)}};(function(){ease.getCurrentPage(),ease.initCommon(),ease.scrollEvent(),ease.setNavCurrent(),ease.initArchives(),ease.setDynamic()})(); \ No newline at end of file +var goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)};var getNextPage=function(){var $more=$(".article-next");currentPage+=1;var path="/articles/";if($("#tag").length===1){var pathnames=location.pathname.split("/");path="/articles/tags/"+pathnames[pathnames.length-1]+"/"}else if($("#archive").length===1){var pathnames=location.pathname.split("/");path="/articles/archives/"+pathnames[pathnames.length-2]+"/"+pathnames[pathnames.length-1]+"/"}else if($("#author").length===1){var pathnames=location.pathname.split("/");path="/articles/authors/"+pathnames[pathnames.length-1]+"/"}$.ajax({url:latkeConfig.servePath+path+currentPage,type:"GET",beforeSend:function(){$more.css("background","url("+latkeConfig.staticServePath+"/skins/ease/images/ajax-loader.gif) no-repeat scroll center center #fefefe")},success:function(result,textStatus){if(!result.sc){return}var articlesHTML="",pagination=result.rslts.pagination;for(var i=0;i'+'
'+"

"+''+article.articleTitle+"";if(article.hasUpdated){articlesHTML+=""+Label.updatedLabel+""}if(article.articlePutTop){articlesHTML+=""+Label.topArticleLabel+""}articlesHTML+="

"+'"+'
'+"
"+'
'+'
'+article.articleAbstract+"
"+'
'+"
"+'
';if(article.hasUpdated){articlesHTML+=Util.toDate(article.articleUpdateTime,"yy-MM-dd HH:mm")}else{articlesHTML+=Util.toDate(article.articleCreateTime,"yy-MM-dd HH:mm")}articlesHTML+=' '+article.authorName+""+"
"+'
'+Label.tag1Label+" ";var articleTags=article.articleTags.split(",");for(var j=0;j
'+""}$(".article-last").removeClass("article-last");$(".main>.wrapper>ul").append(articlesHTML);if(pagination.paginationPageCount===currentPage){$more.remove()}else{$more.css("background","none")}}})};var ease={$header:$(".header"),headerH:103,$body:$(".main > .wrapper"),$nav:$(".nav"),getCurrentPage:function(){var $next=$(".article-next");if($next.length>0){window.currentPage=$next.data("page")}},setNavCurrent:function(){$(".nav ul a").each(function(){var $this=$(this);if($this.attr("href")===latkeConfig.servePath+location.pathname){$this.addClass("current")}else if(/\/[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 $archives=$(".archives");if($archives.length<1){return}$(".footer").css("marginTop","30px");var years=[],$archiveList=$archives.find("span").each(function(){var year=$(this).data("year"),tag=true;for(var i=0;i

"+years[j]+"

"+monthsHTML+""}$archives.html(yearsHTML);var $items=$(".archives>div"),line=0,top=0,heights=[];for(var m=0;m<$items.length;m++){for(var n=0;n<3;n++){if(m>=$items.length){break}$items[m].style.left=n*310+"px";if(line>0){if($items[m-3].style.top!==""){top=parseInt($items[m-3].style.top)}$items[m].style.top=$($items[m-3]).height()+60+top+"px";heights[n]=parseInt($items[m].style.top)+$($items[m]).height()+60}else{heights[n]=$($items[m]).height()+60}if(n<2){m+=1}}line+=1}$archives.height(heights.sort()[heights.length-1])},scrollEvent:function(){var _it=this;$(window).scroll(function(){var y=$(window).scrollTop(),topH=0;if($("#top").css("display")==="block"){topH=$("#top").height()}if(y>=_it.headerH+topH){_it.$nav.css("position","fixed");_it.$body.css("marginTop","55px")}else{_it.$nav.css("position","inherit");_it.$body.css("marginTop","0")}if(y>_it.headerH){var bodyH=$(window).height();var top=y+bodyH-21;if($("body").height()-58<=y+bodyH){top=$(".footer").offset().top-21}$("#goTop").fadeIn("slow").css("top",top)}else{$("#goTop").hide()}})},setDynamic:function(){var $dynamic=$(".dynamic");if($(".dynamic").length<1){return}var $comments=$dynamic.find(".side-comments"),$tags=$dynamic.find(".side-tags"),$mostComment=$dynamic.find(".side-most-comment"),$mostView=$dynamic.find(".side-most-view");if($comments.height()>$tags.height()){$tags.height($comments.height())}else{$comments.height($tags.height())}if($mostComment.height()>$mostView.height()){$mostView.height($mostComment.height())}else{$mostComment.height($mostView.height())}$(".article-body").each(function(){this.innerHTML=Util.replaceEmString($(this).html())})},scrollToCmt:function(){if($(window.location.hash).length==1){$(window).scrollTop($(window.location.hash).offset().top-60)}}};(function(){ease.getCurrentPage();ease.initCommon();ease.scrollEvent();ease.setNavCurrent();ease.initArchives();ease.setDynamic()})(); \ No newline at end of file diff --git a/neoease/js/neoease.min.js b/neoease/js/neoease.min.js index a2252f5..0775676 100644 --- a/neoease/js/neoease.min.js +++ b/neoease/js/neoease.min.js @@ -1,20 +1 @@ -/* - * Copyright (c) 2009, 2010, 2011, 2012, B3log Team - * - * 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. - *//** - * @fileoverview neoease js. - * - * @author Liyuan Li - * @version 1.0.0.8, Sep 6, 2012 - */var goTop=function(e){e=e||.1;var t=$(window).scrollTop(),n=1+e;window.scrollTo(0,Math.floor(t/n));if(t>0){var r="goTop("+e+")";window.setTimeout(r,16)}},collapseArchive=function(e,t){var n=!0;e.className==="collapse-ico"?(e.className="expand-ico",n=!1):e.className="collapse-ico",$("#archiveSide li").each(function(){var e=$(this);e.data("year")===t&&(n?$(this).show():$(this).hide())})},getArticle=function(e,t){var n=$("#abstract"+t),r=$("#content"+t);return r.html()===""?$.ajax({url:"/get-article-content?id="+t,type:"GET",dataType:"html",beforeSend:function(){n.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(t,i){e.className="collapse-ico",r.html(t),n.hide().css("background","none"),r.fadeIn("slow")}}):e.className==="expand-ico"?(n.hide(),r.fadeIn(),e.className="collapse-ico"):(r.hide(),n.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 t=$(window).height(),n=e+t-21;$("body").height()-58<=e+t&&(n=$(".footer").offset().top-21),$("#goTop").fadeIn("slow").css("top",n)}else $("#goTop").hide()});var e=(new Date).getFullYear(),t=e;$("#archiveSide li").each(function(n){var r=$(this);r.data("year")!==e&&$(this).hide(),t!==r.data("year")&&(t=r.data("year"),r.before("
  • "+t+" 年
  • "))}),$(".recent-comments .expand-ico").click(function(){this.className==="expand-ico"?($(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"})})})(); \ No newline at end of file +var goTop=function(acceleration){acceleration=acceleration||.1;var y=$(window).scrollTop();var speed=1+acceleration;window.scrollTo(0,Math.floor(y/speed));if(y>0){var invokeFunction="goTop("+acceleration+")";window.setTimeout(invokeFunction,16)}};var collapseArchive=function(it,year){var tag=true;if(it.className==="collapse-ico"){it.className="expand-ico";tag=false}else{it.className="collapse-ico"}$("#archiveSide li").each(function(){var $this=$(this);if($this.data("year")===year){if(tag){$(this).show()}else{$(this).hide()}}})};var getArticle=function(it,id){var $abstract=$("#abstract"+id),$content=$("#content"+id);if($content.html()===""){$.ajax({url:"/get-article-content?id="+id,type:"GET",dataType:"html",beforeSend:function(){$abstract.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(result,textStatus){it.className="collapse-ico";$content.html(result);$abstract.hide().css("background","none");$content.fadeIn("slow")}})}else{if(it.className==="expand-ico"){$abstract.hide();$content.fadeIn();it.className="collapse-ico"}else{$content.hide();$abstract.fadeIn();it.className="expand-ico"}}return false};var goTranslate=function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)};(function(){$(window).scroll(function(){var y=$(window).scrollTop();if(y>182){var bodyH=$(window).height();var top=y+bodyH-21;if($("body").height()-58<=y+bodyH){top=$(".footer").offset().top-21}$("#goTop").fadeIn("slow").css("top",top)}else{$("#goTop").hide()}});var currentYear=(new Date).getFullYear(),year=currentYear;$("#archiveSide li").each(function(i){var $this=$(this);if($this.data("year")!==currentYear){$(this).hide()}if(year!==$this.data("year")){year=$this.data("year");$this.before("
  • "+year+" 年
  • ")}});$(".recent-comments .expand-ico").click(function(){if(this.className==="expand-ico"){$(this).parent().next().css({height:"auto","white-space":"normal"});this.className="collapse-ico"}else{$(this).parent().next().animate({height:"18px"},function(){$(this).css("white-space","nowrap")});this.className="expand-ico"}});$(".nav ul li").each(function(){var $a=$(this).find("a");if($a.attr("href")===latkeConfig.servePath+location.pathname){$(this).addClass("current")}else if(/\/[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(){if($(this).find(".recent-comments-content>a").height()<30){$(this).find(".expand-ico").remove()}else{$(this).find(".expand-ico").parent().next().css({"white-space":"nowrap"})}})})(); \ No newline at end of file diff --git a/timeline/css/timeline.min.css b/timeline/css/timeline.min.css index ab06496..ebc6219 100644 --- a/timeline/css/timeline.min.css +++ b/timeline/css/timeline.min.css @@ -56,7 +56,7 @@ img{max-width:100%;border:0;vertical-align:middle;} .ico-next{float:right;margin:-8px 0 0 10px;} a:hover>.ico-next,a:hover>.ico-pre{background-color:#000;} .wrapper{min-width:500px;padding:50px 0;background:url("../../timeline/images/bg.png") repeat scroll 0 0 #dee4ea;} -.header{background-color:#BFBFBF;background-image:url("../../timeline/images/nav-bg.png"),linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-ms-linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-o-linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-webkit-linear-gradient(#cccccc, #a9a9a9);filter:progid:dximagetransform.microsoft.gradient(GradientType=0, startColorstr='#CCCCCC', endColorstr='#A9A9A9');border-bottom:1px solid #898989;box-shadow:0 -1px 0 rgba(255, 255, 255, 0.3) inset,0 1px 1px rgba(0, 0, 0, 0.2);height:50px;overflow:hidden;} +.header{background-color:#BFBFBF;background-image:url("../../timeline/images/nav-bg.png"),linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-ms-linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-o-linear-gradient(#cccccc, #a9a9a9);background-image:url("../../timeline/images/nav-bg.png"),-webkit-linear-gradient(#cccccc, #a9a9a9);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#CCCCCC', endColorstr='#A9A9A9');border-bottom:1px solid #898989;box-shadow:0 -1px 0 rgba(255, 255, 255, 0.3) inset,0 1px 1px rgba(0, 0, 0, 0.2);height:50px;overflow:hidden;} .container{width:80%;margin:0 auto;} .footer{border-top:1px solid #232323;padding:20px 0;color:#ddd;font-size:80%;} .footer a{color:#9CC0DE;} diff --git a/timeline/js/timeline.js b/timeline/js/timeline.js index bcc57f6..301b13f 100644 --- a/timeline/js/timeline.js +++ b/timeline/js/timeline.js @@ -1,426 +1,424 @@ -/* - * Copyright (c) 2009, 2010, 2011, 2012, B3log Team - * - * 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. - */ - -/** - * @fileoverview timeline js. - * - * @author Liyuan Li - * @version 1.0.1.1, Feb 20, 2013 - */ -var timeline = { - _COLHA: 0, - _COLHB: 20, - _initArticleList: function () { - var $articles = $(".articles"); - if ($articles.length === 0 || $(".articles > .fn-clear").length > 0) { - return; - } - - $(window).resize(function () { - var colH = [timeline._COLHA, timeline._COLHB]; - $articles.find("article").each(function () { - var $it = $(this), - isLeft = colH[1] > colH[0], - top = isLeft ? colH[0] : colH[1]; - if (parseInt($it.css("top")) !== top) { - $it.css({ - "top": top + "px", - "position": "absolute" - }); - - if (isLeft) { - this.className = "l"; - } else { - this.className = "r"; - } - } - colH[( isLeft ? '0' : '1' )] += parseInt($it.outerHeight(true)); - }); - - $articles.height(colH[0] > colH[1] ? colH[0] : colH[1]); - }); - - $(window).resize(); - $(".module img").imagesLoaded(function () { - $(window).resize(); - }); - }, - - - _initIndexList: function () { - var $archives = $(".articles > .fn-clear"); - if ($archives.length === 0) { - return; - } - - // 如果为 index 页面,重构 archives 结构,使其可收缩 - var year = 0; - $(".nav-abs li").each(function (i) { - var $this = $(this); - $this.hide(); - if (year !== $this.data("year")) { - year = $this.data("year"); - $this.before("
  • " + year + "
  • "); - } - }); - - // 首次加载时,当没有下一页时,使用 js 隐藏"更多"按钮 - if ($(".article-more").parent().data("count") <= $(".article-more").parent().find("article").length) { - $(".article-more").remove(); - } - - $(window).resize(function () { - console.log("resize"); - $archives.each(function () { - var colH = [timeline._COLHA + 60, timeline._COLHB * 4]; - - var $articles = $(this).find("article"); - if ($articles.length === 0) { - $(this).find("h2").remove(); - $(this).css("margin-bottom" , 0); - } else { - $articles.each(function () { - var $it = $(this), - isLeft = colH[1] > colH[0], - top = isLeft ? colH[0] : colH[1]; - - if (parseInt($it.css("top")) !== top) { - console.log(top); - $it.css({ - "top": top + "px", - "position": "absolute" - }); - - if (isLeft) { - this.className = "l"; - } else { - this.className = "r"; - } - } - colH[( isLeft ? '0' : '1' )] += parseInt($it.outerHeight(true)); - }); - $(this).height(colH[0] > colH[1] ? colH[0] : colH[1]); - } - }); - }); - - $(window).resize(); - $(".module img").imagesLoaded(function () { - $(window).resize(); - }); - }, - - _setNavCurrent: function () { - $(".header li a").each(function () { - if($(this).prop("href") === location.href.split("#")[0]) { - this.className = "current"; - } else { - this.className = ""; - } - }) - }, - - init: function () { - $(window).scroll(function () { - if ($(window).scrollTop() > 60) { - $(".ico-top").show(); - } else { - $(".ico-top").hide(); - } - }); - timeline._initIndexList(); - timeline._initArticleList(); - timeline._setNavCurrent(); - }, - - translate: function () { - window.open("http://translate.google.com/translate?sl=auto&tl=auto&u=" + location.href); - }, - - getArchive: function (year, month, monthName) { - var archiveDate = year + month, - archive = year + "/" + month; - window.location.hash = "#" + archiveDate; - if ($("#" + archiveDate + " > article").length === 0) { - var archiveDataTitle = year + " " + Label.yearLabel + " " + month + " " + Label.monthLabel; - if (Label.localeString.substring(0, 2) === "en") { - archiveDataTitle = monthName + " " + year; - } - var archiveHTML = '

    ' + archiveDataTitle + '

    ' - + '
    ' + Label.moreLabel + '
    '; - - $("#" + archiveDate).html(archiveHTML).css("margin-bottom", "50px"); - timeline.getNextPage($("#" + archiveDate).find(".article-more")[0], archive); - } - }, - - getNextPage: function (it, archive) { - var $more = $(it), - currentPage = $more.data("page") + 1, - path = "/articles/"; - if($("#tag").length === 1) { - var pathnames = location.pathname.split("/"); - path = "/articles/tags/" + pathnames[pathnames.length - 1] + "/"; - } else if ($("#author").length === 1) { - var pathnames = location.pathname.split("/"); - path = "/articles/authors/" + pathnames[pathnames.length - 1] + "/"; - } else if (archive) { - path = "/articles/archives/" + archive + "/"; - } - $.ajax({ - url: latkeConfig.servePath + path + currentPage, - type: "GET", - beforeSend: function () { - $more.css("background", - "url(" + latkeConfig.staticServePath - + "/skins/timeline/images/ajax-loader.gif) no-repeat scroll center center #60829F").text(""); - }, - success: function(result, textStatus){ - if (!result.sc) { - $more.css("background", "none #60829F").text("Error"); - return; - } - - if (result.rslts.articles.length === 0) { - $more.remove(); - return; - } - - var articlesHTML = "", - pagination = result.rslts.pagination; - - // append articles - for (var i = 0; i < result.rslts.articles.length; i++) { - var article = result.rslts.articles[i]; - - articlesHTML += '
    ' - + '

    ' - +article.articleTitle + ''; - - if (article.hasUpdated) { - articlesHTML += '' + Label.updatedLabel + ''; - } - - if (article.articlePutTop) { - articlesHTML += '' + Label.topArticleLabel + ''; - } - - articlesHTML += '

    ' + article.articleAbstract + '

    ' - + ''; - - var articleTags = article.articleTags.split(","); - for (var j = 0; j < articleTags.length; j++) { - articlesHTML += '' + articleTags[j] + ''; - - if (j < articleTags.length - 1) { - articlesHTML += ","; - } - } - - articlesHTML += ' ' - + ' ' + (article.articleCommentCount === 0 ? Label.noCommentLabel : article.articleCommentCount) - + ' ' - + '' + article.articleViewCount - + '
    '; - } - - $more.before(articlesHTML).data("page", currentPage); - // 最后一页处理 - if (pagination.paginationPageCount <= currentPage) { - $more.remove(); - } else { - $more.css("background", "none #60829F").text(Label.moreLabel); - } - - $(window).resize(); - $(".module img").imagesLoaded(function () { - $(window).resize(); - }); - } - }); - }, - - toggleArchives: function (it, year) { - $(".nav-abs li").each(function (i) { - var $it = $(this); - if (!$it.hasClass("year")) { - $it.hide(); - if (year === $it.data("year") && $(it).hasClass("close")) { - $it.show(); - } - } - }); - - $(".nav-abs li.year").each(function () { - if (parseInt($(this).text()) === year) { - if ($(it).hasClass("close")) { - it.className = "year open"; - } else { - it.className = "year close"; - } - } else { - this.className = "year close"; - } - }); - } -}; - -/*! -* jQuery imagesLoaded plugin v2.1.1 -* http://github.com/desandro/imagesloaded -* -* MIT License. by Paul Irish et al. -*/ - -/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */ -/*global jQuery: false */ - -; -(function($, undefined) { - 'use strict'; - - // blank image data-uri bypasses webkit log warning (thx doug jones) - var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; - - $.fn.imagesLoaded = function( callback ) { - var $this = this, - deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, - hasNotify = $.isFunction(deferred.notify), - $images = $this.find('img').add( $this.filter('img') ), - loaded = [], - proper = [], - broken = []; - - // Register deferred callbacks - if ($.isPlainObject(callback)) { - $.each(callback, function (key, value) { - if (key === 'callback') { - callback = value; - } else if (deferred) { - deferred[key](value); - } - }); - } - - function doneLoading() { - var $proper = $(proper), - $broken = $(broken); - - if ( deferred ) { - if ( broken.length ) { - deferred.reject( $images, $proper, $broken ); - } else { - deferred.resolve( $images ); - } - } - - if ( $.isFunction( callback ) ) { - callback.call( $this, $images, $proper, $broken ); - } - } - - function imgLoadedHandler( event ) { - imgLoaded( event.target, event.type === 'error' ); - } - - function imgLoaded( img, isBroken ) { - // don't proceed if BLANK image, or image is already loaded - if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { - return; - } - - // store element in loaded images array - loaded.push( img ); - - // keep track of broken and properly loaded images - if ( isBroken ) { - broken.push( img ); - } else { - proper.push( img ); - } - - // cache image and its state for future calls - $.data( img, 'imagesLoaded', { - isBroken: isBroken, - src: img.src - } ); - - // trigger deferred progress method if present - if ( hasNotify ) { - deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); - } - - // call doneLoading and clean listeners if all images are loaded - if ( $images.length === loaded.length ) { - setTimeout( doneLoading ); - $images.unbind( '.imagesLoaded', imgLoadedHandler ); - } - } - - // if no images, trigger immediately - if ( !$images.length ) { - doneLoading(); - } else { - $images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler ) - .each( function( i, el ) { - var src = el.src; - - // find out if this image has been already checked for status - // if it was, and src has not changed, call imgLoaded on it - var cached = $.data( el, 'imagesLoaded' ); - if ( cached && cached.src === src ) { - imgLoaded( el, cached.isBroken ); - return; - } - - // if complete is true and browser supports natural sizes, try - // to check for image status manually - if ( el.complete && el.naturalWidth !== undefined ) { - imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); - return; - } - - // cached images don't fire load sometimes, so we reset src, but only when - // dealing with IE, or image is complete (loaded) and failed manual check - // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f - if ( el.readyState || el.complete ) { - el.src = BLANK; - el.src = src; - } - }); - } - - return deferred ? deferred.promise( $this ) : $this; - }; - -})(jQuery); - -(function () { - Util.init(); - Util.replaceSideEm($(".comments .article-body")); - Util.buildTags("tagsSide"); - - timeline.init(); +/* + * Copyright (c) 2009, 2010, 2011, 2012, B3log Team + * + * 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. + */ + +/** + * @fileoverview timeline js. + * + * @author Liyuan Li + * @version 1.0.1.1, Feb 20, 2013 + */ +var timeline = { + _COLHA: 0, + _COLHB: 20, + _initArticleList: function () { + var $articles = $(".articles"); + if ($articles.length === 0 || $(".articles > .fn-clear").length > 0) { + return; + } + + $(window).resize(function () { + var colH = [timeline._COLHA, timeline._COLHB]; + $articles.find("article").each(function () { + var $it = $(this), + isLeft = colH[1] > colH[0], + top = isLeft ? colH[0] : colH[1]; + if (parseInt($it.css("top")) !== top) { + $it.css({ + "top": top + "px", + "position": "absolute" + }); + + if (isLeft) { + this.className = "l"; + } else { + this.className = "r"; + } + } + colH[( isLeft ? '0' : '1' )] += parseInt($it.outerHeight(true)); + }); + + $articles.height(colH[0] > colH[1] ? colH[0] : colH[1]); + }); + + $(window).resize(); + $(".module img").imagesLoaded(function () { + $(window).resize(); + }); + }, + + + _initIndexList: function () { + var $archives = $(".articles > .fn-clear"); + if ($archives.length === 0) { + return; + } + + // 如果为 index 页面,重构 archives 结构,使其可收缩 + var year = 0; + $(".nav-abs li").each(function (i) { + var $this = $(this); + $this.hide(); + if (year !== $this.data("year")) { + year = $this.data("year"); + $this.before("
  • " + year + "
  • "); + } + }); + + // 首次加载时,当没有下一页时,使用 js 隐藏"更多"按钮 + if ($(".article-more").parent().data("count") <= $(".article-more").parent().find("article").length) { + $(".article-more").remove(); + } + + $(window).resize(function () { + $archives.each(function () { + var colH = [timeline._COLHA + 60, timeline._COLHB * 4]; + + var $articles = $(this).find("article"); + if ($articles.length === 0) { + $(this).find("h2").remove(); + $(this).css("margin-bottom" , 0); + } else { + $articles.each(function () { + var $it = $(this), + isLeft = colH[1] > colH[0], + top = isLeft ? colH[0] : colH[1]; + + if (parseInt($it.css("top")) !== top) { + $it.css({ + "top": top + "px", + "position": "absolute" + }); + + if (isLeft) { + this.className = "l"; + } else { + this.className = "r"; + } + } + colH[( isLeft ? '0' : '1' )] += parseInt($it.outerHeight(true)); + }); + $(this).height(colH[0] > colH[1] ? colH[0] : colH[1]); + } + }); + }); + + $(window).resize(); + $(".module img").imagesLoaded(function () { + $(window).resize(); + }); + }, + + _setNavCurrent: function () { + $(".header li a").each(function () { + if($(this).prop("href") === location.href.split("#")[0]) { + this.className = "current"; + } else { + this.className = ""; + } + }) + }, + + init: function () { + $(window).scroll(function () { + if ($(window).scrollTop() > 60) { + $(".ico-top").show(); + } else { + $(".ico-top").hide(); + } + }); + timeline._initIndexList(); + timeline._initArticleList(); + timeline._setNavCurrent(); + }, + + translate: function () { + window.open("http://translate.google.com/translate?sl=auto&tl=auto&u=" + location.href); + }, + + getArchive: function (year, month, monthName) { + var archiveDate = year + month, + archive = year + "/" + month; + window.location.hash = "#" + archiveDate; + if ($("#" + archiveDate + " > article").length === 0) { + var archiveDataTitle = year + " " + Label.yearLabel + " " + month + " " + Label.monthLabel; + if (Label.localeString.substring(0, 2) === "en") { + archiveDataTitle = monthName + " " + year; + } + var archiveHTML = '

    ' + archiveDataTitle + '

    ' + + '
    ' + Label.moreLabel + '
    '; + + $("#" + archiveDate).html(archiveHTML).css("margin-bottom", "50px"); + timeline.getNextPage($("#" + archiveDate).find(".article-more")[0], archive); + } + }, + + getNextPage: function (it, archive) { + var $more = $(it), + currentPage = $more.data("page") + 1, + path = "/articles/"; + if($("#tag").length === 1) { + var pathnames = location.pathname.split("/"); + path = "/articles/tags/" + pathnames[pathnames.length - 1] + "/"; + } else if ($("#author").length === 1) { + var pathnames = location.pathname.split("/"); + path = "/articles/authors/" + pathnames[pathnames.length - 1] + "/"; + } else if (archive) { + path = "/articles/archives/" + archive + "/"; + } + $.ajax({ + url: latkeConfig.servePath + path + currentPage, + type: "GET", + beforeSend: function () { + $more.css("background", + "url(" + latkeConfig.staticServePath + + "/skins/timeline/images/ajax-loader.gif) no-repeat scroll center center #60829F").text(""); + }, + success: function(result, textStatus){ + if (!result.sc) { + $more.css("background", "none #60829F").text("Error"); + return; + } + + if (result.rslts.articles.length === 0) { + $more.remove(); + return; + } + + var articlesHTML = "", + pagination = result.rslts.pagination; + + // append articles + for (var i = 0; i < result.rslts.articles.length; i++) { + var article = result.rslts.articles[i]; + + articlesHTML += '
    ' + + '

    ' + +article.articleTitle + ''; + + if (article.hasUpdated) { + articlesHTML += '' + Label.updatedLabel + ''; + } + + if (article.articlePutTop) { + articlesHTML += '' + Label.topArticleLabel + ''; + } + + articlesHTML += '

    ' + article.articleAbstract + '

    ' + + ''; + + var articleTags = article.articleTags.split(","); + for (var j = 0; j < articleTags.length; j++) { + articlesHTML += '' + articleTags[j] + ''; + + if (j < articleTags.length - 1) { + articlesHTML += ","; + } + } + + articlesHTML += ' ' + + ' ' + (article.articleCommentCount === 0 ? Label.noCommentLabel : article.articleCommentCount) + + ' ' + + '' + article.articleViewCount + + '
    '; + } + + $more.before(articlesHTML).data("page", currentPage); + // 最后一页处理 + if (pagination.paginationPageCount <= currentPage) { + $more.remove(); + } else { + $more.css("background", "none #60829F").text(Label.moreLabel); + } + + $(window).resize(); + $(".module img").imagesLoaded(function () { + $(window).resize(); + }); + } + }); + }, + + toggleArchives: function (it, year) { + $(".nav-abs li").each(function (i) { + var $it = $(this); + if (!$it.hasClass("year")) { + $it.hide(); + if (year === $it.data("year") && $(it).hasClass("close")) { + $it.show(); + } + } + }); + + $(".nav-abs li.year").each(function () { + if (parseInt($(this).text()) === year) { + if ($(it).hasClass("close")) { + it.className = "year open"; + } else { + it.className = "year close"; + } + } else { + this.className = "year close"; + } + }); + } +}; + +/*! +* jQuery imagesLoaded plugin v2.1.1 +* http://github.com/desandro/imagesloaded +* +* MIT License. by Paul Irish et al. +*/ + +/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */ +/*global jQuery: false */ + +; +(function($, undefined) { + 'use strict'; + + // blank image data-uri bypasses webkit log warning (thx doug jones) + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; + + $.fn.imagesLoaded = function( callback ) { + var $this = this, + deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, + hasNotify = $.isFunction(deferred.notify), + $images = $this.find('img').add( $this.filter('img') ), + loaded = [], + proper = [], + broken = []; + + // Register deferred callbacks + if ($.isPlainObject(callback)) { + $.each(callback, function (key, value) { + if (key === 'callback') { + callback = value; + } else if (deferred) { + deferred[key](value); + } + }); + } + + function doneLoading() { + var $proper = $(proper), + $broken = $(broken); + + if ( deferred ) { + if ( broken.length ) { + deferred.reject( $images, $proper, $broken ); + } else { + deferred.resolve( $images ); + } + } + + if ( $.isFunction( callback ) ) { + callback.call( $this, $images, $proper, $broken ); + } + } + + function imgLoadedHandler( event ) { + imgLoaded( event.target, event.type === 'error' ); + } + + function imgLoaded( img, isBroken ) { + // don't proceed if BLANK image, or image is already loaded + if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { + return; + } + + // store element in loaded images array + loaded.push( img ); + + // keep track of broken and properly loaded images + if ( isBroken ) { + broken.push( img ); + } else { + proper.push( img ); + } + + // cache image and its state for future calls + $.data( img, 'imagesLoaded', { + isBroken: isBroken, + src: img.src + } ); + + // trigger deferred progress method if present + if ( hasNotify ) { + deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); + } + + // call doneLoading and clean listeners if all images are loaded + if ( $images.length === loaded.length ) { + setTimeout( doneLoading ); + $images.unbind( '.imagesLoaded', imgLoadedHandler ); + } + } + + // if no images, trigger immediately + if ( !$images.length ) { + doneLoading(); + } else { + $images.bind( 'load.imagesLoaded error.imagesLoaded', imgLoadedHandler ) + .each( function( i, el ) { + var src = el.src; + + // find out if this image has been already checked for status + // if it was, and src has not changed, call imgLoaded on it + var cached = $.data( el, 'imagesLoaded' ); + if ( cached && cached.src === src ) { + imgLoaded( el, cached.isBroken ); + return; + } + + // if complete is true and browser supports natural sizes, try + // to check for image status manually + if ( el.complete && el.naturalWidth !== undefined ) { + imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); + return; + } + + // cached images don't fire load sometimes, so we reset src, but only when + // dealing with IE, or image is complete (loaded) and failed manual check + // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f + if ( el.readyState || el.complete ) { + el.src = BLANK; + el.src = src; + } + }); + } + + return deferred ? deferred.promise( $this ) : $this; + }; + +})(jQuery); + +(function () { + Util.init(); + Util.replaceSideEm($(".comments .article-body")); + Util.buildTags("tagsSide"); + + timeline.init(); })(); \ No newline at end of file diff --git a/timeline/js/timeline.min.js b/timeline/js/timeline.min.js index b3408ec..dbf980c 100644 --- a/timeline/js/timeline.min.js +++ b/timeline/js/timeline.min.js @@ -1,20 +1 @@ -/* - * Copyright (c) 2009, 2010, 2011, 2012, B3log Team - * - * 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. - *//** - * @fileoverview timeline js. - * - * @author Liyuan Li - * @version 1.0.1.1, Feb 20, 2013 - */var timeline={_COLHA:0,_COLHB:20,_initArticleList:function(){var e=$(".articles");if(e.length===0||$(".articles > .fn-clear").length>0)return;$(window).resize(function(){var t=[timeline._COLHA,timeline._COLHB];e.find("article").each(function(){var e=$(this),n=t[1]>t[0],r=n?t[0]:t[1];parseInt(e.css("top"))!==r&&(e.css({top:r+"px",position:"absolute"}),n?this.className="l":this.className="r"),t[n?"0":"1"]+=parseInt(e.outerHeight(!0))}),e.height(t[0]>t[1]?t[0]:t[1])}),$(window).resize(),$(".module img").imagesLoaded(function(){$(window).resize()})},_initIndexList:function(){var e=$(".articles > .fn-clear");if(e.length===0)return;var t=0;$(".nav-abs li").each(function(e){var n=$(this);n.hide(),t!==n.data("year")&&(t=n.data("year"),n.before("
  • "+t+"
  • "))}),$(".article-more").parent().data("count")<=$(".article-more").parent().find("article").length&&$(".article-more").remove(),$(window).resize(function(){console.log("resize"),e.each(function(){var e=[timeline._COLHA+60,timeline._COLHB*4],t=$(this).find("article");t.length===0?($(this).find("h2").remove(),$(this).css("margin-bottom",0)):(t.each(function(){var t=$(this),n=e[1]>e[0],r=n?e[0]:e[1];parseInt(t.css("top"))!==r&&(console.log(r),t.css({top:r+"px",position:"absolute"}),n?this.className="l":this.className="r"),e[n?"0":"1"]+=parseInt(t.outerHeight(!0))}),$(this).height(e[0]>e[1]?e[0]:e[1]))})}),$(window).resize(),$(".module img").imagesLoaded(function(){$(window).resize()})},_setNavCurrent:function(){$(".header li a").each(function(){$(this).prop("href")===location.href.split("#")[0]?this.className="current":this.className=""})},init:function(){$(window).scroll(function(){$(window).scrollTop()>60?$(".ico-top").show():$(".ico-top").hide()}),timeline._initIndexList(),timeline._initArticleList(),timeline._setNavCurrent()},translate:function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},getArchive:function(e,t,n){var r=e+t,i=e+"/"+t;window.location.hash="#"+r;if($("#"+r+" > article").length===0){var s=e+" "+Label.yearLabel+" "+t+" "+Label.monthLabel;Label.localeString.substring(0,2)==="en"&&(s=n+" "+e);var o='

    '+s+"

    "+'
    '+Label.moreLabel+"
    ";$("#"+r).html(o).css("margin-bottom","50px"),timeline.getNextPage($("#"+r).find(".article-more")[0],i)}},getNextPage:function(e,t){var n=$(e),r=n.data("page")+1,i="/articles/";if($("#tag").length===1){var s=location.pathname.split("/");i="/articles/tags/"+s[s.length-1]+"/"}else if($("#author").length===1){var s=location.pathname.split("/");i="/articles/authors/"+s[s.length-1]+"/"}else t&&(i="/articles/archives/"+t+"/");$.ajax({url:latkeConfig.servePath+i+r,type:"GET",beforeSend:function(){n.css("background","url("+latkeConfig.staticServePath+"/skins/timeline/images/ajax-loader.gif) no-repeat scroll center center #60829F").text("")},success:function(e,t){if(!e.sc){n.css("background","none #60829F").text("Error");return}if(e.rslts.articles.length===0){n.remove();return}var i="",s=e.rslts.pagination;for(var o=0;o

    '+u.articleTitle+"",u.hasUpdated&&(i+=""+Label.updatedLabel+""),u.articlePutTop&&(i+=""+Label.topArticleLabel+""),i+="

    "+u.articleAbstract+"

    "+'';var a=u.articleTags.split(",");for(var f=0;f'+a[f]+"",f '+' '+(u.articleCommentCount===0?Label.noCommentLabel:u.articleCommentCount)+' '+''+u.articleViewCount+"
    "}n.before(i).data("page",r),s.paginationPageCount<=r?n.remove():n.css("background","none #60829F").text(Label.moreLabel),$(window).resize(),$(".module img").imagesLoaded(function(){$(window).resize()})}})},toggleArchives:function(e,t){$(".nav-abs li").each(function(n){var r=$(this);r.hasClass("year")||(r.hide(),t===r.data("year")&&$(e).hasClass("close")&&r.show())}),$(".nav-abs li.year").each(function(){parseInt($(this).text())===t?$(e).hasClass("close")?e.className="year open":e.className="year close":this.className="year close"})}};(function(e,t){"use strict";var n="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";e.fn.imagesLoaded=function(r){function c(){var t=e(f),n=e(l);s&&(l.length?s.reject(u,t,n):s.resolve(u)),e.isFunction(r)&&r.call(i,u,t,n)}function h(e){p(e.target,e.type==="error")}function p(t,r){if(t.src===n||e.inArray(t,a)!==-1)return;a.push(t),r?l.push(t):f.push(t),e.data(t,"imagesLoaded",{isBroken:r,src:t.src}),o&&s.notifyWith(e(t),[r,u,e(f),e(l)]),u.length===a.length&&(setTimeout(c),u.unbind(".imagesLoaded",h))}var i=this,s=e.isFunction(e.Deferred)?e.Deferred():0,o=e.isFunction(s.notify),u=i.find("img").add(i.filter("img")),a=[],f=[],l=[];return e.isPlainObject(r)&&e.each(r,function(e,t){e==="callback"?r=t:s&&s[e](t)}),u.length?u.bind("load.imagesLoaded error.imagesLoaded",h).each(function(r,i){var s=i.src,o=e.data(i,"imagesLoaded");if(o&&o.src===s){p(i,o.isBroken);return}if(i.complete&&i.naturalWidth!==t){p(i,i.naturalWidth===0||i.naturalHeight===0);return}if(i.readyState||i.complete)i.src=n,i.src=s}):c(),s?s.promise(i):i}})(jQuery),function(){Util.init(),Util.replaceSideEm($(".comments .article-body")),Util.buildTags("tagsSide"),timeline.init()}(); \ No newline at end of file +var timeline={_COLHA:0,_COLHB:20,_initArticleList:function(){var $articles=$(".articles");if($articles.length===0||$(".articles > .fn-clear").length>0){return}$(window).resize(function(){var colH=[timeline._COLHA,timeline._COLHB];$articles.find("article").each(function(){var $it=$(this),isLeft=colH[1]>colH[0],top=isLeft?colH[0]:colH[1];if(parseInt($it.css("top"))!==top){$it.css({top:top+"px",position:"absolute"});if(isLeft){this.className="l"}else{this.className="r"}}colH[isLeft?"0":"1"]+=parseInt($it.outerHeight(true))});$articles.height(colH[0]>colH[1]?colH[0]:colH[1])});$(window).resize();$(".module img").imagesLoaded(function(){$(window).resize()})},_initIndexList:function(){var $archives=$(".articles > .fn-clear");if($archives.length===0){return}var year=0;$(".nav-abs li").each(function(i){var $this=$(this);$this.hide();if(year!==$this.data("year")){year=$this.data("year");$this.before("
  • "+year+"
  • ")}});if($(".article-more").parent().data("count")<=$(".article-more").parent().find("article").length){$(".article-more").remove()}$(window).resize(function(){$archives.each(function(){var colH=[timeline._COLHA+60,timeline._COLHB*4];var $articles=$(this).find("article");if($articles.length===0){$(this).find("h2").remove();$(this).css("margin-bottom",0)}else{$articles.each(function(){var $it=$(this),isLeft=colH[1]>colH[0],top=isLeft?colH[0]:colH[1];if(parseInt($it.css("top"))!==top){$it.css({top:top+"px",position:"absolute"});if(isLeft){this.className="l"}else{this.className="r"}}colH[isLeft?"0":"1"]+=parseInt($it.outerHeight(true))});$(this).height(colH[0]>colH[1]?colH[0]:colH[1])}})});$(window).resize();$(".module img").imagesLoaded(function(){$(window).resize()})},_setNavCurrent:function(){$(".header li a").each(function(){if($(this).prop("href")===location.href.split("#")[0]){this.className="current"}else{this.className=""}})},init:function(){$(window).scroll(function(){if($(window).scrollTop()>60){$(".ico-top").show()}else{$(".ico-top").hide()}});timeline._initIndexList();timeline._initArticleList();timeline._setNavCurrent()},translate:function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},getArchive:function(year,month,monthName){var archiveDate=year+month,archive=year+"/"+month;window.location.hash="#"+archiveDate;if($("#"+archiveDate+" > article").length===0){var archiveDataTitle=year+" "+Label.yearLabel+" "+month+" "+Label.monthLabel;if(Label.localeString.substring(0,2)==="en"){archiveDataTitle=monthName+" "+year}var archiveHTML='

    '+archiveDataTitle+"

    "+'
    '+Label.moreLabel+"
    ";$("#"+archiveDate).html(archiveHTML).css("margin-bottom","50px");timeline.getNextPage($("#"+archiveDate).find(".article-more")[0],archive)}},getNextPage:function(it,archive){var $more=$(it),currentPage=$more.data("page")+1,path="/articles/";if($("#tag").length===1){var pathnames=location.pathname.split("/");path="/articles/tags/"+pathnames[pathnames.length-1]+"/"}else if($("#author").length===1){var pathnames=location.pathname.split("/");path="/articles/authors/"+pathnames[pathnames.length-1]+"/"}else if(archive){path="/articles/archives/"+archive+"/"}$.ajax({url:latkeConfig.servePath+path+currentPage,type:"GET",beforeSend:function(){$more.css("background","url("+latkeConfig.staticServePath+"/skins/timeline/images/ajax-loader.gif) no-repeat scroll center center #60829F").text("")},success:function(result,textStatus){if(!result.sc){$more.css("background","none #60829F").text("Error");return}if(result.rslts.articles.length===0){$more.remove();return}var articlesHTML="",pagination=result.rslts.pagination;for(var i=0;i
    '+'

    '+article.articleTitle+"";if(article.hasUpdated){articlesHTML+=""+Label.updatedLabel+""}if(article.articlePutTop){articlesHTML+=""+Label.topArticleLabel+""}articlesHTML+="

    "+article.articleAbstract+"

    "+'';var articleTags=article.articleTags.split(",");for(var j=0;j'+articleTags[j]+"";if(j '+' '+(article.articleCommentCount===0?Label.noCommentLabel:article.articleCommentCount)+' '+''+article.articleViewCount+"
    "}$more.before(articlesHTML).data("page",currentPage);if(pagination.paginationPageCount<=currentPage){$more.remove()}else{$more.css("background","none #60829F").text(Label.moreLabel)}$(window).resize();$(".module img").imagesLoaded(function(){$(window).resize()})}})},toggleArchives:function(it,year){$(".nav-abs li").each(function(i){var $it=$(this);if(!$it.hasClass("year")){$it.hide();if(year===$it.data("year")&&$(it).hasClass("close")){$it.show()}}});$(".nav-abs li.year").each(function(){if(parseInt($(this).text())===year){if($(it).hasClass("close")){it.className="year open"}else{it.className="year close"}}else{this.className="year close"}})}};(function($,undefined){"use strict";var BLANK="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";$.fn.imagesLoaded=function(callback){var $this=this,deferred=$.isFunction($.Deferred)?$.Deferred():0,hasNotify=$.isFunction(deferred.notify),$images=$this.find("img").add($this.filter("img")),loaded=[],proper=[],broken=[];if($.isPlainObject(callback)){$.each(callback,function(key,value){if(key==="callback"){callback=value}else if(deferred){deferred[key](value)}})}function doneLoading(){var $proper=$(proper),$broken=$(broken);if(deferred){if(broken.length){deferred.reject($images,$proper,$broken)}else{deferred.resolve($images)}}if($.isFunction(callback)){callback.call($this,$images,$proper,$broken)}}function imgLoadedHandler(event){imgLoaded(event.target,event.type==="error")}function imgLoaded(img,isBroken){if(img.src===BLANK||$.inArray(img,loaded)!==-1){return}loaded.push(img);if(isBroken){broken.push(img)}else{proper.push(img)}$.data(img,"imagesLoaded",{isBroken:isBroken,src:img.src});if(hasNotify){deferred.notifyWith($(img),[isBroken,$images,$(proper),$(broken)])}if($images.length===loaded.length){setTimeout(doneLoading);$images.unbind(".imagesLoaded",imgLoadedHandler)}}if(!$images.length){doneLoading()}else{$images.bind("load.imagesLoaded error.imagesLoaded",imgLoadedHandler).each(function(i,el){var src=el.src;var cached=$.data(el,"imagesLoaded");if(cached&&cached.src===src){imgLoaded(el,cached.isBroken);return}if(el.complete&&el.naturalWidth!==undefined){imgLoaded(el,el.naturalWidth===0||el.naturalHeight===0);return}if(el.readyState||el.complete){el.src=BLANK;el.src=src}})}return deferred?deferred.promise($this):$this}})(jQuery);(function(){Util.init();Util.replaceSideEm($(".comments .article-body"));Util.buildTags("tagsSide");timeline.init()})(); \ No newline at end of file