text: var activity=function(){let e=48;var t=function(){s(),n()},n=function(){$("#refresh").on("click",function(){let e=$(this);e.prop("disabled",!0).find(".text").text("Fetching..."),s().then(function(){e.prop("disabled",!1).find(".text").text("Refresh")})})},s=function(){return new Promise(e=>{$.ajax({method:"GET",url:"/user/fetch_activity?id="+user_id}).done(t=>{if($("#user-weets").empty(),$("#user-votes").empty(),t.error&&"no_such_user_id"==t.error)$("#user-name").text("No such user..."),$("#karma-point").text("???"),$("#user-streak").text("???"),$("#user-weets").append("<tr><td colspan=3>Invalid user ID..."),$("#user-votes").append("<tr><td colspan=4>Invalid user ID..."),$("#karma-refill").text("???");else{$("#karma-point").text(t.karma),$("#user-name").text(t.name),$("#user-email").text(t.email),$("#user-streak").text(t.winning_streak),$("#karma-refill").text(null==t.refill?"Not scheduled":moment(t.refill).fromNow());let e="";t.weets.forEach(t=>{let n=t.weet_is_evaluated?t.weet_is_published?'<td class="voteup">Published</td>':'<td class="votedown">Rejected</td>':"<td>Pending</td>";e+="<tr><td>"+moment(t.weet_date).fromNow()+"</td><td>"+r(t.weet_content)+"</td>"+n+"</tr>"}),$("#user-weets").append(e);let n="";t.votes.forEach(e=>{let t=e.weet_is_evaluated?e.weet_is_published?'<td class="voteup"><span class="glyphicon glyphicon-ok" /></td>':'<td class="votedown"><span class="glyphicon glyphicon-remove" /></td>':'<td class="evalpending"><span class="glyphicon glyphicon-time" /></td>',s=e.vote_up?'<td class="voteup"><span class="glyphicon glyphicon-arrow-up" /></td>':'<td class="votedown"><span class="glyphicon glyphicon-arrow-down" /></td>';n+="<tr><td>"+moment(e.vote_date).fromNow()+"</td><td>"+e.weeter_name+"</td><td>"+r(e.weet_content)+"</td>"+t+s+"</tr>"}),$("#user-votes").append(n)}e(!0)})})},r=function(t){return t.substring(0,e)+(t.length>e?"...":"")};return{init:t,update_karma:function(e,t){user_id==e&&$("#karma-point").text(t)},update_streak:function(e,t){user_id==e&&$("#user-streak").text(t)},update_name:function(e,t){user_id==e&&$("#user-name").text(t)}}}();