functioncountUp(b,a,d){if(b<a){varc=newCountUp(d,b,a);if(!c.error){c.start()}else{console.error(c.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}functiontacklePV(e,f,d,b){varc=countPV(f,e);c=(c==0?1:c);if(!b){d.text(newIntl.NumberFormat().format(c))}else{vara=parseInt(d.text().replace(/,/g,""));if(c>a){countUp(a,c,d.attr("id"))}}}functiondisplayPageviews(c){if(c===undefined){return}vara=getInitStatus();varb=c.rows;if($("#post-list").length>0){$(".post-preview").each(function(){vare=$(this).children("h1").children("a").attr("href");tacklePV(b,e,$(this).find(".pageviews"),a)})}else{if($(".post").length>0){vard=window.location.pathname;tacklePV(b,d,$("#pv"),a)}}}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)}})})}});