function verifyToken(){$.ajax({type:"POST",url:baseUrl+"api/v1/member/validate-token",dataType:"json",data:{token:localStorage.getItem("Token")},success:function(n){n.isValid?$("#btnGClubSpin").show():$("#aLogin").show()}})}function onSubmitClick(){$.ajax({type:"POST",url:baseUrl+"api/v1/member/login",dataType:"json",data:{userName:$("#txtUserName").val(),password:$("#txtPassword").val(),system:"KUBET"},success:function(n){if(!n.isValid){$("#modalPopupContent").html(n.message);$("#modalPopup").modal("show");return}$("#hdnToken").val(n.token);localStorage.setItem("Token",n.token);setTimeout(function(){onSpinClick()},100)},error:function(n,t,i){$("#modalPopupContent").html(i.message);$("#modalPopupz").modal("show")}})}function onSpinClick(){$("#btnGClubSpin").text("กำลังทำงาน...");$.ajax({type:"POST",url:baseUrl+"api/v1/member/lucky-wheel-validation",dataType:"json",data:{token:localStorage.getItem("Token")},success:function(n){n.isValid?$(".easywheel").easyWheel("start"):setTimeout(function(){$("#modalPopupContent").text(n.message);$("#modalPopup").modal("show")},100)}})}jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(n,t,i,r,u){return jQuery.easing[jQuery.easing.def](n,t,i,r,u)},easeInQuad:function(n,t,i,r,u){return r*(t/=u)*t+i},easeOutQuad:function(n,t,i,r,u){return-r*(t/=u)*(t-2)+i},easeInOutQuad:function(n,t,i,r,u){return(t/=u/2)<1?r/2*t*t+i:-r/2*(--t*(t-2)-1)+i},easeInCubic:function(n,t,i,r,u){return r*(t/=u)*t*t+i},easeOutCubic:function(n,t,i,r,u){return r*((t=t/u-1)*t*t+1)+i},easeInOutCubic:function(n,t,i,r,u){return(t/=u/2)<1?r/2*t*t*t+i:r/2*((t-=2)*t*t+2)+i},easeInQuart:function(n,t,i,r,u){return r*(t/=u)*t*t*t+i},easeOutQuart:function(n,t,i,r,u){return-r*((t=t/u-1)*t*t*t-1)+i},easeInOutQuart:function(n,t,i,r,u){return(t/=u/2)<1?r/2*t*t*t*t+i:-r/2*((t-=2)*t*t*t-2)+i},easeInQuint:function(n,t,i,r,u){return r*(t/=u)*t*t*t*t+i},easeOutQuint:function(n,t,i,r,u){return r*((t=t/u-1)*t*t*t*t+1)+i},easeInOutQuint:function(n,t,i,r,u){return(t/=u/2)<1?r/2*t*t*t*t*t+i:r/2*((t-=2)*t*t*t*t+2)+i},easeInSine:function(n,t,i,r,u){return-r*Math.cos(t/u*(Math.PI/2))+r+i},easeOutSine:function(n,t,i,r,u){return r*Math.sin(t/u*(Math.PI/2))+i},easeInOutSine:function(n,t,i,r,u){return-r/2*(Math.cos(Math.PI*t/u)-1)+i},easeInExpo:function(n,t,i,r,u){return t==0?i:r*Math.pow(2,10*(t/u-1))+i},easeOutExpo:function(n,t,i,r,u){return t==u?i+r:r*(-Math.pow(2,-10*t/u)+1)+i},easeInOutExpo:function(n,t,i,r,u){return t==0?i:t==u?i+r:(t/=u/2)<1?r/2*Math.pow(2,10*(t-1))+i:r/2*(-Math.pow(2,-10*--t)+2)+i},easeInCirc:function(n,t,i,r,u){return-r*(Math.sqrt(1-(t/=u)*t)-1)+i},easeOutCirc:function(n,t,i,r,u){return r*Math.sqrt(1-(t=t/u-1)*t)+i},easeInOutCirc:function(n,t,i,r,u){return(t/=u/2)<1?-r/2*(Math.sqrt(1-t*t)-1)+i:r/2*(Math.sqrt(1-(t-=2)*t)+1)+i},easeInElastic:function(n,t,i,r,u){var o=1.70158,f=0,e=r;return t==0?i:(t/=u)==1?i+r:(f||(f=u*.3),e10&&(t.o.sliceLineWidth=10,console.log("warning",'Max sliceLineWidth is "10"'));parseInt(t.o.centerLineWidth)>10&&(t.o.centerLineWidth=10,console.log("warning",'Max centerLineWidth is "10"'));parseInt(t.o.outerLineWidth)>10&&(t.o.outerLineWidth=10,console.log("warning",'Max outerLineWidth is "10"'));void 0===n.easing[n.trim(t.o.easing)]&&(t.o.easing="easyWheel")};t.prototype.destroy=function(t){var i=this;i.spinning&&i.spinning.finish();"boolean"==typeof t&&!0===t&&i.$wheel.html("").removeClass(i.instanceUid);n.extend(i.o,i.defaults);n.extend(i,i.initials);n(document).off("click."+i.instanceUid);n(document).off("resize."+i.instanceUid)};t.prototype.option=function(t,i){var r=this,u;-1===n.inArray(typeof i,["undefined","function"])&&-1===n.inArray(typeof r.o[t],["undefined","function"])&&(u=["easing","type","duration","rotates","max"],-1!=n.inArray(t,u)&&(r.o[t]=i))};t.prototype.finish=function(){var n=this;n.spinning&&n.spinning.finish()};t.prototype.init=function(){var n=this;n.initialize();n.execute()};t.prototype.initialize=function(){var t=this,l,a,d,g,o,u,f,v,r,s,y,nt,tt,it;t.$wheel.addClass("easyWheel "+t.instanceUid);var p=360/t.totalSlices(),w=0,e=0;t.$wheel.html("");var b=n("
").addClass("eWheel-wrapper").appendTo(t.$wheel),k=n("
").addClass("eWheel-inner").appendTo(b),h=n("
").addClass("eWheel").prependTo(k),c=n("
").addClass("eWheel-bg-layer").appendTo(h),i=n(t.SVG("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 200 200","xml:space":"preserve",style:"enable-background:new 0 0 200 200;"}));i.appendTo(c);l=n("");a=n("");(l.addClass("ew-slicesGroup").appendTo(i),"string"==typeof t.o.shadow&&""!==n.trim(t.o.shadow))&&(d=n(t.SVG("radialGradient",{id:"SVGID_1_",cx:"50%",cy:"50%",r:"50%",gradientUnits:"userSpaceOnUse"})).appendTo(i),g=t.SVG("stop",{offset:"0.1676",style:"stop-color:"+t.o.shadow+";stop-opacity:1"}).outerHTML+t.SVG("stop",{offset:"0.5551",style:"stop-color:"+t.o.shadow+";stop-opacity:1"}).outerHTML+t.SVG("stop",{offset:"0.6189",style:"stop-color:"+t.o.shadow+";stop-opacity:1"}).outerHTML+t.SVG("stop",{offset:"1",style:"stop-color:"+t.o.shadow+";stop-opacity:0"}).outerHTML,n(g).appendTo(d),n(t.SVG("circle",{cx:"50%",cy:"50%",r:"50%","stroke-width":"0","fill-opacity":parseInt(t.o.shadowOpacity)<9?"0."+parseInt(t.o.shadowOpacity):1,fill:"url(#SVGID_1_)"})).appendTo(i));(a.appendTo(i),"v"===t.o.textLine||"vertical"===t.o.textLine)?(o=n("
"),o.addClass("eWheel-txt-wrap"),o.appendTo(h),u=n("
"),u.addClass("eWheel-txt"),u.css({"-webkit-transform":"rotate("+(-180/t.totalSlices()+t.getDegree())+"deg)","-moz-transform":"rotate("+(-180/t.totalSlices()+t.getDegree())+"deg)","-ms-transform":"rotate("+(-180/t.totalSlices()+t.getDegree())+"deg)","-o-transform":"rotate("+(-180/t.totalSlices()+t.getDegree())+"deg)",transform:"rotate("+(-180/t.totalSlices()+t.getDegree())+"deg)"}),u.appendTo(o)):(f=n(""),v=n(""),v.appendTo(i),f.appendTo(i));r=n("
");(r.addClass("eWheel-center"),r.addClass(t.o.centerClass),r.appendTo(!0===t.o.rotateCenter||"true"===t.o.rotateCenter?h:k),"string"==typeof t.o.centerHtml&&""===n.trim(t.o.centerHtml)&&"string"==typeof t.o.centerImage&&""!==n.trim(t.o.centerImage))&&(s=n(""),parseInt(t.o.centerImageWidth)||(t.o.centerImageWidth=parseInt(t.o.centerWidth)),s.css("width",parseInt(t.o.centerImageWidth)+"%"),s.attr("src",t.o.centerImage),s.appendTo(r),r.append('
'));"string"==typeof t.o.centerHtml&&""!==n.trim(t.o.centerHtml)&&(y=n('
'+t.o.centerHtml+"<\/div>"),parseInt(t.o.centerHtmlWidth)||(t.o.centerHtmlWidth=parseInt(t.o.centerWidth)),y.css({width:parseInt(t.o.centerHtmlWidth)+"%",height:parseInt(t.o.centerHtmlWidth)+"%"}),y.appendTo(r));"color"!==n.trim(t.o.type)&&n("
").addClass("eWheel-marker").appendTo(b).append('<\/g><\/svg>');n.each(t.items,function(i,r){var h=360/t.totalSlices()*i,c,y,o,d,s,k;if(e+=p,c=t.annularSector({centerX:100,centerY:100,startDegrees:w,endDegrees:e,innerRadius:parseInt(t.o.centerWidth),outerRadius:100.5-parseInt(t.o.outerLineWidth)}),l.append(t.SVG("path",{"stroke-width":0,fill:r.color,"data-fill":r.color,d:c})),a.append(t.SVG("path",{"stroke-width":0,fill:t.o.sliceLineColor,d:t.annularSector({centerX:100,centerY:100,startDegrees:e+.2,endDegrees:e-.2,innerRadius:parseInt(t.o.centerWidth),outerRadius:100.5-parseInt(t.o.outerLineWidth)},!0)})),y="auto"!==n.trim(t.o.textColor)?n.trim(t.o.textColor):t.brightness(r.color),"v"===t.o.textLine||"vertical"===t.o.textLine)o=n("
"),o.addClass("eWheel-title"),o.html(r.name),o.css({paddingRight:parseInt(t.o.textOffset)+"%","-webkit-transform":"rotate("+h+"deg) translate(0px, -50%)","-moz-transform":"rotate("+h+"deg) translate(0px, -50%)","-ms-transform":"rotate("+h+"deg) translate(0px, -50%)","-o-transform":"rotate("+h+"deg) translate(0px, -50%)",transform:"rotate("+h+"deg) translate(0px, -50%)",color:y}),o.appendTo(u),t.toNumber(t.o.letterSpacing)>0&&u.css("letter-spacing",t.toNumber(t.o.letterSpacing));else{if(d=''+r.name+"<\/textPath><\/text>",f.css("font-size",parseInt(t.o.fontSize)/2),parseInt(t.o.letterSpacing)>0&&f.css("letter-spacing",parseInt(t.o.letterSpacing)),f.append(d),s=/(^.+?)L/.exec(c)[1],!0!==t.o.textArc){var g=/(^.+?)A/.exec(s),b=s.replace(g[0],""),nt=/(^.+?),/.exec(b),tt=b.replace(nt[1],0);s=s.replace(b,tt)}v.append(t.SVG("path",{"stroke-width":0,fill:"none",id:"ew-text-"+i,d:s}))}k=n("
");k.html(r);k.appendTo(o);w+=p});nt=parseInt(t.o.sliceLineWidth);("v"!==t.o.textLine||t.o.textLine,parseInt(t.o.centerWidth)>nt)&&(tt=t.SVG("circle",{"class":"centerCircle",cx:"100",cy:"100",r:parseInt(t.o.centerWidth)+1,stroke:t.o.centerLineColor,"stroke-width":parseInt(t.o.centerLineWidth),fill:t.o.centerBackground}),n(tt).appendTo(i));it=t.SVG("circle",{cx:"100",cy:"100",r:100-parseInt(t.o.outerLineWidth)/2,stroke:t.o.outerLineColor,"stroke-width":parseInt(t.o.outerLineWidth),"fill-opacity":0,fill:"#fff0"});n(it).appendTo(i);c.html(c.html())};t.prototype.toNumber=function(n){return NaN===Number(n)?0:Number(n)};t.prototype.SVG=function(n,t){var i=document.createElementNS("http://www.w3.org/2000/svg",n);for(var r in t)i.setAttribute(r,t[r]);return i};t.prototype.annularSector=function(n,t){var f=this,r=parseInt(f.o.sliceLineWidth),i=f.oWithDefaults(n),e=[[i.cx+i.r2*Math.cos((n.startDegrees+r/4)*Math.PI/180),i.cy+i.r2*Math.sin((n.startDegrees+r/4)*Math.PI/180)],[i.cx+i.r2*Math.cos((n.endDegrees-r/4)*Math.PI/180),i.cy+i.r2*Math.sin((n.endDegrees-r/4)*Math.PI/180)],[i.cx+i.r1*Math.cos((n.endDegrees-r)*Math.PI/180),i.cy+i.r1*Math.sin((n.endDegrees-r)*Math.PI/180)],[i.cx+i.r1*Math.cos((n.startDegrees+r)*Math.PI/180),i.cy+i.r1*Math.sin((n.startDegrees+r)*Math.PI/180)]],h=(i.closeRadians-i.startRadians)%(2*Math.PI)>Math.PI?1:0,o=1,s=0,u;return!0===t&&r>=parseInt(f.o.centerWidth)?(o=0,s=1):!0!==t&&r>=parseInt(f.o.centerWidth)&&(o=1,s=1),u=[],u.push("M"+e[0].join()),u.push("A"+[i.r2,i.r2,0,h,o,e[1]].join()),u.push("L"+e[2].join()),u.push("A"+[i.r1,i.r1,0,h,s,e[3]].join()),u.push("z"),u.join(" ")};t.prototype.oWithDefaults=function(n){var t={cx:n.centerX||0,cy:n.centerY||0,startRadians:(n.startDegrees||0)*Math.PI/180,closeRadians:(n.endDegrees||0)*Math.PI/180},i=void 0!==n.thickness?n.thickness:100;return t.r1=void 0!==n.innerRadius?n.innerRadius:void 0!==n.outerRadius?n.outerRadius-i:200-i,t.r2=void 0!==n.outerRadius?n.outerRadius:t.r1+i,t.r1<0&&(t.r1=0),t.r2<0&&(t.r2=0),t};t.prototype.brightness=function(n){var t,i,r,u;return n.match(/^rgb/)?(t=(n=(n=n.match(/rgba?\(([^)]+)\)/)[1]).split(/ *, */).map(Number))[0],i=n[1],r=n[2]):"#"==n[0]&&7==n.length?(t=parseInt(n.slice(1,3),16),i=parseInt(n.slice(3,5),16),r=parseInt(n.slice(5,7),16)):"#"==n[0]&&4==n.length&&(t=parseInt(n[1]+n[1],16),i=parseInt(n[2]+n[2],16),r=parseInt(n[3]+n[3],16)),u=(299*t+587*i+114*r)/1e3,u<125?"#fff":"#333"};t.prototype.guid=function(n){var i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="",t;for(n||(n=8),t=0;t4?n=4:n<.1&&(n=.1);t.$wheel.find(".eWheel-wrapper").css("font-size",100*n+"%")};t.prototype.numberToArray=function(n){for(var i=[],t=0;t=i.o.max)return;if(!1!==i.o.selector)i.slice.id=i.selectedSliceID(i.resetCount);else{if(!0!==i.o.random)return;i.slice.id=i.getRandomInt(0,i.totalSlices()-1)}if(!0!==i.o.random&&i.totalSlices()<=i.resetCount)return;if(!0===i.o.random&&i.totalSlices()<=i.resetCount&&(i.resetCount=0),void 0===i.slice.id)return i.resetCount++,void i.run(t)}if(i.inProgress=!0,void 0!==i.items[i.slice.id]){i.slice.results=i.items[i.slice.id];i.slice.length=i.slice.id;i.o.onStart.call(i.$wheel,i.slice.results,i.spinCount,i.now);var f=i.calcSliceSize(i.slice.id),h=i.getRandomInt(f.start,f.end),c=360*parseInt(i.rotates)+h;i.lastStep=-1;i.currentStep=0;r=!1;o=i.numberToArray(i.totalSlices()).reverse();0!==parseInt(i.o.frame)&&(s=n.fx.interval,n.fx.interval=parseInt(i.o.frame));i.spinning=n({deg:i.now}).animate({deg:c},{duration:parseInt(i.o.duration),easing:n.trim(i.o.easing),step:function(t){var f;0!==parseInt(i.o.frame)&&(n.fx.interval=parseInt(i.o.frame));i.now=t%360;"color"!==n.trim(i.o.type)&&i.$wheel.find(".eWheel").css({"-webkit-transform":"rotate("+i.now+"deg)","-moz-transform":"rotate("+i.now+"deg)","-ms-transform":"rotate("+i.now+"deg)","-o-transform":"rotate("+i.now+"deg)",transform:"rotate("+i.now+"deg)"});i.currentStep=Math.floor(t/(360/i.totalSlices()));i.currentSlice=o[i.currentStep%i.totalSlices()];var h=i.totalSlices(),u=1600/h,c=1600/360*i.now/16,l=((i.currentSlice+1)*u-(1600-1600/360*i.now))/u*100;(i.slicePercent=l,i.circlePercent=c,i.o.onProgress.call(i.$wheel,i.slicePercent,i.circlePercent),i.lastStep!==i.currentStep)&&((i.lastStep=i.currentStep,!0===i.o.markerAnimation&&-1===n.inArray(n.trim(i.o.easing),["easeInElastic","easeInBack","easeInBounce","easeOutElastic","easeOutBack","easeOutBounce","easeInOutElastic","easeInOutBack","easeInOutBounce"]))&&(f=parseInt(i.o.duration)/i.totalSlices(),e=-38,r&&r.stop(),r=n({deg:0}).animate({deg:e},{easing:"MarkerEasing",duration:f/2,step:function(t){n(".eWheel-marker").css({"-webkit-transform":"rotate("+t+"deg)","-moz-transform":"rotate("+t+"deg)","-ms-transform":"rotate("+t+"deg)","-o-transform":"rotate("+t+"deg)",transform:"rotate("+t+"deg)"})}})),"color"===n.trim(i.o.type)?(i.$wheel.find("svg>g.ew-slicesGroup>path").each(function(){n(this).attr("class","").attr("fill",n(this).attr("data-fill"))}),i.$wheel.find("svg>g.ew-slicesGroup>path").eq(i.currentSlice).attr("class","ew-ccurrent").attr("fill",i.o.selectedSliceColor),i.$wheel.find(".eWheel-txt>.eWheel-title").removeClass("ew-ccurrent"),i.$wheel.find(".eWheel-txt>.eWheel-title").eq(i.currentSlice).addClass("ew-ccurrent")):(i.$wheel.find("svg>g.ew-slicesGroup>path").attr("class",""),i.$wheel.find("svg>g.ew-slicesGroup>path").eq(i.currentSlice).attr("class","ew-current"),i.$wheel.find(".eWheel-txt>.eWheel-title").removeClass("ew-current"),i.$wheel.find(".eWheel-txt>.eWheel-title").eq(i.currentSlice).addClass("ew-current")),i.currentSliceData.id=i.currentSlice,i.currentSliceData.results=i.items[i.currentSliceData.id],i.currentSliceData.results.length=i.currentSliceData.id,i.o.onStep.call(i.$wheel,i.currentSliceData.results,i.slicePercent,i.circlePercent));0!==parseInt(i.o.frame)&&(n.fx.interval=s)},fail:function(){i.inProgress=!1;i.o.onFail.call(i.$wheel,i.slice.results,i.spinCount,i.now)},complete:function(){i.inProgress=!1;i.o.onComplete.call(i.$wheel,i.slice.results,i.spinCount,i.now)}});i.counter++;i.spinCount++;i.resetCount++}}};t.prototype.execute=function(){var t=this;t.currentSlice=t.totalSlices()-1;"string"==typeof t.o.button&&""!==n.trim(t.o.button)&&n(document).on("click."+t.instanceUid,t.o.button,function(n){n.preventDefault();t.start()});t.$wheel.css("font-size",parseInt(t.o.fontSize));t.$wheel.width(parseInt(t.o.width));t.$wheel.height(t.$wheel.width());t.$wheel.find(".eWheel-wrapper").width(t.$wheel.width());t.$wheel.find(".eWheel-wrapper").height(t.$wheel.width());t.FontScale();n(window).on("resize."+t.instanceUid,function(){t.$wheel.height(t.$wheel.width());t.$wheel.find(".eWheel-wrapper").width(t.$wheel.width());t.$wheel.find(".eWheel-wrapper").height(t.$wheel.width());t.FontScale()})};n.fn.easyWheel=function(){for(var f,r=this,u=arguments[0],e=Array.prototype.slice.call(arguments,1),o=Array.prototype.slice.call(arguments,2),s=r.length,h=["destroy","start","finish","option"],i=0;iดูข้อมูลสมาชิก KUBET<\/a>',n(".spinner-message").css("color",t.color).html(u)):t.win===!1&&(t.id==="ERROR"?n(".spinner-message").css("color","#e52833").html(t.message):(f=new Audio(baseUrl+"assets/media/g_lost.mp3"),f.play(),n(".spinner-message").css("color",t.color).html("เสียใจด้วยคุณได้รับ "+t.message))));setTimeout(function(){n("#btnGClubSpin").prop("disabled",!1);n("#btnGClubSpin").text("หมุนวงล้อ")},100)}});verifyToken()})