18 lines
3.1 KiB
JavaScript
18 lines
3.1 KiB
JavaScript
/*
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
*/
|
|
var goTop=function(e){e=e||.1;var a=$(window).scrollTop(),t=1+e;if(window.scrollTo(0,Math.floor(a/t)),0<a){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(){$(this).data("year")===a&&(t?$(this).show():$(this).hide())})},getArticle=function(t,e){var n=$("#abstract"+e),i=$("#content"+e);return""===i.html()?$.ajax({url:"/get-article-content?id="+e,type:"GET",dataType:"html",beforeSend:function(){n.css("background","url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(e,a){t.className="collapse-ico",i.html(e),n.hide().css("background","none"),i.fadeIn("slow")}}):"expand-ico"===t.className?(n.hide(),i.fadeIn(),t.className="collapse-ico"):(i.hide(),n.fadeIn(),t.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(182<e){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 t=(new Date).getFullYear(),n=t;$("#archiveSide li").each(function(e){var a=$(this);a.data("year")!==t&&$(this).hide(),n!==a.data("year")&&(n=a.data("year"),a.before("<li class='archive-year'><div onclick='collapseArchive(this, "+n+")' class='expand-ico'>"+n+" 年</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(){$(this).find("a").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"})})}(); |