2018-04-10 02:38:18 -04:00
|
|
|
function hideLoader(){$(".layout-loading-icon").fadeOut()}function showLoader(){$(".layout-loading-icon").attr("style","visibility:visible");$(".layout-loading-icon").removeClass("text-danger");$(".layout-loading-icon").fadeIn()}function errorLoader(){$(".layout-loading-icon").addClass("text-danger")}function executeCommand(){const t=$("#console_server_select").val(),n=$("#console_command_value").val();if(n.length===0)return!1;if(n[0]!=="!")return $("#console_command_response").text("All commands must start with !").addClass("text-danger"),!1;showLoader();$.get("/Console/ExecuteAsync",{serverId:t,command:n}).done(function(n){hideLoader();$("#console_command_response").html(n);$("#console_command_value").val("")}).fail(function(n,t,i){errorLoader();hideLoader();$("#console_command_response").text("Could not execute command: "+i).addClass("text-danger")})}function loadMorePenalties(){showLoader();$.get("/Penalty/ListAsync",{offset:offset}).done(function(n){$("#penalty_table").append(n);hideLoader()}).fail(function(){errorLoader()});offset+=15}function penaltyToName(n){switch(n){case"Flag":return"Flagged";case"Warning":return"Warned";case"Report":return"Reported";case"Ban":return"Banned";case"Kick":return"Kicked";case"TempBan":return"Temp Banned";case"Unban":return"Unbanned"}}function shouldIncludePlural(n){return n>1?"s":""}function timeStep(n){let t=n/36e5,i=n/864e5,r=n/6048e5;return Math.round(r)>Math.round(currentStepAmount/24*7)?(currentStepAmount=Math.round(r),`${currentStepAmount} week${shouldIncludePlural(currentStepAmount)} ago`):Math.round(i)>Math.round(currentStepAmount/24)?(currentStepAmount=Math.round(i),`${currentStepAmount} day${shouldIncludePlural(currentStepAmount)} ago`):Math.round(t)>currentStepAmount?(currentStepAmount=Math.round(t),`${currentStepAmount} hour${shouldIncludePlural(currentStepAmount)} ago`):void 0}function loadMeta(n){let t="";const r=moment.utc(n.when).valueOf();mostRecentDate===0&&(mostRecentDate=r);const i=timeStep(moment.utc().valueOf()-r);i!==lastStep&&i!==undefined&&r>0&&($("#profile_events").append('<span class="p2 text-white profile-event-timestep"><span class="text-primary">—<\/span> '+i+"<\/span>"),lastStep=i);n.class.includes("Penalty")?t=n.value.punisherId!==clientInfo.clientId?`<div><span class="penalties-color-${n.value.type.toLowerCase()}">${penaltyToName(n.value.type)}</span> by <span class="text-highlight"> <a class="link-inverse" href="${n.value.punisherId}">${n.value.punisherName}</a></span > for <span style="color: white; ">${n.value.offense}</span></div>`:`<div><span class="penalties-color-${n.value.type.toLowerCase()}">${penaltyToName(n.value.type)} </span> <span class="text-highlight"><a class="link-inverse" href="${n.value.offenderId}"> ${n.value.offenderName}</a></span > for <span style="color: white; ">${n.value.offense}</span></div>`:n.key.includes("Alias")?t=`<div><span class="text-success">${n.value}</span></div>`:n.key.includes("Event")&&(t=`<div><span style="color:white;">></span><span class="text-muted"> ${n.value}</span></div>`);$("#profile_events").append(t)}function getPlayerHistoryChart(n,t,i,r){return n.forEach(function(t,i){n[i].x=new Date(n[i].x)}),new CanvasJS.Chart(`server_history_${t}`,{backgroundColor:"#191919",height:100,width:i,animationEnabled:!0,toolTip:{contentFormatter:function(n){const t=moment.utc(n.entries[0].dataPoint.x);return t.local().format("h:mm A")+" - "+n.entries[0].dataPoint.y+" players"}},axisX:{interval:1,gridThickness:0,lineThickness:0,tickThickness:0,margin:0,valueFormatString:" "},axisY:{gridThickness:0,lineThickness:0,tickThickness:0,minimum:0,margin:0,valueFormatString:" ",labelMaxWidth:0},legend:{maxWidth:0,maxHeight:0,dockInsidePlotArea:!0},data:[{showInLegend:!1,type:"splineArea",color:r,markerSize:0,dataPoints:n}]})}function refreshClientActivity(){$(".server-history-row").each(function(){let n=$(this).data("serverid");$.get({url:"/server/clientactivity/"+n,cache:!1}).done(function(t){const i=$(t).find(".col-6 span").length;$("#server_header_"+n+" .server-clientcount").text(i);$("#server_clientactivity_"+n).htm
|