functioncountUp(c,a,b){if(c<a){vard=newCountUp(b,c,a);if(!d.error){d.start()}else{console.error(d.error)}}}functioncountPV(f,e){varg=f.replace(/\/posts\//g,"").replace(/\//g,".html");vard=0;varc=f.replace(/posts\//g,"");for(varb=0;b<e.length;++b){vara=e[b][0];if(a==f||a==c||a.concat("/")==c||a.slice(a.lastIndexOf("/")+1)===g){d+=parseInt(e[b][1])}}returnd}functiondisplayPageviews(e){if(e===undefined){return}varb=getInitStatus();vard=e.rows;if($("#post-list").length>0){$(".post-preview").each(function(){vari=$(this).children("h1").children("a").attr("href");varh=countPV(i,d);h=(h==0?1:h);if(!b){$(this).find(".pageviews").text(h)}else{varg=parseInt($(this).find(".pageviews").text());if(h>g){countUp(g,h,$(this).find(".pageviews").attr("id"))}}})}else{if($(".post").length>0){varf=window.location.pathname;varc=countPV(f,d);c=(c==0?1:c);if(!b){$("#pv").text(c)}else{vara=parseInt($("#pv").text());if(c>a){countUp(a,c,"pv")}}}}}vargetInitStatus=(function(){vara=false;returnfunction(){if(a){returntrue}else{a=true;returnfalse}}})();$(function(){if($(".pageviews").length>0){$.getJSON("/assets/data/pageviews.json",displayPageviews);$.getJSON("/assets/data/proxy.json",function(a){$.ajax({type:"GET",url:a.proxyUrl,dataType:"jsonp",jsonpCallback:"displayPageviews",error:function(b,d,c){console.log("Failed to load pageviews from proxy server: "+c)}})})}});