var users=new Array; var animating=false; var curTsL=0,curTsR=0; var tarTsL=4294967296,tarTsR=0; var curRtL=0,curRtR=0; var tarRtL=9999,tarRtR=0; var ctx; var w,h; var ratings=[0,1200,1400,1600,1900,2200,2300,2400,2600,2900,9999]; var ratingbg=["rgba(128,128,128,0.6)","rgba(0,255,0,0.6)","rgba(3,168,158,0.6)","rgba(0,0,255,0.6)","rgba(160,0,160,0.6)","rgba(255,140,0,0.6)","rgba(255,140,0,0.6)","rgba(255,0,0,0.6)","rgba(224,0,0,0.6)","rgba(204,0,0,0.6)"]; function init() { ctx=document.getElementById("cvs").getContext("2d"); w=document.getElementById("cvs").width; h=document.getElementById("cvs").height; } function min(a,b){return ab?a:b;} function randomColor(a) { var h=Math.floor(Math.random()*30)*12; return "hsla("+h+",90%,45%,"+a+")"; } function add() { if(animating)return; var req=new XMLHttpRequest(); req.onload=function(){ var r=JSON.parse(req.responseText); if(r.status!=="OK")return; if(!Array.isArray(r.result)||r.result.length==0)return; r.maxr=0;r.minr=9999;r.maxt=0;r.mint=4294967296;r.selected=false; r.color=randomColor(0.8);r.pendingremove=false;r.bold=false; if(tarTsL==0)tarTsL=4294967296; for(var i=0;itarRtR)tarRtR=1900,tarRtL=1000; if(tarTsL>tarTsR)tarTsL=tarTsR=0; animating=true; window.requestAnimationFrame(update); } function morph(a,b,s) { var ret=a;if(Math.abs(a-b)>s) ret+=s*(b-a)/Math.abs(a-b); else ret=b;return ret; } function interpolate(a,b,c,d,x) { var A=(d-c)/(b-a),B=c-a*A; return A*x+B; } function highlight(n,s) { users[n].bold=s;window.requestAnimationFrame(update); } function update() { var f=false; if(curTsL===0&&curTsR===0) {curTsL=tarTsL;curTsR=tarTsR;f=(tarTsL||tarTsR);} else { f|=Math.abs(curTsL-tarTsL)>432000; f|=Math.abs(curTsR-tarTsR)>432000; curTsL=morph(curTsL,tarTsL,max(Math.abs(curTsL-tarTsL)/5,432000)); curTsR=morph(curTsR,tarTsR,max(Math.abs(curTsR-tarTsR)/5,432000)); } if(curRtL===0&&curRtR===0) {curRtL=tarRtL;curRtR=tarRtR;f=true;} else { f|=Math.abs(curRtL-tarRtL)>10; f|=Math.abs(curRtR-tarRtR)>10; curRtL=morph(curRtL,tarRtL,max(Math.abs(curRtL-tarRtL)/5,10)); curRtR=morph(curRtR,tarRtR,max(Math.abs(curRtR-tarRtR)/5,10)); } ctx.clearRect(0,0,w,h); for(var i=0;i=0;--j) { if(users[i].result[j].drawRatingtarRtL){users[i].result[j].drawRating-=(max(tarRtR,users[i].result[j].newRating)-tarRtL)/20;f=true;} else{users[i].result[j].drawRating=0;} if(users[i].result[j].drawRating>users[i].result[j].newRating*0.8)break; } if(j==-1){users.splice(i,1);--i;continue;} for(j=users[i].result.length-1;j>=0;--j) if(users[i].result[j].ratingUpdateTimeSeconds