bolo-fantastic/bolo-NeoEase/js/bolo-NeoEase-mod.min.js
2020-06-04 01:17:02 +08:00

1 line
2.4 KiB
JavaScript

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(){$(this).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/bolo-NeoEase/images/ajax-loader.gif) no-repeat scroll center center transparent")},success:function(a,o){e.className="collapse-ico",n.html(a),t.hide().css("background","none"),n.fadeIn("slow"),Util.parseLanguage(),Util.parseMarkdown()}}):"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)};$(document).ready((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;\u5e74</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")===Label.servePath+location.pathname?$(this).addClass("current"):/\/[0-9]+$/.test(location.pathname)&&($(".nav ul li")[0].className="current")})),Util.setTopBar(),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"})}))}));