/* * Solo - A small and beautiful blogging system written in Java. * Copyright (c) 2010-2019, b3log.org & hacpai.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ var timeline={_COLHA:0,_COLHB:20,_initArticleList:function(){var e=$(".articles");0===e.length||0<$(".articles > .fn-clear").length||($(window).resize(function(){if("auto"===$("#hideTop").css("top")){var i=[timeline._COLHA,timeline._COLHB];e.find("article").each(function(){var e=$(this),t=i[1]>i[0],a=t?i[0]:i[1];parseInt(e.css("top"))===a&&0!==a||(e.css({top:a+"px",position:"absolute"}),this.className=t?"l":"r"),i[t?"0":"1"]+=parseInt(e.outerHeight(!0))}),e.height(i[0]>i[1]?i[0]:i[1])}else e.find("article").each(function(){$(this).css({position:"inherit",top:"auto"}).removeClass("r l")}),e.css("height","auto")}),$(window).resize(),$(".module img").imagesLoaded(function(){$(window).resize()}))},_initIndexList:function(){var e=$(".articles > .fn-clear");if(0!==e.length){var a=0;$(".nav-abs li").each(function(e){var t=$(this);t.hide(),a!==t.data("year")&&(a=t.data("year"),t.before("
  • "+a+"
  • "))}),$(".article-more").parent().data("count")<=$(".article-more").parent().find("article").length&&$(".article-more").remove(),$(window).resize(function(){e.each(function(){if("auto"===$("#hideTop").css("top")){var i=[timeline._COLHA+60,4*timeline._COLHB];0===(e=$(this).find("article")).length?($(this).find("h2").remove(),$(this).css("margin-bottom",0)):(e.each(function(){var e=$(this),t=i[1]>i[0],a=t?i[0]:i[1];parseInt(e.css("top"))===a&&0!==a||(e.css({top:a+"px",position:"absolute"}),this.className=t?"l":"r"),i[t?"0":"1"]+=parseInt(e.outerHeight(!0))}),$(this).height(i[0]>i[1]?i[0]:i[1]))}else{var e;0===(e=$(this).find("article")).length?($(this).find("h2").remove(),$(this).css("margin-bottom",0)):(e.each(function(){$(this).css({position:"inherit",top:"auto"}).removeClass("r l")}),$(this).css("height","auto"))}})}),$(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(){60<$(window).scrollTop()?$(".ico-top").show():$(".ico-top").hide()}),timeline._initIndexList(),timeline._initArticleList(),timeline._setNavCurrent(),$(".ico-list").click(function(){"0px"===$(".header > .container > form").css("height")?$(".header > .container > ul, .header > .container > form").css({height:"auto"}):$(".header > .container > ul, .header > .container > form").animate({height:"0px"})})},translate:function(){window.open("http://translate.google.com/translate?sl=auto&tl=auto&u="+location.href)},getArchive:function(e,t,a){var i=e+t,s=e+"/"+t;if(window.location.hash="#"+i,0===$("#"+i+" > article").length){var n=e+" "+Label.yearLabel+" "+t+" "+Label.monthLabel;"en"===Label.localeString.substring(0,2)&&(n=a+" "+e);var r='

    '+n+'

    '+Label.moreLabel+"
    ";$("#"+i).html(r).css("margin-bottom","50px"),timeline.getNextPage($("#"+i).find(".article-more")[0],s)}},getNextPage:function(e,t){var l=$(e),c=l.data("page")+1,a="/articles/";if(1===$("#tag").length)a="/articles/tags/"+(i=location.pathname.split("/"))[i.length-1]+"/";else if(1===$("#author").length){var i;a="/articles/authors/"+(i=location.pathname.split("/"))[i.length-1]+"/"}else t&&(a="/articles/archives/"+t+"/");$.ajax({url:latkeConfig.servePath+a+"?p="+c,type:"GET",beforeSend:function(){l.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)if(0!==e.rslts.articles.length){for(var a="",i=e.rslts.pagination,s=0;s

    '+n.articleTitle+"",n.hasUpdated&&(a+=""+Label.updatedLabel+""),n.articlePutTop&&(a+=""+Label.topArticleLabel+""),a+="

    "+n.articleAbstract+'

    ';for(var r=n.articleTags.split(","),o=0;o'+r[o]+"",o  '+(0===n.articleCommentCount?Label.noCommentLabel:n.articleCommentCount)+' '+n.articleViewCount+"
    "}l.before(a).data("page",c),i.paginationPageCount<=c?l.remove():l.css("background","none #60829F").text(Label.moreLabel),$(window).resize(),$(".module img").imagesLoaded(function(){$(window).resize()})}else l.remove();else l.css("background","none #60829F").text("Error")}})},toggleArchives:function(a,i){$(".nav-abs li").each(function(e){var t=$(this);t.hasClass("year")||(t.hide(),i===t.data("year")&&$(a).hasClass("close")&&t.show())}),$(".nav-abs li.year").each(function(){parseInt($(this).text())===i?$(a).hasClass("close")?a.className="year open":a.className="year close":this.className="year close"})}};!function(u,e){"use strict";var g="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";u.fn.imagesLoaded=function(a){var i=this,s=u.isFunction(u.Deferred)?u.Deferred():0,n=u.isFunction(s.notify),r=i.find("img").add(i.filter("img")),o=[],l=[],c=[];function h(){var e=u(l),t=u(c);s&&(c.length?s.reject(r,e,t):s.resolve(r)),u.isFunction(a)&&a.call(i,r,e,t)}function d(e){m(e.target,"error"===e.type)}function m(e,t){e.src!==g&&-1===u.inArray(e,o)&&(o.push(e),t?c.push(e):l.push(e),u.data(e,"imagesLoaded",{isBroken:t,src:e.src}),n&&s.notifyWith(u(e),[t,r,u(l),u(c)]),r.length===o.length&&(setTimeout(h),r.unbind(".imagesLoaded",d)))}return u.isPlainObject(a)&&u.each(a,function(e,t){"callback"===e?a=t:s&&s[e](t)}),r.length?r.bind("load.imagesLoaded error.imagesLoaded",d).each(function(e,t){var a=t.src,i=u.data(t,"imagesLoaded");i&&i.src===a?m(t,i.isBroken):t.complete&&void 0!==t.naturalWidth?m(t,0===t.naturalWidth||0===t.naturalHeight):(t.readyState||t.complete)&&(t.src=g,t.src=a)}):h(),s?s.promise(i):i}}(jQuery),Util.init(),Util.replaceSideEm($(".comments .article-body")),Util.buildTags("tagsSide"),timeline.init();