/*
* 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 Util={parseMarkdown:function(e){var t=!1,i=!1;e=e||"article-body";if($("."+e).each(function(){$(this).find("p").each(function(){(-1<$(this).text().indexOf("$\\")||-1<$(this).text().indexOf("$$"))&&(t=!0)}),0<$(this).find("code.lang-flow, code.language-flow").length&&(i=!0)}),t){var n=function(){MathJax.Hub.Config({tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"]],processEscapes:!0,processEnvironments:!0,skipTags:["pre","code","script"]}}),MathJax.Hub.Typeset()};"undefined"!=typeof MathJax?n():$.ajax({method:"GET",url:"https://cdn.staticfile.org/MathJax/MathJax-2.6-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&_=1473258780393",dataType:"script",cache:!0}).done(function(){n()})}if(i){var o=function(){$("."+e+" code.lang-flow, ."+e+" code.language-flow").each(function(e){var t=$(this),i="symFlow"+(new Date).getTime()+e;t.hide();var n=flowchart.parse($.trim(t.text()));t.parent().after('
'),n.drawSVG(i),t.parent().remove(),$("#"+i).find("svg").height("auto").width("auto")})};"undefined"!=typeof flowchart?o():$.ajax({method:"GET",url:latkeConfig.staticServePath+"/js/lib/flowchart/flowchart.min.js",dataType:"script",cache:!0}).done(function(){o()})}},isLoggedIn:function(){return!!(1===$("#admin").length&&$("#admin").data("login")||"true"===latkeConfig.isLoggedIn)},getUserName:function(){return 1===$("#adminName").length?$("#adminName").text():latkeConfig.userName},error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/solo/issues/new"),$("#loadMsg").text("")},killIE:function(){var e=function(){if(""===Cookie.readCookie("showKill")){var e=($(window).width()-701)/2,t=($(window).height()-420)/2;$("body").append("")}};if($.browser.msie){if("6.0"===$.browser.version||"7.0"===$.browser.version)return void e();if(window.external&&window.external.twGetRunPath){var t=external.twGetRunPath();if(t&&-1 "+t[i].substr(3)}return e},proessURL:function(e){return/^\w+:\/\//.test(e)||(e="http://"+e),e},switchMobile:function(e){Cookie.createCookie("btouch_switch_toggle",e,365),setTimeout(function(){location.reload()},1250)},setTopBar:function(){var e=$("#top");if(1===e.length){var t=$("#showTop");t.click(function(){e.slideDown(),t.hide()}),$("#hideTop").click(function(){e.slideUp(),t.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},500)},goBottom:function(e){e||(e=0);var t=$("body").height()>$(document).height()?$("body").height():$(document).height();$("html, body").animate({scrollTop:t-$(window).height()-e},500)},init:function(){Util.killIE(),Util.setTopBar(),Util.parseMarkdown()},replaceSideEm:function(e){for(var t=0;t