-
Notifications
You must be signed in to change notification settings - Fork 0
/
canvasgraph-min.js
1 lines (1 loc) · 18.8 KB
/
canvasgraph-min.js
1
function FlashingMessage(e,t,n,r,i,s,o){this.x=n;this.y=r;this.t=0;this.maxt=s;this.fade=function(e){return(1-cos(i*e))/2};this.text=e;this.font=t;var u=ctx.font;ctx.font=t;this.textwidth=ctx.measureText(e).width;ctx.font=u;this.finished=false;this.oncomplete=o}function hideInfoPanels(){for(id in panels){$(id).hide();panels[id]=false}$(".textbox").hide()}function scrollView(e,t){if(minX>cwidth-200){if(e<0){viewOffset.x-=e}else{viewOffsetVel.x=-.5*viewOffsetVel.x}}else if(maxX<200){if(e>0){viewOffset.x-=e}else{viewOffsetVel.x=-.5*viewOffsetVel.x}}else{viewOffset.x-=e}if(minY>cheight-200){if(t<0){viewOffset.y-=t}else{viewOffsetVel.y=-.5*viewOffsetVel.y}}else if(maxY<200){if(t>0){viewOffset.y-=t}else{viewOffsetVel.y=-.5*viewOffsetVel.y}}else{viewOffset.y-=t}}function showPanel(e){var t=$(e).width(),n=$(e).height();$(e).css({left:(cwidth-t)/2+"px",top:(cheight-n)/2+"px"});$(e).fadeIn(400);$("#main").animate({backgroundColor:"#555555"},400);curPanel=e}function showTextbox(e){var t=$(e).width(),n=$(e).height();$(e).css({left:(mousePos.x-t)/2,top:(mousePos.y-n)/2});$(e).fadeIn(400)}function setMouseoverActive(e){mouseoverActive=e}function handleVertexMouseover(){var e=Vertex.find(mousePos.x,mousePos.y);if(e!=selVtxIndex){if(selVtxIndex!=-1){Vertex.all[selVtxIndex].mouseexit()}selVtxIndex=e;if(e!=-1){Vertex.all[e].mouseenter()}}}function init(){initializeMe();initializePhysicsLoop();Vertex.all[0].setFade(.6,500)}function fadeGraph(e){for(var t=0,n=Vertex.all.length;t<n;t++){Vertex.all[t].setFade(e,1e3)}for(var t=0,n=Edge.all.length;t<n;t++){Edge.all[t].setFade(e,1e3)}}function initializePhysicsLoop(){step()}function initializeMe(){if(Vertex.all.length==0){new Vertex("me",P(cwidth/2,cheight/2))}}function expandInit(){initialized=true;var e=cwidth/6,t=cheight/6,n=2*cwidth/3,r=2*cheight/3;var i=new Vertex("projects",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[0],Vertex.all[1]);i.setFade(.6,750);i=new Vertex("about",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[2],Vertex.all[0]);i.setFade(.6,750);i=new Vertex("contact",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[3],Vertex.all[0]);i.setFade(.6,750);i=new Vertex("resume",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[4],Vertex.all[0]);i.setFade(.6,750)}function expandContacts(){var e=cwidth/6,t=cheight/6,n=2*cwidth/3,r=2*cheight/3;var i=new Vertex("github",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[3]);i.setFade(.6,750);var i=new Vertex("linkedin",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[3]);i.setFade(.6,750);clearAll=true;setTimeout(function(){clearAll=false},500)}function collapseContacts(){var e={};for(var t=0;t<Vertex.all.length;t++){var n=Vertex.all[t];if(n.name in contactNames){n.setFade(.005,150);for(var r in n.adj){var i=n.adj[r];if(!(i.name in e)){i.setFade(.005,150);e[i.name]=true}}}}setTimeout(function(){for(var e=Vertex.all.length-1;e>=0;e--){var t=Vertex.all[e];if(t.name in contactNames){t.remove()}}contExpandLock=false},250)}function expandProjects(){var e=cwidth/6,t=cheight/6,n=2*cwidth/3,r=2*cheight/3;var i=new Vertex("dygraph",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[1]);i.setFade(.6,750);i=new Vertex("gomoku",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[1]);i.setFade(.6,750);i=new Vertex("qwop",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[1]);i.setFade(.6,750);i=new Vertex("pweb",randomXY(e,t,n,r));i.setFade(.6,750);i=new Edge(Vertex.all[Vertex.all.length-1],Vertex.all[1]);i.setFade(.6,750);clearAll=true;setTimeout(function(){clearAll=false},500)}function collapseProjects(){var e={};for(var t=0;t<Vertex.all.length;t++){var n=Vertex.all[t];if(n.name in projectNames){n.setFade(.005,150);for(var r in n.adj){var i=n.adj[r];if(!(i.name in e)){i.setFade(.005,150);e[i.name]=true}}}}setTimeout(function(){for(var e=Vertex.all.length-1;e>=0;e--){var t=Vertex.all[e];if(t.name in projectNames){t.remove()}}projExpandLock=false},250)}function drawAll(){for(var e=0;e<Edge.all.length;e++){Edge.all[e].draw()}for(var e=0;e<Vertex.all.length;e++){Vertex.all[e].draw()}if(scrollMessage){scrollMessage.draw()}}function update(){if(!doScroll){var e=viewOffsetAcc.x,t=viewOffsetAcc.y,n=viewOffsetVel.x,r=viewOffsetVel.y;scrollView(n,r);viewOffsetVel.x*=.95;viewOffsetVel.y*=.95}minX=cwidth;minY=cheight;maxX=0;maxY=0;for(var i=0;i<Vertex.all.length;i++){var s=Vertex.all[i];var o=s.vPos.x,u=s.vPos.y;if(s.vPos.x<minX){minX=o}if(s.vPos.y<minY){minY=u}if(s.vPos.x>maxX){maxX=o}if(s.vPos.y>maxY){maxY=u}minX=minX<0?0:minX;minY=minY<0?0:minY;maxX=maxX>cwidth?cwidth:maxX;maxY=maxY>cheight?cheight:maxY;for(var a=i+1;a<Vertex.all.length;a++){var f=Vertex.all[a];var l=f.gPos.x-s.gPos.x,c=f.gPos.y-s.gPos.y;var h=l*l+c*c+1;var p=sqrt(h);var d=min(REPULSION/(h*p),10);var v=l*d,m=c*d;s.acc.x-=v;s.acc.y-=m;f.acc.x+=v;f.acc.y+=m;if(s.hasEdge(f)){v=l*ATTRACTION;m=c*ATTRACTION;s.acc.x+=v;s.acc.y+=m;f.acc.x-=v;f.acc.y-=m}}}for(var i=0,g=Vertex.all.length;i<g;i++){var y=Vertex.all[i];var b=-y.vel.x*DRAG,w=-y.vel.y*DRAG;offset(y.acc,b,w);offset(y.gPos,y.vel);offset(y.vel,y.acc);y.vPos=getViewPos(y.gPos);y.acc.x=0;y.acc.y=0}}function step(){var e=document.hasFocus();if(e){update();if(framecount>60){clear(true);framecount=0}else{clear(false);framecount++}drawAll()}window.requestAnimationFrame(step)}function Vertex(e,t,n){if(n==undefined){this.gPos=t}else{this.gPos=P(t,n)}this.state=IDLE;this.name=e;this.img=icons[e];this.adj={};this.vPos=getViewPos(this.gPos);if(e=="linkedin"){this._ringImg=ring0}else{this._ringImg=rings[floor(rings.length*random())]}this.labelText=labels[e][0];this.labelFont=labels[e][1];this.labelShiftX=-this.img.width/2;this.labelShiftY=this.img.height;this.opacity=0;this.vel=P(0,0);this.acc=P(0,0);Vertex.all.push(this);this.fadeTimeRemaining=0;this.fadeAmount=0}function Edge(e,t){this.v1=e;this.v2=t;this.name=e.name+"-"+t.name;Edge.all.push(this);e.adj[t.name]=this;t.adj[e.name]=this;this.opacity=0;this.fadeTimeRemaining=0;this.fadeAmount=0}function randomXY(e,t,n,r){return P(n*random()+e,r*random()+t)}function clear(e){if(e||clearAll){ctx.clearRect(0,0,canv.width,canv.height)}else{for(var t=0,n=Edge.all.length;t<n;t++){Edge.all[t].clear()}for(var t=0,n=Vertex.all.length;t<n;t++){Vertex.all[t].clear()}}if(scrollMessage){scrollMessage.clear()}}function getViewPos(e){return P((e.x-viewOffset.x)*cwidth/viewSpan.x,(e.y-viewOffset.y)*cheight/viewSpan.y)}function prepareFont(e,t){drawText("",0,0,"8px "+e);t()}function drawText(e,t,n,r){if(r!=undefined){var i=ctx.font;ctx.font=r;ctx.fillText(e,t,n);ctx.font=i}else{ctx.fillText(e,t,n)}}function drawImage(e,t,n,r){if(r){ctx.drawImage(e,t-e.width/2,n-e.height/2)}else{ctx.drawImage(e,t,n)}}function drawBrush(e,t){var n=t.x-e.x;var r=t.y-e.y;var i=atan2(r,n);var s=brush.width*cos(i);var o=brush.width*sin(i);ctx.translate(e.x,e.y);ctx.rotate(i+PI);drawImage(brush,-brush.width,-brush.height+2.5);ctx.rotate(-i-PI);ctx.translate(-e.x,-e.y);ctx.translate(t.x,t.y);ctx.rotate(i);drawImage(brush,-brush.width,-brush.height+2.5);ctx.rotate(-i);ctx.translate(-t.x,-t.y);drawLine(P(e.x+s,e.y+o),P(t.x-s,t.y-o),5,"#000000")}function drawCroppedImage(e,t,n,r){var i=e.width/2,s=e.height/2;r=r==undefined?i-1:r;ctx.save();ctx.beginPath();ctx.arc(t,n,r,0,2*Math.PI);ctx.closePath();ctx.clip();ctx.drawImage(e,t-i,n-s);ctx.restore()}function drawLine(e,t,n,r){var i=ctx.lineWidth;var s=ctx.strokeStyle;n=n?n:1;r=r?r:"#000000";ctx.lineWidth=n;ctx.strokeStyle=r;ctx.beginPath();ctx.moveTo(e.x,e.y);ctx.lineTo(t.x,t.y);ctx.stroke();ctx.lineWidth=i;ctx.strokeStyle=s}function sgn(e){return e==0?0:e<0?-1:1}function P(e,t){return{x:e,y:t}}function offset(e,t,n){if(n==undefined){e.x+=t.x;e.y+=t.y}else{e.x+=t;e.y+=n}}function reduce(e,t,n){if(n==undefined){}else{if(e.x>0){e.x-=t;if(e.x<0){e.x=0}}else if(e.x<0){e.x+=t;if(e.x>0){e.x=0}}if(e.y>0){e.y-=n;if(e.y<0){e.y=0}}else if(e.y<0){e.y+=t;if(e.y>0){e.y=0}}}}function sqdist(e,t){var n=t.x-e.x;var r=t.y-e.y;return n*n+r*r}function dist(e,t){var n=t.x-e.x;var r=t.y-e.y;return sqrt(n*n+r*r)}function hideCurrentPanel(){if(curPanel){$("#main").animate({backgroundColor:"white"},400);$(curPanel).fadeOut(400);curPanel=null}}function link(e,t){t=t||"_blank";window.open(e,t)}window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;var PI=Math.PI,round=Math.round,abs=Math.abs,sqrt=Math.sqrt,pow=Math.pow,max=Math.max,min=Math.min,sin=Math.sin,cos=Math.cos,floor=Math.floor,tan=Math.tan,atan2=Math.atan2,random=Math.random;var canv=document.getElementById("main");canv.width=$(window).width();canv.height=$(window).height();var cwidth=canv.width;var cheight=canv.height;var ctx=canv.getContext("2d");var FPS=60;var TIMESTEPMS=1e3/FPS;var viewOffset=P(0,0);var viewOffsetVel=P(0,0);var viewOffsetAcc=P(0,0);var viewSpan=P(canv.width,canv.height);var ring0=new Image;ring0.src="graph/drawn0.png";var ring1=new Image;ring1.src="graph/drawn1.png";var ring2=new Image;ring2.src="graph/drawn2.png";var ring3=new Image;ring3.src="graph/drawn3.png";var ring4=new Image;ring4.src="graph/drawn4.png";var rings=[ring0,ring1,ring2,ring3,ring4];var brush=new Image;brush.src="graph/brush_end_thin.png";var dot=new Image;dot.src="graph/dot.png";var me=new Image;me.src="icons/me.png";var projects=new Image;projects.src="icons/projects.png";var about=new Image;about.src="icons/about.png";var contact=new Image;contact.src="icons/contact.png";var resume=new Image;resume.src="icons/resume.png";var dygraph=new Image;dygraph.src="icons/dygraph.png";var gomoku=new Image;gomoku.src="icons/gomoku.png";var pweb=new Image;pweb.src="icons/pweb.png";var qwop=new Image;qwop.src="icons/qwop.png";var gmail=new Image;gmail.src="icons/gmail.png";var linkedin=new Image;linkedin.src="icons/linkedin.png";var github=new Image;github.src="icons/github.png";var icons={me:me,projects:projects,about:about,contact:contact,resume:resume,dygraph:dygraph,gomoku:gomoku,pweb:pweb,qwop:qwop,gmail:gmail,linkedin:linkedin,github:github};var labels={me:["Wenson","48px joecasual"],projects:["Projects","40px joecasual"],about:["About","40px joecasual"],contact:["Contact","40px joecasual"],resume:["Resume","40px joecasual"],dygraph:["DyGraph","28px joecasual"],gomoku:["Gomoku AI","28px joecasual"],pweb:["Personal Website","28px joecasual"],qwop:["Q(wop)","28px joecasual"],gmail:["Gmail","28px joecasual"],github:["Github","28px joecasual"],linkedin:["LinkedIn","28px joecasual"]};var projectNames={dygraph:true,qwop:true,gomoku:true,pweb:true};var contactNames={gmail:true,linkedin:true,github:true};var panels={"#about":false,"#gomoku":false,"#dygraph":false,"#qwop":false,"#pweb":false};var curPanel=null;var VERTEX_RADIUS=32;var REPULSION=2e5;var ATTRACTION=.015;var EQUILIBRIUM=25;var DRAG=.9;var minX=cwidth/2,minY=cheight/2,maxX=cwidth/2,maxY=cheight/2;var initialized=false;var mousePos=P(cwidth/2,cheight/2);var prevMousePos=P(cwidth/2,cheight/2);var prevMouseVel=P(0,0);var mouseVel=P(0,0);var mouseAcc=P(0,0);var canvRect=canv.getClientRects()[0];var ctop=canvRect.top,cleft=canvRect.left;var cWHRatio=cwidth/cheight;var IDLE=0;var HIGHLIGHTED=1;var selVtxIndex=-1;var mouseoverActive=true;var framecount=0;var doScroll=false;var clearAll=false;var projExpand=false;var projExpandLock=false;var contExpand=false;var contExpandLock=false;var scrollMessage=null;FlashingMessage.prototype.clear=function(){if(!this.finished){ctx.clearRect(this.x-10,this.y-50,this.textwidth+20,100)}};FlashingMessage.prototype.draw=function(){if(!this.finished&&this.t<this.maxt){var e=ctx.globalAlpha;ctx.globalAlpha=this.fade(this.t);this.t++;drawText(this.text,this.x,this.y,this.font);ctx.globalAlpha=e}else{this.oncomplete();this.finished=true}};$(window).resize(function(){canv.width=$(window).width();canv.height=$(window).height();cwidth=canv.width;cheight=canv.height;canvRect=canv.getClientRects()[0];ctop=canvRect.top,cleft=canvRect.left;cWHRatio=cwidth/cheight});canv.onmousemove=function(e){if(doScroll){var t=e.clientX-mousePos.x,n=e.clientY-mousePos.y;scrollView(t,n);viewOffsetVel.x=mouseVel.x;viewOffsetVel.y=mouseVel.y;viewOffsetAcc.x=mouseAcc.x;viewOffsetAcc.y=mouseAcc.y}prevMousePos.x=mousePos.x;prevMousePos.y=mousePos.y;mousePos.x=e.clientX;mousePos.y=e.clientY;prevMouseVel.x=mouseVel.x;prevMouseVel.y=mouseVel.y;mouseVel.x=mousePos.x-prevMousePos.x;mouseVel.y=mousePos.y-prevMousePos.y;mouseAcc.x=mouseVel.x-prevMouseVel.x;mouseAcc.y=mouseVel.y-prevMouseVel.y;handleVertexMouseover()};canv.onmouseout=function(e){doScroll=false;setTimeout(function(){if(!doScroll){clearAll=false}},500)};canv.onmouseup=canv.onmouseout;canv.onmousedown=function(e){mousePos.x=e.clientX;mousePos.y=e.clientY;var t=Vertex.find(mousePos.x,mousePos.y);if(t==-1){hideCurrentPanel();doScroll=true;clearAll=true}else{var n=Vertex.all[t].name;switch(n){case"me":hideCurrentPanel();var r=cwidth/6,i=cheight/6,s=2*cwidth/3,o=2*cheight/3;setMouseoverActive(false);for(var u=1;u<Vertex.all.length;u++){Vertex.all[u].setFade(.005,250)}for(var u=0,a=Edge.all.length;u<a;u++){Edge.all[u].setFade(.005,250)}setTimeout(function(){Edge.all=[];Vertex.all=[Vertex.all[0]];canv.width=canv.width;expandInit();clearAll=true;for(var e=1,t=Vertex.all.length;e<t;e++){Vertex.all[e].setFade(.6,500)}for(var e=0,t=Edge.all.length;e<t;e++){Edge.all[e].setFade(.6,500)}setMouseoverActive(true);setTimeout(function(){clearAll=false;projExpand=false;contExpand=false},500)},750);break;case"projects":if(!projExpandLock){if(!projExpand){projExpandLock=true;expandProjects();projExpand=true;projExpandLock=false}else{projExpandLock=true;collapseProjects();projExpand=false}}break;case"about":if(curPanel){hideCurrentPanel()}else{curPanel="#about";showPanel(curPanel)}break;case"contact":if(!contExpandLock){if(!contExpand){contExpandLock=true;expandContacts();contExpand=true;contExpandLock=false}else{contExpandLock=true;collapseContacts();contExpand=false}}break;case"resume":link("whsieh-resume.pdf");break;case"dygraph":if(curPanel){hideCurrentPanel()}else{curPanel="#dygraph";showPanel(curPanel)}break;case"gomoku":if(curPanel){hideCurrentPanel()}else{curPanel="#gomoku";showPanel(curPanel)}break;case"qwop":if(curPanel){hideCurrentPanel()}else{curPanel="#qwop";showPanel(curPanel)}break;case"pweb":if(curPanel){hideCurrentPanel()}else{curPanel="#pweb";showPanel(curPanel)}break;case"github":if(curPanel){hideCurrentPanel()}else{link("http://www.github.com/whsieh")}break;case"linkedin":if(curPanel){hideCurrentPanel()}else{link("http://www.linkedin.com/in/whsieh")}break}}};Vertex.prototype.draw=function(){var e=ctx.globalAlpha;ctx.globalAlpha=this.opacity;if(this.fadeTimeRemaining>0){this.fadeTimeRemaining--;this.opacity+=this.fadeAmount}drawCroppedImage(this.img,this.vPos.x,this.vPos.y,31);drawImage(this._ringImg,this.vPos.x,this.vPos.y,true);drawText(this.labelText,this.vPos.x+this.labelShiftX,this.vPos.y+this.labelShiftY,this.labelFont);ctx.globalAlpha=e};Vertex.prototype.contains=function(e,t){var n=16+this._ringImg.width/2,r=this.vPos.x-e,i=this.vPos.y-t;return r*r+i*i<n*n};Vertex.prototype.setFade=function(e,t){if(t==undefined){t=TIMESTEPMS}t=round(t/TIMESTEPMS);this.fadeAmount=(e-this.opacity)/t;this.fadeTimeRemaining=t};Vertex.prototype.mouseenter=function(){this.state=HIGHLIGHTED;this.setFade(1,100);if(!initialized&&this.name=="me"){expandInit()}};Vertex.prototype.mouseexit=function(){this.state=IDLE;this.setFade(.6,100)};Vertex.prototype.clear=function(){var e=this.img.width,t=this.img.height;ctx.clearRect(this.vPos.x-e/2-75,this.vPos.y-t/2-75,e-2*this.labelShiftX+200,t+200)};Vertex.prototype.sqdist=function(e){return sqdist(e.gPos,this.gPos)};Vertex.prototype.gdist=function(e){return dist(e.gPos,this.gPos)};Vertex.prototype.vdist=function(e){return dist(e.vPos,this.vPos)};Vertex.prototype.hasEdge=function(e){return e.name in this.adj};Vertex.prototype.setPosition=function(e,t){this.gPos.x=e;this.gPos.y=t;this.vPos=getViewPos(this.gPos)};Vertex.prototype.remove=function(){for(var e in this.adj){this.adj[e].remove()}for(var t=0;t<Vertex.all.length;t++){if(Vertex.all[t].name==this.name){Vertex.all.splice(t,1);break}}};Vertex.find=function(e,t){if(mouseoverActive){for(var n=0;n<Vertex.all.length;n++){if(Vertex.all[n].contains(e,t)){return n}}}return-1};Vertex.all=[];Edge.prototype.clear=function(){var e=this.v2.vPos.x-this.v1.vPos.x,t=this.v2.vPos.y-this.v1.vPos.y;var n=atan2(t,e);ctx.translate(this.v1.vPos.x,this.v1.vPos.y);ctx.rotate(n);ctx.clearRect(0,-25,this.v1.vdist(this.v2),50);ctx.rotate(-n);ctx.translate(-this.v1.vPos.x,-this.v1.vPos.y)};Edge.prototype.setFade=function(e,t){if(t==undefined){t=TIMESTEPMS}t=round(t/TIMESTEPMS);this.fadeAmount=(e-this.opacity)/t;this.fadeTimeRemaining=t};Edge.prototype.draw=function(){var e=ctx.globalAlpha;ctx.globalAlpha=this.opacity;if(this.fadeTimeRemaining>0){this.fadeTimeRemaining--;this.opacity+=this.fadeAmount}var t=this.v2.vPos.x-this.v1.vPos.x,n=this.v2.vPos.y-this.v1.vPos.y,r=dist(this.v1.vPos,this.v2.vPos);var i=atan2(n,t),s=cos(i),o=sin(i);var u=VERTEX_RADIUS*s,a=VERTEX_RADIUS*o;var f=P(this.v1.vPos.x+u,this.v1.vPos.y+a),l=P(this.v2.vPos.x-u,this.v2.vPos.y-a);if(r>200){drawBrush(f,l)}else if(r>72){var c=r/20;var h=c*s,p=c*o;offset(f,2*sgn(h),2*sgn(p));offset(l,-2*sgn(h),-2*sgn(p));drawLine(f,l,1.1,"#");offset(f,h,p);offset(l,-h,-p);drawLine(f,l,1.5,"#000000");offset(f,h,p);offset(l,-h,-p);for(var d=2.5;d<5;d+=.5){drawLine(f,l,d,"#000000");offset(f,h,p);offset(l,-h,-p)}}ctx.globalAlpha=e};Edge.prototype.remove=function(){delete this.v1.adj[this.v2.name];delete this.v2.adj[this.v1.name];for(var e=0;e<Edge.all.length;e++){if(Edge.all[e].name==this.name){Edge.all.splice(e,1);break}}};Edge.all=[];for(var panel in panels){$(panel).click(function(){hideCurrentPanel()})}hideInfoPanels();setTimeout(function(){prepareFont("joecasual",init)},500);setTimeout(function(){scrollMessage=new FlashingMessage("Click & drag to scroll","24px joecasual",50,50,.05236,360,function(){scrollMessage=null;setTimeout(function(){scrollMessage=new FlashingMessage("Click & drag to scroll","24px joecasual",50,50,.05236,360,function(){scrollMessage=null})},1e4)})},5e3);$(document).keyup(function(e){if(e.keyCode==27){hideCurrentPanel()}});$("#about-algo").click(function(e){link("https://github.com/whsieh/DyGraph/blob/master/src/stat/comm/CommunityTransformer.java");e.stopPropagation()});$("#about-dnd").click(function(e){link("https://github.com/whsieh/warscribe");e.stopPropagation()});$("#gomoku-dl").click(function(e){link("dl/gomoku.jar");e.stopPropagation()});$("#qwop-app").click(function(e){link("app/game.html");e.stopPropagation()});$(".exp-div").click(function(e){e.stopPropagation();if($(this).attr("exp")==="1"){$(this).attr("exp","0");$(this).animate({width:"100px",height:"100px"},250)}else{$(this).attr("exp","1");$(this).animate({width:"500px",height:"500px"},250)}});$(".exp-div").hover(function(e){$(this).animate({opacity:1},100)},function(e){console.log($(this).attr("exp"));if($(this).attr("exp")===undefined||$(this).attr("exp")==="0"){$(this).animate({opacity:.4},100)}})