-
Notifications
You must be signed in to change notification settings - Fork 0
/
poker.min.js
2 lines (2 loc) · 10 KB
/
poker.min.js
1
2
/**https://github.com/Tairraos/Poker.JS*/
(function(){if(window.CanvasRenderingContext2D){var v="#000",u="#a22",t="#b55",r="#fdf98b",q="#e7bd4f",p=200,n=150,l=155,k=16,j=93,h=24,g=40,f=10,e=13,d=document,c=CanvasRenderingContext2D.prototype,b=Math.PI,x={a:"M6,200V183H23L58,0H78L117,183H131V200H85V183H97L92,156H46L42,183H54V200H6zM88,135L68,37L49,135H88z","2":"M10,200L11,187C15,149,23,136,70,97C93,78,100,68,101,57C104,31,81,23,65,23C46,22,23,34,35,62L12,68C8,43,12,18,33,8C61,-6,96,-1,115,21C127,36,129,56,123,72C104,113,39,131,35,179H105V152H127V200L10,200z","3":"M2,156L18,145C31,167,47,181,70,178C104,176,119,140,112,113C105,89,76,77,53,90C47,93,43,96,41,96C39,96,33,85,34,82C50,59,87,21,87,21H28V47H6V0H120V16C120,16,90,48,80,64C104,65,125,81,132,105C136,118,135,148,129,160C119,182,94,199,71,200C33,202,12,176,2,156L2,156z","4":"M70,200L70,183L86,183L86,153L5,153L5,133L93,0L107,0L107,133L132,133L132,153L107,153L107,183L120,183L120,200zM86,49L30,133L86,133z","5":"M4,148L24,148C28,160,37,173,48,176C80,183,101,166,108,144C116,120,107,84,85,71C67,61,40,70,27,92L13,83L20,0H112V20H37L37,55C52,44,77,44,93,52C123,66,137,98,131,137C123,175,105,197,64,200C20,201,4,170,4,148L4,148z","6":"M8,139C6,122,6,78,8,65C15,26,30,7,55,2C81,-4,116,3,124,35L103,36C91,14,60,15,46,29C34,37,28,68,30,70C30,70,50,55,73,55C120,55,132,94,130,127C129,167,116,198,73,200C31,198,12,177,8,139zM110,128C111,101,98,80,73,77C50,76,26,99,27,127C29,155,40,179,69,179C101,179,110,147,110,128z","7":"M37,200C50,131,65,79,102,22H26V46H6V0H117L131,22C91,64,54,202,61,200H37z","8":"M2,142C3,115,13,105,32,90C17,79,10,63,12,50C15,17,41,0,69,0C98,1,123,24,125,48C127,69,120,79,105,90C123,105,135,115,135,141C134,168,111,199,71,200C31,201,1,168,2,142L2,142zM113,142C115,117,93,101,69,101C45,101,23,121,23,143C23,166,51,178,69,178C91,178,112,163,113,142L113,142zM105,55C106,34,87,20,67,21C50,21,31,34,31,51C31,72,52,83,70,83C86,84,105,71,105,55L105,55z","9":"MM11,161L30,156C37,174,52,180,67,178C94,176,102,146,104,120C94,131,78,137,64,136C21,134,10,100,10,65C9,35,21,13,43,3C55,-1,81,-1,92,4C118,18,128,42,126,98C126,144,117,198,66,200C36,204,14,181,11,161L11,161zM85,111C94,105,98,100,102,92C106,86,106,83,106,69C103,36,86,17,60,21C44,23,36,31,33,46C24,73,35,105,55,112C63,116,78,115,85,111L85,111z","0":"M6,200V0H26V200H6M85,0C66,0,50,17,50,39V162C50,183,66,200,85,200H96C115,200,130,183,130,162V39C130,17,115,0,96,0H85M90,19C102,19,110,28,110,38V163C110,174,102,183,90,183C79,183,70,174,70,163V38C70,28,79,19,90,19L90,19z",j:"M68,0V21H88C88,21,89,41,89,84C89,126,90,146,88,158C81,185,40,185,32,166C27,155,28,146,28,134H6C6,134,6,140,6,147C6,178,17,193,41,198C65,204,95,194,105,174C111,162,111,161,111,89C111,41,111,21,111,21H130V0H68z",q:"M24,134L6,134L6,112L24,112C24,112,24,60,24,40C24,18,40,0,66,0C92,0,110,18,110,40C110,62,111,148,110,155C110,168,108,170,108,171C110,176,130,178,130,177L130,199C115,201,109,199,96,190C88,198,65,205,46,196C32,190,24,174,24,134zM81,174C73,162,58,145,44,140C44,156,46,165,51,171C59,181,71,183,81,174zM66,22C50,22,44,30,44,70C44,94,44,116,44,116C67,123,90,150,90,150L90,70C90,30,82,22,66,22z",k:"M76,180L96,180L64,106L40,142L40,180L56,180L56,200L0,200L0,180L20,180L20,20L0,20L0,0L56,0L56,20L40,20L40,100L92.0636,19.841L76,20L76,0L136,0L136,20L120,20L76,88L116,180L136,180L136,200L76,200z",o:"M141,0L181,0C168,55,161,150,129,183C91,219,15,198,21,141L60,137C58,157,62,166,81,166C102,165,110,143,115,118M6,378C6,306,53,256,119,256C197,256,213,346,187,398C164,438,130,458,88,459C39,458,7,422,6,378M47,377C49,406,67,425,93,425C168,423,182,292,115,290C69,294,47,338,47,377M0,714L42,518L84,518L66,601L159,518L215,518L124,595L191,714L144,714L94,621L55,654L42,714M8,973L50,777L200,777L193,809L85,809L75,854L180,854L173,887L68,887L56,940L173,940L166,973M43,1231L1,1231L44,1035L133,1035C170,1037,197,1051,198,1087C195,1127,169,1143,136,1148C158,1171,171,1206,182,1231L137,1231C116,1182,112,1150,60,1150M67,1121C96,1121,155,1126,156,1087C151,1061,100,1068,78,1068z",h:"M100,30C60,7,0,7,0,76C0,131,100,190,100,190C100,190,200,131,200,76C200,7,140,7,100,30z",d:"M184,100C152,120,120,160,100,200C80,160,48,120,16,100C48,80,80,40,100,0C120,40,152,80,184,100z",s:"M200,120C200,168,144,176,116,156C116,180,116,188,128,200C112,196,88,196,72,200C84,188,84,180,84,156C56,176,0,168,0,120C0,72,60,36,100,0C140,36,200,72,200,120z",c:"M80,200C92,184,92,160,92,136C76,180,0,176,0,124C0,80,40,76,68,88C80,92,80,88,72,84C44,64,40,0,100,0C160,0,156,64,128,84C120,88,120,92,132,88C160,76,200,80,200,124C200,176,124,180,108,136C108,160,108,184,120,200C100,196,100,196,80,200z",r:"M44,60,C45,56,-3,33,0,70,C2,107,39,146,48,150,C57,154,12,107,12,77,C12,45,43,65,44,60,M37,65,C31,64,20,60,19,81,C19,100,63,158,65,149,C65,139,33,102,37,65,M86,56,C87,52,38,28,40,66,C43,103,69,141,78,148,C86,155,54,102,54,71,C54,39,86,60,86,56,M82,65,C77,64,59,54,59,74,C60,95,82,146,84,138,C86,132,78,102,82,65,M154,60,C153,56,203,33,200,70,C197,107,159,146,151,150,C142,154,187,107,187,77,C187,45,155,65,154,60,M161,65,C167,64,179,60,180,81,C181,100,137,158,135,149,C134,139,165,102,161,65,M113,56,C112,52,161,28,158,66,C155,103,130,141,122,148,C114,155,145,102,145,71,C145,39,114,60,113,56,M117,65,C123,64,141,54,141,74,C140,95,118,146,116,138,C114,132,121,102,117,65z"},o=function(z){var y=arguments.callee.caller.arguments;return y[0]+z*y[2]/p},m=function(z){var y=arguments.callee.caller.arguments;return y[1]+z*y[2]/p},s=function(y){return y*arguments.callee.caller.arguments[2]/p},a=function(z){var y=d.createElement("canvas");y.height=z;y.width=z*3/4;return y},w=function(y){return(y||"h").substr(0,1).toLowerCase()},i=function(y){y=(y||"o").toString().toLowerCase();return y.substr((y.match(/jo|10|cr/))?1:0,1)};c.drawPokerCard=function(A,G,B,C,z){var D=this,F=D.fillPokerSymbol,E=D.drawPokerCrown;C=w(C);z=i(z);D.drawEmptyCard(o(0),m(0),s(p));D.fillStyle=(C==="h"||C==="d")?u:v;if(B>=100){if(z!=="o"){F.call(D,o(g),m(65),s(70),C);F.call(D,o(f),m(f),s(g),z);F.call(D,o(11),m(55),s(25),C);F.call(D,o(140),m(190),s(-g),z);F.call(D,o(139),m(145),s(-25),C)}else{F.call(D,o(11),m(f),s(18),"o");F.call(D,o(139),m(190),s(-18),"o");if(C==="h"||C==="d"){E.call(D,o(38),m(63),s(74),t,u);E.call(D,o(g),m(65),s(70),r,q,u)}else{E.call(D,o(38),m(63),s(74),v,v);E.call(D,o(g),m(65),s(70),"#eee","#888","#333")}}}else{if(z!=="o"){F.call(D,o(30),m(75),s(100),C);F.call(D,o(15),m(15),s(50),z)}else{F.call(D,o(11),m(f),s(22),"o");if(C==="h"||C==="d"){E.call(D,o(45),m(73),s(89),t,u);E.call(D,o(47),m(75),s(85),r,q,u)}else{E.call(D,o(45),m(73),s(89),v,v);E.call(D,o(47),m(75),s(85),"#eee","#888","#333")}}}};c.drawPokerBack=function(z,G,C,B,A){var D=this,F=D.fillPokerSymbol,E=D.fillRoundRect;B=B||t;A=A||u;D.drawEmptyCard(z,G,C);D.fillStyle=A;E.call(D,o(f),m(f),s(130),s(180),s(8));D.strokeStyle=B;D.strokeRoundRect(o(18),m(18),s(114),s(164),s(4));D.fillStyle=B;E.call(D,o(26),m(26),s(96),s(148),s(h),true);F.call(D,o(h),m(h),s(20),"s");F.call(D,o(106),m(h),s(20),"s");F.call(D,o(44),m(176),s(-20),"s");F.call(D,o(126),m(176),s(-20),"s");D.fillStyle=A;E.call(D,o(50),m(g),s(50),s(120),s(h));F.call(D,o(32),m(54),s(86),"s");F.call(D,o(30),m(60),s(k),"s");F.call(D,o(104),m(60),s(k),"s");F.call(D,o(30),m(128),s(k),"s");F.call(D,o(104),m(128),s(k),"s");D.strokePokerSymbol(o(31),m(53),s(88),"s");D.fillStyle=B;F.call(D,o(50),m(75),s(50),"c")};c.roundRect=function(B,F,C,A,z,E){var D=this;C=C||p;A=A||p;z=z||20;D.beginPath();if(!E){D.moveTo(B+z,F);D.lineTo(B+C-z,F);D.arc(B+C-z,F+z,z,(b/180)*270,0);D.lineTo(B+C,F+A-z);D.arc(B+C-z,F+A-z,z,0,(b/2));D.lineTo(B+z,F+A);D.arc(B+z,F+A-z,z,(b/2),b);D.lineTo(B,F+z);D.arc(B+z,F+z,z,b,(b/180)*270)}else{D.moveTo(B,F+z);D.lineTo(B,F+A-z);D.arc(B,F+A,z,(b/180)*270,0);D.lineTo(B+C-z,F+A);D.arc(B+C,F+A,z,b,(b/180)*270);D.lineTo(B+C,F+z);D.arc(B+C,F,z,b/2,b);D.lineTo(B+z,F);D.arc(B,F,z,0,b/2)}D.closePath()};c.strokeRoundRect=function(B,E,C,A,z,D){this.roundRect(B+0.5,E+0.5,C-1,A-1,z,D);this.stroke()};c.fillRoundRect=function(B,E,C,A,z,D){this.roundRect(B,E,C,A,z,D);this.fill()};c.svgCurve=function(J,I,L,A){var B=this,G,F,C,D,H,E,z=function(y){return(G=J+y*L/p)},K=function(y){return(F=I+y*L/p)};H=A.replace(/ *([MZLHVCSQTA]) */gi,"|$1,").replace(/^\||\|[Z],/gi,"").split(/\|/);B.beginPath();for(C in H){D=H[C].split(/[, ]/);E=D[0];(E==="M")?(B.moveTo(z(D[1]),K(D[2]))):(E==="L")?(B.lineTo(z(D[1]),K(D[2]))):(E==="H")?(B.lineTo(z(D[1]),F)):(E==="V")?(B.lineTo(G,K(D[1]))):(E==="C")?(B.bezierCurveTo(z(D[1]),K(D[2]),z(D[3]),K(D[4]),z(D[5]),K(D[6]))):(E==="Q")&&(B.quadraticCurveTo(z(D[1]),K(D[2]),z(D[3]),K(D[4])))}B.closePath()};c.drawPokerSymbol=function(z,C,A,B){B=i(B);if(x[B]){this.svgCurve(z,C,A,x[B])}};c.strokePokerSymbol=function(z,C,A,B){this.drawPokerSymbol(z+0.5,C+0.5,A-1,B);this.stroke()};c.fillPokerSymbol=function(z,C,A,B){this.drawPokerSymbol(z,C,A,B);this.fill()};c.drawPokerCrown=function(H,F,I,E,D,B){var z=this,C=z.fillPokerSymbol,A=z.fillRoundRect,G;E=E||r;D=D||q;B=B||"#fff";G=z.createLinearGradient(o(5),m(5),o(100),m(p));G.addColorStop(0,E);G.addColorStop(1,D);z.fillStyle=G;C.call(z,o(0),m(0),s(p),"r");A.call(z,o(88),m(42),s(23),s(110),s(12));C.call(z,o(86),m(18),s(27),"s");A.call(z,o(g),m(n),s(120),s(h),s(f));z.fillStyle=B;C.call(z,o(92),m(26),s(15),"d");C.call(z,o(j),m(60),s(e),"h");C.call(z,o(j),m(80),s(e),"h");C.call(z,o(j),m(100),s(e),"h");C.call(z,o(j),m(120),s(e),"h");C.call(z,o(j),m(l),s(e),"h");C.call(z,o(73),m(l),s(e),"h");C.call(z,o(53),m(l),s(e),"h");C.call(z,o(113),m(l),s(e),"h");C.call(z,o(133),m(l),s(e),"h")};c.drawEmptyCard=function(A,D,B){var C=this,z;z=C.createLinearGradient(o(5),m(5),o(55),m(p));z.addColorStop(0,"#fff");z.addColorStop(1,"#e0e0e0");C.fillStyle=z;C.fillRoundRect(o(0),m(0),s(n),s(p),s(k));C.strokeStyle="#666";C.strokeRoundRect(o(0),m(0),s(n),s(p),s(k))};window.Poker={getCardImage:function(z,A,y){var B=d.createElement("img");B.src=this.getCardData(z,A,y);return B},getCardCanvas:function(A,B,y){var z=a(A);z.getContext("2d").drawPokerCard(0,0,A,B,y);return z},getCardData:function(z,A,y){return this.getCardCanvas(z,A,y).toDataURL()},getBackImage:function(A,z,y){var B=d.createElement("img");B.src=this.getBackData(A,z,y);return B},getBackCanvas:function(B,z,y){var A=a(B);A.getContext("2d").drawPokerBack(0,0,B,z,y);return A},getBackData:function(A,z,y){return this.getBackCanvas(A,z,y).toDataURL()}}}})();