Guest User

Untitled

a guest
Feb 17th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 182.71 KB | None | 0 0
  1. Array.prototype.insert=function(index,item){this.splice(index,0,item);};function pad(str,max){str=str.toString();return str.length<max?pad("0"+ str,max):str;}
  2. function phraser(phrase){if(lang[phrase]==null|| lang[phrase]==undefined){return phrase;}
  3. return lang[phrase];}
  4. function copyToClipboard(text){var $temp=$("<input>");$("body").append($temp);$temp.val(text).select();document.execCommand("copy");$temp.remove();}
  5. function getRotationDegrees(obj){var matrix=obj.css("-webkit-transform")||obj.css("-moz-transform")||obj.css("-ms-transform")||obj.css("-o-transform")||obj.css("transform");if(matrix!=='none'){var values=matrix.split('(')[1].split(')')[0].split(',');var a=values[0];var b=values[1];var angle=Math.round(Math.atan2(b,a)*(180/Math.PI));}else{var angle=0;}
  6. return(angle<0)?angle+ 360:angle;}
  7. function needCredits(){$.ajax({type:"GET",url:"/user_credits.php",success:function(text){swal({title:phraser('ERROR'),html:phraser('NOT_ENOUGH_CREDITS')+text+" Credits.</b>",type:'error',confirmButtonText:phraser('OKAY')});$("#credits").html(parseFloat(text).toFixed(2));}});}
  8. function updateCredits(value){var newCredits=(parseFloat($("#credits").html())+ parseFloat(value)).toFixed(3);if(newCredits<0){newCredits=0;}
  9. $("#credits").html(newCredits);}
  10. function addCredits(data){if(data.user_id==userID){$.growl.notice({title:phraser('SUCCESS'),message:phraser('CREDITS_ADDED')+" <b>"+data['value']+"</b> Credits"});updateCredits(data.value);}}
  11. function removeCredits(data){if(data.user_id==userID){$.growl.notice({title:phraser('SUCCESS'),message:phraser('CREDITS_REMOVE')+" <b>"+data['value']+"</b> Credits"});updateCredits(-1*data.value);}}
  12. function moveElement(e,target){var moveX=e.pageX;var moveY=e.pageY;if(typeof e.originalEvent.touches!=='undefined'){moveX=e.originalEvent.touches[0].pageX;moveY=e.originalEvent.touches[0].pageY;}
  13. window.my_dragging={};my_dragging.pageX0=moveX;my_dragging.pageY0=moveY;my_dragging.elem=$(target);my_dragging.offset0=$(target).offset();function handle_dragging(e){var dragX=e.pageX;var dragY=e.pageY;if(typeof e.originalEvent.touches!=='undefined'){dragX=e.originalEvent.touches[0].pageX;dragY=e.originalEvent.touches[0].pageY;}
  14. var left=my_dragging.offset0.left+(dragX- my_dragging.pageX0);var top=my_dragging.offset0.top+(dragY- my_dragging.pageY0);$(my_dragging.elem).offset({top:top,left:left});}
  15. function handle_mouseup(e){$('body').off('mousemove touchmove',handle_dragging).off('mouseup touchend touchcancel',handle_mouseup);}
  16. $('body').on('mouseup touchend touchcancel',handle_mouseup).on('mousemove touchmove',handle_dragging);}
  17. function adminCredits(data){if(data.value>0)
  18. {$.growl.notice({title:"Admin",message:phraser('YOU_HAVE_RECEIVED')+" <b>"+data.value+"</b> Credits"});}
  19. else
  20. {$.growl.error({title:"Admin",message:phraser('YOU_HAVE_RECEIVED')+" <b>"+data.value+"</b> Credits"});}
  21. updateCredits(data.value);}
  22. function sendCreditsNotification(data){$.growl.notice({title:phraser('USER_SENT'),message:phraser('YOU_HAVE_RECEIVED')+" <b>"+data.value+"</b> Credits "+phraser('FROM')+" <b>"+data.fromUser+"</b>"});updateCredits(data.value);}
  23. function validateTradeURL(tradeURL){if(!tradeURL.match(/steamcommunity\.com\/tradeoffer\/new\/\?partner=[0-9]*&token=[a-zA-Z0-9_-]*/i)){return false;}
  24. return true;}
  25. function changeText(Otext,cont,speed){var Ocontent=Otext.split("");var i=0;function show(){if(i<Ocontent.length)
  26. {cont.append(Ocontent[i]);i=i+1;}}
  27. var Otimer=setInterval(show,speed);}
  28. function updatePrices(bot_id,type,page,first)
  29. {$("#admin_bots_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{update_prices:true,bot_id:bot_id,type:type,page:page,first:first},success:function(text){$("#admin_bots_loader").hide().before(text);if(!text.includes("No more items matched")&&text.includes("Continue")){updatePrices(bot_id,type,page,0);}else if(!text.includes("No more items matched")){updatePrices(bot_id,type,page+1,0);}}});}
  30. var navbarGiveawayCounter;var navbarCount;var navbarStartSeconds;var navbarStartTime;function navbarStartTimer(){navbarGiveawayCounter=setInterval(navbarGiveawayTimer,100);navbarCount=$("#navbar_giveaway_timer").html().replace("d","").replace("h","").replace("m","").replace("s","").split(" ");navbarStartSeconds=parseInt(navbarCount[0])*24*60*60+ parseInt(navbarCount[1])*60*60+ parseInt(navbarCount[2])*60+ parseInt(navbarCount[3]);navbarStartTime=new Date().getTime();}
  31. function navbarGiveawayTimer(){var timeElapse=Math.floor((new Date().getTime()- navbarStartTime)/1000);
  32. var totalSeconds=navbarStartSeconds- timeElapse;var days=Math.floor(totalSeconds/60/60/24);var seconds=totalSeconds- days*24*60*60;var hours=Math.floor(seconds/60/60);seconds=seconds- hours*60*60;var minutes=Math.floor(seconds/60);seconds=seconds- minutes*60;days=pad(days,2);hours=pad(hours,2);minutes=pad(minutes,2);seconds=pad(seconds,2);$("#navbar_giveaway_timer").html(days+"d "+hours+"h "+minutes+"m "+seconds+"s");if(totalSeconds<=0){$("#navbar_giveaway_timer").html(days+"d "+hours+"h "+minutes+"m "+seconds+"s");$("#navbar_giveaway").fadeOut();clearInterval(navbarGiveawayCounter);}}
  33. function handleSkinGiveaway(data){$(".giveaway_small_image_navbar").attr('src',data.item_image);$("#navbar_giveaway_timer").html(data.d+"d "+ data.h+"h "+ data.m+"m "+ data.s+"s ");$("#navbar_giveaway").show();navbarStartTimer();}
  34. var boxGiveawayCounter;var boxCount;var boxStartSeconds;var boxStartTime;function boxStartTimer(){boxGiveawayCounter=setInterval(boxGiveawayTimer,100);boxCount=$(".chat_giveaway_box_timer").html().replace("m","").replace("s","").split(" ");boxStartSeconds=parseInt(parseInt(boxCount[0])*60+ parseInt(boxCount[1]));boxStartTime=new Date().getTime();}
  35. function boxGiveawayTimer(){var timeElapse=Math.floor((new Date().getTime()- boxStartTime)/1000);
  36. var totalSeconds=boxStartSeconds- timeElapse;var minutes=Math.floor(totalSeconds/60);var seconds=totalSeconds- minutes*60;minutes=pad(minutes,2);seconds=pad(seconds,2);$(".chat_giveaway_box_timer").html(minutes+"m "+seconds+"s");if(totalSeconds<=0){$(".chat_giveaway_box_timer").html(minutes+"m "+seconds+"s");clearInterval(boxGiveawayCounter);}}
  37. function handleGiveaway(data){if(data.start==1){$("#chat_giveaway_box").addClass("chat_giveaway_box_live");$(".chat_giveaway_box_timer").hide();$(".chat_giveaway_box_info").show();$("#chat_giveaway_box_type").html(data.type);$("#chat_giveaway_box_value").html(data.value);if(data.system==1){$(".chat_giveaway_box_timer").html("15m 00s");boxStartTimer();}}
  38. if(data.stop==1){if(data.winner_user_id==userID){updateCredits(data.value);}
  39. $(".chat_giveaway_box_timer").show();$("#chat_giveaway_box").removeClass();$(".chat_giveaway_box_info").hide();}}
  40. function jukeBoxToken(data){if(userID==data.user_id){$("#jukebox_tokens b").html((parseInt($("#jukebox_tokens b").html())+1));$.growl.notice({title:'Jukebox',message:phraser('YOU_RECEIVED_JUKEBOX_TOKEN')});}}
  41. var jukeboxTimer;function jukeBoxLoad(){$.ajax({type:"GET",url:"/jukebox.php",data:{load:true},success:function(text){if(text!='none'){var trackInfo=text.split(";");jukeBoxPlay(trackInfo[0],trackInfo[1],trackInfo[2],trackInfo[3],trackInfo[4],trackInfo[5],trackInfo[6],trackInfo[7]);}}});}
  42. function jukeBoxStop(){$("#jukebox_current").hide();$("#jukebox_form").show();$("#jukebox_title").hide();$("#jukebox_volume").hide();$("#jukebox_available").show();youtubePlayer.stopVideo()
  43. clearTimeout(jukeboxTimer);}
  44. function jukeBoxPlay(track_id,title,artwork,duration,remaining,url,user,avatar){youtubePlayer.loadVideoById(track_id,Math.floor(duration-remaining)).playVideo();$(".now_playing").html('<img src="'+artwork+'"> '+title);$("#jukebox_title").show();$("#jukebox_volume").show();$("#jukebox_available").hide();$("#jukebox_current").css('background-image','url('+artwork+')').html('<img class="tool" src="'+avatar+'" title="'+user+'"><span class="jukebox_current_blur" style="background-image: url('+artwork+')"></span><span class="jukebox_current_content"><i>Current Track:</i><br><a href="'+url+'" target="_blank">'+title+'</a></span>').show();$("#jukebox_form").hide();jukeboxTimer=setTimeout(function(){$("#jukebox_current").hide();$("#jukebox_form").show();$("#jukebox_title").hide();$("#jukebox_volume").hide();$("#jukebox_available").show();youtubePlayer.stopVideo()},remaining*1000);}
  45. function saveJukeboxVolume(vol){setTimeout(function(){if(youtubePlayer.getVolume()==vol){$.ajax({type:"GET",url:"/jukebox.php",data:{volume:vol},success:function(text){}});}},3000);}
  46. function barrelRoll()
  47. {$("body").addClass('barrel_roller');setTimeout(function(){$("body").removeClass('barrel_roller');},4100);}
  48. function recruitsNew(data)
  49. {$.growl.notice({title:'Recruits',message:phraser("YOU_JUST_RECRUITED")+" <b>"+data.persona+"</b>"});updateCredits(0.05);}
  50. var revolverCountdownTimer;function revolverCountdown()
  51. {var startVal=$("#revolver_countdown span").html().replace("s","").replace(" ","").split("m");var startSec=parseInt(startVal[0])*60+ parseInt(startVal[1]);var startTime=new Date().getTime();clearInterval(revolverCountdownTimer);timeouts.push(revolverCountdownTimer=setInterval(function()
  52. {var timeElapse=Math.floor((new Date().getTime()- startTime)/1000);
  53. var seconds=startSec- timeElapse;var minutes=0;if(seconds<=0)
  54. {seconds=0;clearInterval(revolverCountdownTimer);}
  55. minutes=Math.floor(seconds/60);seconds=seconds- minutes*60;minutes=pad(minutes,2);seconds=pad(seconds,2);$("#revolver_countdown span").html(minutes+"m "+ seconds+"s");},1000));}
  56. function revolverBet(data)
  57. {if($("#revolver_background").length==0||$(".revolver_player[data-id='"+data.bet.revolver_bet_id+"']").length>0){return;}
  58. $(".blop").trigger('play');$("#revolver_players").append('<div class="revolver_player" data-id="'+data.bet.revolver_bet_id+'" data-time="'+data.bet.microtime+'"><span><b>'+data.bet.value+'</b> Credits</span><a show-profile="'+data.user.user_id+'"><img src="'+data.user.avatar+'"></a></div>');if(data.bet.king==1)
  59. {revolverKing(data.bet.revolver_bet_id,data.user.avatar,0);}
  60. $('#revolver_players').find('.revolver_player').sort(function(a,b){return parseInt($(a).attr('data-time'))- parseInt($(b).attr('data-time'));}).prependTo('#revolver_players');}
  61. function revolverKing(revolver_bet_id,avatar,profit)
  62. {var kingBet=$("#revolver_user_king").attr('data-id');if(kingBet!=undefined)
  63. {$("#revolver_players div[data-id='"+kingBet+"']").remove();}
  64. $("#revolver_user_king").attr('src',avatar).attr('data-id',revolver_bet_id).show();$("#revolver_hat_king").show();$("#revolver_king_profit").show();$("#revolver_king_profit b").html(profit);}
  65. function revolverPlayer(user)
  66. {$("#revolver_list").hide();$("#revolver_blood_player, #revolver_blood_king").hide();$("#revolver_hat_player").show();$("#revolver_user_player").attr('src',user.avatar).show();}
  67. function revolverLoad(chamber)
  68. {$(".revolver_load").trigger('play');timeouts.push(setTimeout(function()
  69. {$("#cylinder").css('transform','rotate(0deg)');$("#cylinder").stop(true,true).addClass('cylinder_spin');$(".revolver_spin").trigger('play');timeouts.push(setTimeout(function()
  70. {$("#cylinder").removeClass('cylinder_spin');$(".revolver_spin").trigger('pause');$(".revolver_spin").prop("currentTime",0);},2000));},500));}
  71. function revolverNewRound(data)
  72. {if(typeof data.king.user!=='undefined'&&data.king.user.user_id==userID)
  73. {updateCredits(data.king.bet.value);$.growl.notice({title:'Revolver',message:phraser('YOU_JUST_WON')+" <b>"+data.king.bet.value+"</b> Credits!"});}
  74. if($("#revolver_background").length==0){return;}
  75. $("#revolver_blood_player, #revolver_blood_king").hide();$("#revolver_hat_player").hide();$("#revolver_user_player").attr('src','').hide();$("#revolver_king_profit b").html('0');$("#revolver_players .revolver_player").first().remove();$("#revolver_countdown span").html("3m 00s");revolverCountdown();if(data.player!=null)
  76. {revolverKing(data.player.bet.revolver_bet_id,data.player.user.avatar,0);}
  77. else
  78. {$("#revolver_user_king").hide();$("#revolver_king_profit").hide();$("#revolver_hat_king").hide();}
  79. $("#revolver_list_player_bet").html(data.wanted.bet.value);$("#revolver_list_player_profit").html(parseFloat(data.wanted.bet.profit).toFixed(3));$("#revolver_list_player_kills").html(data.wanted.bet.wins);$("#revolver_list_player_survived").html(data.wanted.bet.survived);$(".revolver_list_player a").attr('show-profile',data.wanted.user.user_id);$(".revolver_list_player a img").attr('src',data.wanted.user.avatar);$("#revolver_list").show();timeouts.push(setTimeout(function()
  80. {$("#revolver_list").hide();},30000));$(".revolver_theme").trigger('play');setTimeout(function(){$(".revolver_theme").trigger('pause');$(".revolver_theme").prop("currentTime",0);},18*1000);}
  81. function revolverDuelHandle(data)
  82. {timeouts.push(setTimeout(function()
  83. {if(data.winner.user_id==userID)
  84. {updateCredits(data.winner.won);$.growl.notice({title:'Revolver',message:phraser('YOU_JUST_WON')+" <b>"+data.winner.won+"</b> Credits!"});}},1200*(data.chamber.number)+ 3000));if($("#revolver_background").length==0){return;}
  85. revolverPlayer(data.player.user);revolverLoad(data.chamber.number);var kingChance=parseFloat(data.king.bet.value)/(parseFloat(data.player.bet.value) + parseFloat(data.king.bet.value))*100;
  86. $("#revolver_king_chance b").html((kingChance).toFixed(2)+'%');$("#revolver_player_chance b").html((100-kingChance).toFixed(2)+'%');$("#revolver_king_chance, #revolver_player_chance").show();$("#revolver_hash b").html(data.hash);$("#revolver_hash").show();timeouts.push(setTimeout(function()
  87. {revolverDuel(data.chamber.number,1);},2000));timeouts.push(setTimeout(function()
  88. {if(data.chamber.number%2!=0)
  89. {$("#revolver_king_profit b").html(data.winner.profit);$("#revolver_players div[data-id='"+data.player.bet.revolver_bet_id+"']").remove();}
  90. else
  91. {revolverKing(data.player.bet.revolver_bet_id,data.player.user.avatar,data.winner.profit);}
  92. var effectText='';if(data.chamber.number==1)
  93. {effectText='<i class="fa fa-crosshairs"></i> ONE TAP';}
  94. else if(data.king.bet.wins>=1&&data.chamber.number%2!=0)
  95. {effectText='<i class="fa fa-link"></i> COMBO X'+(parseInt(data.king.bet.wins)+1);}
  96. else if(data.king.bet.wins>1&&data.chamber.number%2==0)
  97. {effectText='<i class="fa fa-chain-broken"></i> COMBOBREAKER';}
  98. else if(data.chamber.number==6)
  99. {effectText='<i class="fa fa-bullseye"></i> LAST BULLET';}
  100. if(effectText!='')
  101. {$("#revolver_duel_holder").prepend('<div class="revolver_shot_effect">'+effectText+'</div>');setTimeout(function(){$(".revolver_shot_effect").remove();},2000);}
  102. $("#revolver_blood_player, #revolver_blood_king").hide();$("#revolver_hat_player").hide();$("#revolver_user_player").hide();$("#revolver_king_chance, #revolver_player_chance, #revolver_hash").hide();$("#revolver_king_chance b, #revolver_player_chance b").html('0%');$("#revolver_hash b").html('');},1200*(data.chamber.number)+ 3000));timeouts.push(setTimeout(function()
  103. {$("#cylinder_chambers div:nth-of-type("+data.chamber.number+")").append('<span class="bullet"></span>');},(data.chamber.number)*1200+ 2100));}
  104. function revolverDuel(chamber,shots)
  105. {if(chamber>=1)
  106. {timeouts.push(setTimeout(function()
  107. {revolverShoot(chamber,1);},1*1200));}
  108. if(chamber>=2)
  109. {timeouts.push(setTimeout(function()
  110. {revolverShoot(chamber,2);},2*1200));}
  111. if(chamber>=3)
  112. {timeouts.push(setTimeout(function()
  113. {revolverShoot(chamber,3);},3*1200));}
  114. if(chamber>=4)
  115. {timeouts.push(setTimeout(function()
  116. {revolverShoot(chamber,4);},4*1200));}
  117. if(chamber>=5)
  118. {timeouts.push(setTimeout(function()
  119. {revolverShoot(chamber,5);},5*1200));}
  120. if(chamber>=6)
  121. {timeouts.push(setTimeout(function()
  122. {revolverShoot(chamber,6);},6*1200));}}
  123. function revolverShoot(chamber,shot)
  124. {if(shot%2!=0)
  125. {$("#revolver_pistol_king").show();timeouts.push(setTimeout(function()
  126. {$("#revolver_pistol_king").stop(true,true).addClass('revolver_recoil_king');},500));}
  127. else
  128. {$("#revolver_pistol_player").show();timeouts.push(setTimeout(function()
  129. {$("#revolver_pistol_player").stop(true,true).addClass('revolver_recoil_player');},500));}
  130. timeouts.push(setTimeout(function()
  131. {$("#revolver_pistol_king, #revolver_pistol_player").removeClass('revolver_recoil_king').removeClass('revolver_recoil_player').hide();},900));timeouts.push(setTimeout(function()
  132. {if(chamber==shot)
  133. {$("span.bullet").fadeOut(200);$(".revolver_shot").trigger('play');setTimeout(function(){$(".revolver_shot").trigger('play');},600);if(shot%2!=0&&$("#revolver_user_player").is(':visible'))
  134. {$("#revolver_blood_player").show();}
  135. else if($("#revolver_user_player").is(':visible'))
  136. {$("#revolver_blood_king").show();}}
  137. else
  138. {$(".revolver_dry").trigger('play');setTimeout(function(){$(".revolver_dry").trigger('play');},400);}
  139. $("#cylinder").css('transform','rotate('+(getRotationDegrees($("#cylinder"))+60)+'deg)');},450));}
  140. function casesNew(data)
  141. {var testSpin='';if(data.item.test==1)
  142. {testSpin=' (Test)';}
  143. $("#cases_latest_title").after('<div class="cases_list_item tool" title="<b>'+data.item.name+'</b><br>'+data.item.value+' Credits'+testSpin+'"><div class="item_color" style="background: '+data.item.color+';"></div><a show-profile="'+data.user.user_id+'"><img src="'+data.user.avatar+'" class="cases_list_item_user"></a><img src="'+data.case.image+'" class="cases_list_item_case_image"><img src="'+data.item.image+'" class="cases_list_item_image"></div>');$('.cases_list_item').not('.cases_list_item:lt(24)').remove();}
  144. function casesOpen(case_id,case_price,testSpin,button,buttonHTML)
  145. {$.ajax({type:"GET",url:"/cases_bet.php",data:{case_id:case_id,user_token:$("#user_token").val(),test:testSpin},success:function(text){if(text=='errorCredits'){needCredits();button.prop('disabled',false).html(buttonHTML);}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});button.prop('disabled',false).html(buttonHTML);}else{if(parseInt($("#case_tokens span").html())==0&&!testSpin){updateCredits(-1*case_price);}else if(!testSpin){$("#case_tokens span").html(parseInt($("#case_tokens span").html())-1);}
  146. text=text.split(";");$.ajax({type:"GET",url:"/cases_load.php",data:{spinner:true,case_id:case_id,case_item_id:text[0]},success:function(resp){$(".case_buttons").hide();$("#round_draw_pointer").show();$(".case_spinner").removeClass('case_spinner_filter').html(resp).css('padding-left',($(".case_spinner_holder").width()/2+20-(Math.floor(Math.random() * 110) + 10))+'px').addClass('case_spinner_animate');
  147. $(".case_open_sound").trigger('play');timeouts.push(setTimeout(function(){$(".case_open_sound").trigger('pause');$(".case_open_sound").prop("currentTime",0);},8000));timeouts.push(setTimeout(function(){$("#round_draw_pointer").hide();$("#case_item_win").removeClass('background_flow').addClass('background_master').css('border','2px solid #fad733');},7100));timeouts.push(setTimeout(function(){$("#case_item_win .case_item_wear").show();$("#case_item_win .case_item_price").show();$(".woosh").trigger('play');setTimeout(function(){$(".woosh").trigger('pause');$(".woosh").prop("currentTime",0);},300);},7800));timeouts.push(setTimeout(function(){$("#case_item_win .case_item_wear").html(text[1]);$("#case_item_win .case_item_price").html(text[2]);$(".woosh").trigger('play');setTimeout(function(){$(".woosh").trigger('pause');$(".woosh").prop("currentTime",0);},300);},8300));timeouts.push(setTimeout(function(){button.prop('disabled',false).html(buttonHTML);$(".case_buttons").show();$(".case_spinner").css('padding-left','0').removeClass('case_spinner_animate').addClass('case_spinner_filter');},10000));if(!testSpin){setTimeout(function(){$.growl.notice({title:'Cases',message:phraser("YOUR_CASE_CONTAINED")+" <b>"+text[3]+"</b>. "+phraser("YOUR_ITEM_IS_WORTH")+" <b>"+text[2]+"</b> Credits!"});updateCredits(text[2]);$(".cases_hash span").html(text[4]);},10000);}else{setTimeout(function(){$(".cases_hash span").html(text[4]);},10000);}}});}}});}
  148. function BezierCubicXY(p0,p1,p2,p3,t)
  149. {var ret={};var coords=['x','y'];var i,k;for(i in coords){k=coords[i];ret[k]=Math.pow(1- t,3)*p0[k]+ 3*Math.pow(1- t,2)*t*p1[k]+ 3*(1- t)*Math.pow(t,2)*p2[k]+ Math.pow(t,3)*p3[k];}
  150. return ret;}
  151. function getMultiplierFromBezier(bezierCurve,durationPercent,maxMultiplier)
  152. {var p1={x:0,y:0};var p2={x:bezierCurve[0],y:bezierCurve[1]};var p3={x:bezierCurve[2],y:bezierCurve[3]};var p4={x:1,y:1};var val=BezierCubicXY(p1,p2,p3,p4,durationPercent);return val.y*maxMultiplier+ 1;}
  153. function getWidthFromMultiplier(bezierCurve,durationPercent,maxMultiplier)
  154. {var p1={x:0,y:0};var p2={x:bezierCurve[0],y:bezierCurve[1]};var p3={x:bezierCurve[2],y:bezierCurve[3]};var p4={x:1,y:1};var val=BezierCubicXY(p1,p2,p3,p4,durationPercent);return val.x*maxMultiplier+ 1;}
  155. function crashBetAdd(data)
  156. {if($("#crash_graph_holder").length==0){return;}
  157. $("#crash_list").append('<tr data-id="'+data.bet.crash_bet_id+'" data-handled="false"><td class="crash_list_user"><a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'" class="crash_list_img"></a>'+data.player.persona+'</td><td></td><td>'+data.bet.value+'</td><td class="crash_list_profit">---</td></tr>');$(".blop").trigger('play');}
  158. function crashBetRemove(data)
  159. {if($("#crash_graph_holder").length==0){return;}
  160. var listItem=$("#crash_list tr[data-id='"+data.bet.crash_bet_id+"']");$("#crash_list tr[data-id='"+data.bet.crash_bet_id+"']").remove();listItem.insertAfter('#crash_list .crash_list_titles').css('color','#27c24c').attr('data-handled','true');$("#crash_list tr[data-id='"+data.bet.crash_bet_id+"'] td.crash_list_profit").html(parseFloat(data.bet.profit).toFixed(2));if(data.player.user_id==userID)
  161. {$("#crash_form_cashout").fadeOut();updateCredits(data.bet.credits);$.growl.notice({title:'Crash',message:phraser('WON_A_TOTAL_OF')+" <b>"+parseFloat(data.bet.credits).toFixed(2)+"</b>"+phraser('CREDITS_ON')+" Crash."});}}
  162. var crashCountdownTimer;function crashCountdown(text)
  163. {if($("#crash_graph_holder").length==0){return;}
  164. $("#crash_graph_y_holder").html('');for(y=11;y>=1;y--)
  165. {$("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="'+y+'" style="bottom:'+((y-1)*10)+'%;"><span>'+y+'</span><i></i></div>');}
  166. $("#crash_overlay").height('100%');$("#triangle_gradient_color").attr('stop-color','#0cb6e7');$("#crash_amount").fadeOut(100);$("#crash_countdown").html(text).fadeIn(100);var startSec=parseInt(text);var startTime=new Date().getTime();timeouts.push(crashCountdownTimer=setInterval(function(){var timeElapse=Math.floor((new Date().getTime()- startTime)/1000);
  167. var sec=startSec- timeElapse;if(sec<=0)
  168. {sec=0;clearInterval(crashCountdownTimer);}
  169. $("#crash_countdown").html(sec);},1000));}
  170. function crashStart(instant_crash,durationPercent)
  171. {if($("#crash_graph_holder").length==0){return;}
  172. clearInterval(crashCountdownTimer);$("#crash_countdown").fadeOut(100);$("#crash_form_cashout button").prop('disabled',false)
  173. if(instant_crash==0)
  174. {$("#crash_amount").css('color','#fff').fadeIn(100);crashAnimationStart(durationPercent);}
  175. else
  176. {$("#crash_amount").css('color','#b75552').fadeIn(100);crashAnimationStop(0.01);}}
  177. function crashStop(data)
  178. {if($("#crash_graph_holder").length==0){return;}
  179. if(data.old_round.instant_crash==0)
  180. {crashAnimationStop(data.old_round.multiplier);}
  181. $("#crash_hash").html(phraser('HASH')+': '+data.new_round.hash);$("#crash_round").html(phraser('ROUND_L')+': '+data.new_round.crash_id);$("#crash_list tr[data-id]").remove();$("#crash_latest_list").prepend('<span class="tool-top" title="<b>'+phraser('ROUND_L')+':</b><br>'+data.old_round.crash_id+'<br><br><b>'+phraser('WIN_PERCENTAGE')+':</b><br>'+data.old_round.percentage+'<br><br><b>'+phraser('HASH')+':</b><br>'+data.old_round.hash+'">'+data.old_round.multiplier+'<i class="fa fa-times"></i></span>');timeouts.push(setTimeout(function()
  182. {if(crashAutoBet)
  183. {$("#crash_form").submit();}},3000));}
  184. var crashAutoBet=false;var crash_percentage="";var crashAnimation;function crashAnimationStart(durationPercent)
  185. {if($("#crash_graph_holder").length==0){return;}
  186. if(durationPercent==0)
  187. {$(".load").trigger('play');setTimeout(function(){$(".load").trigger('pause');$(".load").prop("currentTime",0);},1000);}
  188. var durationFull=60*8;var maxMultiplier=1000;var curve=[.35,.01,.37,.1];var startTime=new Date().getTime();crashAnimation=$({value:0}).animate({value:maxMultiplier},{duration:durationFull*1000,easing:'linear',step:function(now,fx)
  189. {var multiplier=getMultiplierFromBezier(curve,fx.pos+ durationPercent,maxMultiplier).toFixed(2);if(multiplier>11)
  190. {$("#crash_overlay").css('height','0%');if($(".crash_graph_y").length<11)
  191. {var y=parseInt($(".crash_graph_y").first().attr('data-value'))+ 1;$("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="'+y+'" style="bottom:150%;"><span>'+y+'</span><i></i></div>');}
  192. $(".crash_graph_y").each(function()
  193. {var y=$(this).attr('data-value');if(y<multiplier-10)
  194. {$(this).remove();}
  195. else
  196. {$(this).css('bottom',(y- multiplier+ 10)*10+'%');}});}
  197. else
  198. {$("#crash_overlay").css('height',(100-(multiplier-1)*10)+'%');}
  199. var r=12+ Math.round(multiplier*7.5*9);var g=182- Math.round(multiplier*1.2*9);var b=231- Math.round(multiplier*2.4*9);$("#triangle_gradient_color").attr('stop-color','rgb('+r+', '+g+', '+b+')');$('#crash_amount').text(multiplier+'x');$(".crash_profit_label b").html((parseFloat($(".crash_profit_label").attr('data-value'))*multiplier- parseFloat($(".crash_profit_label").attr('data-value'))).toFixed(2));if(multiplier%5==0||multiplier==1)
  200. {crashParticles();}}});}
  201. function crashAnimationStop(endMultiplier)
  202. {$(".cork").trigger('play');timeouts.push(setTimeout(function()
  203. {$(".cork").trigger('pause');$(".cork").prop("currentTime",0);},2000));$(crashAnimation).stop(true,false);$(crashParticleAnimation).stop(true,false);$("#crash_form_cashout button").prop('disabled',true);$("#crash_form_cashout").fadeOut();timeouts.push(setTimeout(function()
  204. {var stopHeight=100-(endMultiplier-1)*10;if(endMultiplier<1||stopHeight>100)
  205. {stopHeight=100;}
  206. $("#crash_amount").stop(true,false).css('color','#b75552').text(phraser('CRASHED_AT')+' '+endMultiplier+'x');$("#crash_overlay").css('height',stopHeight+'%');if(endMultiplier>11)
  207. {$("#crash_overlay").css('height','0%');$("#crash_graph_y_holder").html('');for(y=Math.floor(endMultiplier);y>=Math.floor(endMultiplier)-10;y--)
  208. {$("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="'+y+'" style="bottom:'+((y- endMultiplier+ 10)*10)+'%;"><span>'+y+'</span><i></i></div>');}}
  209. else
  210. {$("#crash_overlay").css('height',stopHeight+'%');$("#crash_graph_y_holder").html('');for(y=11;y>=1;y--)
  211. {$("#crash_graph_y_holder").prepend('<div class="crash_graph_y" data-value="'+y+'" style="bottom:'+((y-1)*10)+'%;"><span>'+y+'</span><i></i></div>');}}},100));timeouts.push(setTimeout(function()
  212. {crashCountdown(10);},3000));}
  213. var crashParticleAnimation;function crashParticles()
  214. {if($("#crash_graph_holder").length==0){return;}
  215. $(crashParticleAnimation).stop(true);$("#crash_amount").css('color','rgb(255, 215, 0)');crashParticleAnimation=$({someValue:0}).animate({someValue:255},{duration:1000,easing:'linear',step:function()
  216. {var g=215+ Math.round((this.someValue/255)*(255-215));var b=0+ Math.round(this.someValue);$("#crash_amount").css('color','rgb(255, '+g+', '+b+')');},complete:function(){$("#crash_amount").css('color','rgb(255, 255, 255)');}});$("#graph_particles").explosion({origin:{x:$("#graph_particles").width()/2,
  217. y:$("#graph_particles").height()/2
  218. }});}
  219. function safeboxBet(data){if(data.answer=='correct'){$("#safe_box_log .round_bet").remove();$(".safe_box_empty").show();$("#safe_box_pot span").text("1000");return;}
  220. var oldValue=$("#safe_box_pot span").text();var newValue=parseFloat(oldValue)+0.25;$("#safe_box_pot span").text(newValue);$("#safe_box_pot").prepend('<div class="safe_box_add"><i class="fa fa-plus"></i></div>');$(".safe_box_add").fadeOut(2000);$('<div class="round_bet"><span class="safe_box_tries">'+data.number+'</span><a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'"></a> <b>'+data.player.persona+'</b></div>').hide().prependTo("#safe_box_log").fadeIn(1000);$(".safe_box_empty").hide();}
  221. var scratchy_finished=false;function scratchyEnd(arg){scratchy_finished=true;document.getSelection().removeAllRanges();$('#scratchy_pad').wScratchPad('enable',false).wScratchPad('clear');arg=arg.split(";");result=arg[0];$("#scratchy_hash").html("<b>"+phraser('HASH')+":</b> "+ arg[1]);if(result>3){var chestWinnings=[0,0,0,0,5,10,50,100,300,1000];updateCredits(chestWinnings[result]);$.growl.notice({title:'Scratchy',message:phraser("TICKET_RESULTED_IN")+ result+" "+ phraser("CHESTS")+ phraser("SCRATCHY_YOU_WON")+ chestWinnings[result]+" Credits."});}else{$.growl.error({title:'Scratchy',message:phraser("TICKET_RESULTED_IN")+ result+" "+ phraser("CHESTS")+ phraser("SCRATCHY_YOU_DIDNT_WIN")});}
  222. timeouts.push(setTimeout(function(){$('#scratchy_pad').wScratchPad('reset').wScratchPad('destroy').remove();$("#scratchy_holder").prepend('<div id="scratchy_pad"></div>');$("#scratchy_form").show();scratchyStart();},5000));}
  223. function scratchyStart(){scratchy_finished=false;$("#scratchy_pad").wScratchPad({size:30,bg:site+'/images/scratchy_1_1.png?load',fg:site+'/images/scratchy_clear.png?load',cursor:'url("'+site+'/images/scratch-coin-small.png") 10 10, default',realtime:true,scratchDown:null,scratchUp:null,scratchMove:function(e,percent){if(percent>50&&!scratchy_finished){scratchy_finished=true;scratchyEnd($("#scratchy_result").html());}}}).wScratchPad('enable',false);}
  224. function raceSort(){$('#dragrace_listings').find('.dragrace_list').sort(function(a,b){if($(b).attr('data-status')==$(a).attr('data-status')){return parseInt($(b).attr('data-sort'))- parseInt($(a).attr('data-sort'));}
  225. return parseInt($(a).attr('data-status'))- parseInt($(b).attr('data-status'));}).prependTo('#dragrace_listings');}
  226. function raceAdd(data){if($("#race_"+data.game.dragrace_id).length==0){$("#dragrace_listings").append('<div class="dragrace_list" id="coin_'+data.game.dragrace_id+'" data-sort="'+data.game.value+'" data-status="0"><span class="dragrace_list_status_join" data-id="'+data.game.dragrace_id+'" data-value="'+data.game.value+'"><i class="fa fa-play-circle"></i> '+phraser('CHALLENGE')+'</span><span class="dragrace_list_status_view" data-id="'+data.game.dragrace_id+'"><i class="fa fa-eye"></i></span><span class="dragrace_list_value">'+data.game.value+'<br>Credits</span><a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'" class="dragrace_list_avatar"></a></div>');raceSort();}}
  227. function raceJoin(data){$("#race_"+data.game.dragrace_id).append('<a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'" class="dragrace_list_avatar"></a>');if($("#dragrace_game_"+data.game.dragrace_id).length>0){$("#race_track_cars").append('<img data-player="'+data.player.position+'" src="'+site+'/images/race_smoke_v2.gif" class="race_track_smoke race_track_car_'+data.player.position+'"><img data-player="'+data.player.position+'" src="'+site+'/images/race_car'+data.player.car_image+'.png" class="race_track_car race_track_car_'+data.player.position+'">');$(".race_player[data-player='"+data.player.position+"'").html('<img src="'+site+'/images/race_car'+data.player.car_image+'.png" class="race_player_car"><img src="'+data.player.avatar+'" class="race_player_avatar" data-player="'+data.player.position+'">');if(data.game.finish=='1'){raceStart(data.game.winner_position);}}
  228. if(data.game.finish=='1'){raceEnd(data);}}
  229. function raceEnd(data){$("#race_"+data.game.dragrace_id).attr('data-status','1');$("#race_"+data.game.dragrace_id+" .dragrace_list_status_join").removeClass('dragrace_list_status_join dragrace_list_status_join_final').addClass('dragrace_list_status_finished').html(phraser('FINISHED'));raceSort();if(data.top.user_id==userID||data.mid.user_id==userID||data.player.user_id==userID){setTimeout(function(){if(data.game.winner_user_id==userID){$.growl.notice({title:'Drag Race',message:phraser('THE_GAME_OF')+" <b>"+data.game.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>."});updateCredits(2.95*data.game.value);}else{$.growl.error({title:'Drag Race',message:phraser('THE_GAME_OF')+" <b>"+data.game.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>."});}},9200);}
  230. if($("#dragrace_game_"+data.game.dragrace_id).length>0){raceStart(data.game.winner_position);}}
  231. function raceLoad(type,dragrace_id){$("#race_res").hide();$("#race_loader").show();$.ajax({type:"GET",url:"/dragrace_load.php",data:{type:type,dragrace_id:dragrace_id},success:function(text){$("#race_loader").hide();$("#race_res").html(text).show();}});}
  232. function raceStart(winner_position){var winner=1;if(winner_position=='mid'){winner=2;}
  233. if(winner_position=='bot'){winner=3;}
  234. var animation=[0,Math.floor(Math.random()*3)+ 1,Math.floor(Math.random()*3)+ 1,Math.floor(Math.random()*3)+ 1];animation[winner]=Math.floor(Math.random()*3)+ 4;timeouts.push(setTimeout(function(){$("[data-light='1']").attr('src',site+'/images/race_light_orange.png');$(".race_count").trigger('play');timeouts.push(setTimeout(function(){$(".race_count").trigger('pause');$(".race_count").prop("currentTime",0);},4000));},1000));timeouts.push(setTimeout(function(){$("[data-light='2']").attr('src',site+'/images/race_light_orange.png');},2000));timeouts.push(setTimeout(function(){$("[data-light='3']").attr('src',site+'/images/race_light_orange.png');$(".race_track_smoke").fadeIn(1000);},3000));timeouts.push(setTimeout(function(){$(".race_crowd, .race_crowd2").removeClass('race_crowd_bg').addClass('race_crowd_move_bg');$("[data-light='4']").attr('src',site+'/images/race_light_green.png');$(".race_track_car[data-player='top'], .race_track_smoke[data-player='top']").addClass('car_animate_'+animation[1]);$(".race_track_car[data-player='mid'], .race_track_smoke[data-player='mid']").addClass('car_animate_'+animation[2]);$(".race_track_car[data-player='bot'], .race_track_smoke[data-player='bot']").addClass('car_animate_'+animation[3]);$(".race_sound_fx").trigger('play');timeouts.push(setTimeout(function(){$(".race_sound_fx").trigger('pause');$(".race_sound_fx").prop("currentTime",0);},8000));},4000));timeouts.push(setTimeout(function(){$(".race_crowd, .race_crowd2").removeClass('race_crowd_move_bg').addClass('race_crowd_bg');$(".race_track_smoke").fadeOut(1000);$(".race_player[data-player='"+winner_position+"']").append('<img src="'+site+'/images/race_winner.png" class="race_player_winner">');$(".race_player_avatar[data-player='"+winner_position+"']").css('border','1px solid #FAD733').css('box-shadow','0px 0px 5px #FAD733');},9500));}
  235. function bettingEnd(data){if(data.game.result=='draw'){$.growl.warning({title:'Match Betting',message:phraser('THE_GAME_OF')+" <b>"+data.bet.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('DRAW')+"</b>."});updateCredits(data.bet.result);}else if(data.game.result=='loss'){$.growl.error({title:'Match Betting',message:phraser('THE_GAME_OF')+" <b>"+data.bet.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>."});}else{$.growl.notice({title:'Match Betting',message:phraser('THE_GAME_OF')+" <b>"+data.bet.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>."});updateCredits(data.bet.result);}}
  236. function coinSort(){$('#coinflip_listings').find('.coinflip_list').sort(function(a,b){if($(b).attr('data-status')==$(a).attr('data-status')){return parseInt($(b).attr('data-sort'))- parseInt($(a).attr('data-sort'));}
  237. return parseInt($(a).attr('data-status'))- parseInt($(b).attr('data-status'));}).prependTo('#coinflip_listings');}
  238. function coinAdd(data){if($("#coin_"+data.game.coinflip_id).length==0){$("#coinflip_listings").append('<div class="coinflip_list" id="coin_'+data.game.coinflip_id+'" data-sort="'+data.game.value+'" data-status="0"><span class="coinflip_list_status_join" data-id="'+data.game.coinflip_id+'" data-value="'+data.game.value+'"><i class="fa fa-play-circle"></i> '+phraser('CHALLENGE')+'</span><span class="coinflip_list_status_view" data-id="'+data.game.coinflip_id+'"><i class="fa fa-eye"></i></span><img src="'+site+'/images/'+data.creator.side+'.png" class="coinflip_list_side"><span class="coinflip_list_value">'+data.game.value+'<br>Credits</span><a show-profile="'+data.creator.user_id+'"><img src="'+data.creator.avatar+'" class="coinflip_list_avatar"></a><div class="coinflip_list_avatar_vs">VS</div><div class="coinflip_list_avatar_empty">X</div></div>');coinSort();}}
  239. function coinEnd(data){$("#coin_"+data.game.coinflip_id).attr('data-status','1');$("#coin_"+data.game.coinflip_id+" .coinflip_list_status_join").removeClass('coinflip_list_status_join coinflip_list_status_join_final').addClass('coinflip_list_status_finished').html(phraser('FINISHED'));$("#coin_"+data.game.coinflip_id+" .coinflip_list_avatar_empty").remove();$("#coin_"+data.game.coinflip_id).append('<a show-profile="'+data.challenger.user_id+'"><img src="'+data.challenger.avatar+'" class="coinflip_list_avatar"></a>');coinSort();if(data.creator.user_id==userID||data.challenger.user_id==userID){setTimeout(function(){if(data.winner.user_id==userID){$.growl.notice({title:'Coin Flip',message:phraser('THE_GAME_OF')+" <b>"+data.game.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>."});updateCredits(1.95*data.game.value);}else{$.growl.error({title:'Coin Flip',message:phraser('THE_GAME_OF')+" <b>"+data.game.value+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>."});}},8500);}
  240. $("#coinflip_amount_"+data.game.side).html(parseInt($("#coinflip_amount_"+data.game.side).html())+1);if($("#coinflip_game_"+data.game.coinflip_id).length>0){$("#coinflip_secret").html(data.game.secret);$("#coinflip_percent").html(data.game.percent);$("#coinflip_winner_persona").html(data.winner.persona);$("#coinflip_waiting").remove();$("#coinflip_hidden_user").prepend('<a class="coinflip_player" show-profile="'+data.challenger.user_id+'" data-side="'+data.challenger.side+'"><img src="'+site+'/images/'+data.challenger.side_pic+'.png" class="coinflip_player_side"><img src="'+data.challenger.avatar+'" class="coinflip_player_avatar"></a>');coinFlip(data.game.side);}}
  241. function coinLoad(type,coinflip_id){$("#coinflip_content").html('<div id="coinflip_loader" class="loader_small"></div>');$.ajax({type:"GET",url:"/coinflip_load.php",data:{type:type,coinflip_id:coinflip_id},success:function(text){$("#coinflip_content").html(text);}});}
  242. function coinFlip(side){clearTimeouts();$("#coin .both-text").html('5');var seconds=0;var timer=setInterval(function(){seconds++;$("#coin .both-text").html(function(i,html){if($("#coinflip_table_holder").length==0||(parseInt(html)==0&&seconds==10)){clearTimeout(timer);return"";}else if(seconds==10){seconds=0;return parseInt(html)-1;}});},100);$("#coin .both-timer").stop(true).animate({'top':'0px','opacity':'1',},6000,"easeInQuad");timeouts.push(setTimeout(function(){$(".flip").trigger('play');setTimeout(function(){$(".flip").trigger('pause');$(".flip").prop("currentTime",0);},2300);$('#coin .both').remove();$('#coin').addClass('animate'+side);$(".coinflip_player, .coinflip_winner").not("#coinflip_winner, #coinflip_info").css('opacity','0.5');},6000));timeouts.push(setTimeout(function(){var borderColor="#ffd700";if(side=='CT'){borderColor="#0cb6e7";}
  243. $("#coinflip_winner b").css('border-color',borderColor);$("[data-side='"+side+"']").css('opacity','1');$("[data-side='"+side+"'] .coinflip_player_side, [data-side='"+side+"'] .coinflip_player_avatar, #coin .front, #coin .back").css('border','1px solid '+borderColor).css('box-shadow','0px 0px 5px '+borderColor);$("#coinflip_winner").css('opacity','1');$("#coinflip_info div").show();},8000));}
  244. function slotSpin(that,i){var step=85;that.css('margin-top','0px');that.animate({marginTop:(-39*85)+'px',},i*600+1000,"easeOutQuad");}
  245. function slotSpinAll(){var i=0;$(".slot_child_content").each(function(){slotSpin($(this),i);i++;});}
  246. function slotFill(){var fruits=['apple','banana','blueberry','cherry','pear','treasure'];$(".slot_child_content").each(function(){$(this).html('')
  247. for(var i=0;i<40;i++){var fruit=fruits[Math.floor(Math.random()*fruits.length)];$(this).append('<img src="'+site+'/images/'+fruit+'.png">');}});}
  248. function blackJackEnd(data){if(data.player.user_id==userID){var value=data.game.value;var credits=data.game.credits;var choiceText=data.player.total;var oppText=data.dealer.total;setTimeout(function(){if(data.player.busted){$.growl.error({title:'Blackjack',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(value).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>. "+phraser('YOU_GOT_BUSTED')});}else if(data.winner.state=='draw'){$.growl.warning({title:'Blackjack',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(value).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('DRAW')+"</b>. "+phraser('YOU_GOT')+choiceText+phraser('DEALER_GOT')+oppText+"."});updateCredits(credits);}else if(data.winner.state=='win'){$.growl.notice({title:'Blackjack',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(value).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>. "+phraser('YOU_GOT')+choiceText+phraser('DEALER_GOT')+oppText+"."});updateCredits(credits);}else{$.growl.error({title:'Blackjack',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(value).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>. "+phraser('YOU_GOT')+choiceText+phraser('DEALER_GOT')+oppText+"."});}},data.dealer.cards*1000-1000);}}
  249. function blackJackDeal(cards){var cardArr=cards.split(";");var cardOne=cardArr[0].split(",");var cardTwo=cardArr[1].split(",");var cardThree=cardArr[2].split(",");$("#deal_shuffle").hide();$("#hit_double_stand").show();blackJackAddCard(cardOne[0],1,cardOne[1],false);setTimeout(function(){blackJackAddCard(cardThree[0],1,cardThree[1],true);},1000);setTimeout(function(){blackJackAddCard(cardTwo[0],2,cardTwo[1],false);},2000);setTimeout(function(){if(parseInt(cardTwo[1])!=21){$(".blackjack_double").removeClass('disabled');$(".blackjack_hit").removeClass('disabled');$(".blackjack_stand").removeClass('disabled');}else{blackJackStand();}},3000);}
  250. function blackJackHit(card,doubled){card=card.split(",");blackJackAddCard(card[0],card[1],card[2],false);if(card[3]=='bust'||doubled){setTimeout(function(){$(".blackjack_hit").addClass('disabled');blackJackStand();},1000);}else{setTimeout(function(){$(".blackjack_hit").removeClass('disabled');},1000);}
  251. if(parseInt(card[2])==21&&!doubled){setTimeout(function(){blackJackStand();},1000);}}
  252. function blackJackAddCard(card,card_number,sum,dealer){var card_id="card_p"+card_number;var card_color="card_black";var card_icon="&clubs;";var card_value=card.substring(1)
  253. if(card.charAt(0)=="H"){card_color="card_red";card_icon="&hearts;";}else if(card.charAt(0)=="D"){card_color="card_red";card_icon="&diams;";}else if(card.charAt(0)=="S"){card_icon="&spades;";}
  254. var degVal,topVal,leftVal,topAlign,playerType,valueType,cardsType;degVal=topVal=leftVal=0;if(dealer){topAlign=-1;playerType="#blackjack_dealer";valueType="#blackjack_value_number_dealer";cardsType="#blackjack_dealer";}else{topAlign=1;playerType="#blackjack_player";valueType="#blackjack_value_number_player";cardsType="#blackjack_player";}
  255. var leftMargin=$("#blackjack_table").width()/-5 + 30*(card_number-1);
  256. var topMargin=127- 5*card_number;topAlign=topMargin*topAlign;$("#blackjack_deck").prepend('<div class="card card_90 card_back" id="card_spinning_'+card_id+'" style="z-index:20"></div>');$({deg:90,top:0,left:0}).animate({deg:360,top:topAlign,left:leftMargin},{duration:300,step:function(now,fx){if(fx.prop=="deg"){degVal=now;}else if(fx.prop=="top"){topVal=now;}else if(fx.prop=="left"){leftVal=now;}
  257. $("#card_spinning_"+card_id).css({top:topVal+'px',left:leftVal+'px',transform:'rotate('+degVal+'deg) scaleX(-1)'});},complete:function(){$("#card_spinning_"+card_id).css({top:topAlign+'px',left:leftMargin+'px',transform:'rotate(0deg) scaleX(-1)'});}});$(".deal").prop("currentTime",0.1).trigger('play');setTimeout(function(){$(".deal").trigger('pause');$(".deal").prop("currentTime",0);},900);setTimeout(function(){$("#card_spinning_"+card_id).remove();$(playerType).append('<div id="'+card_id+'" class="card_flipper"><div class="card card_back"></div><div class="card '+card_color+'"><div class="card_top">'+card_icon+' '+card_value+'</div><div class="card_mid">'+card_icon+'</div><div class="card_bot">'+card_icon+' '+card_value+'</div></div></div>');setTimeout(function(){$("#"+card_id).addClass('card_flip');},100);setTimeout(function(){$(valueType).html(sum);},300);},300);}
  258. function blackJackStand(){$("#hit_double_stand button").addClass('disabled');$(".blackjack_stand").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"GET",url:"/blackjack_bet.php",data:{stand:true,user_token:$("#user_token").val()},success:function(text){$(".blackjack_stand").prop('disabled',false).html(phraser('STAND'));if(text=='errorCards'||text=='errorGameID'||text=='errorFinished'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{var cardArr=text.split(";");if(cardArr[0]!="bust"&&cardArr[0]!="blackjack"){var i=0;var card=cardArr[i].split(",");blackJackAddCard(card[0],(i+2),card[1],true);i++;var cardInterval=setInterval(function(){if(i==cardArr.length-1||i>cardArr.length-1){clearInterval(cardInterval);}else{var card=cardArr[i].split(",");blackJackAddCard(card[0],(i+2),card[1],true);i++;}},1000);timeouts.push(setTimeout(function(){$("#blackjack_player").html('').hide();$("#blackjack_dealer").html('');$("#blackjack_better").show();$(".blackjack_block").hide();$(".blackjack_controls").hide();$(".blackjack_game_value").html('0 Credits').hide();},(i+4)*1000));}else{timeouts.push(setTimeout(function(){$("#blackjack_player").html('').hide();$("#blackjack_dealer").html('');$("#blackjack_better").show();$(".blackjack_block").hide();$(".blackjack_controls").hide();$(".blackjack_game_value").html('0 Credits').hide();},1500));}}}});}
  259. function addRouletteBet(data){var betHTML='<div class="roulette_bets" id="r'+data.bet.roulette_bet_id+'" data-user="'+data.player.user_id+'" data-choice="'+data.bet.choice+'"><div class="roulette_bets_value">'+data.bet.value+' Credits</div><div class="roulette_bets_user"><a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'"></a> '+data.player.persona+'</div></div>';if($(".roulette_table").length>0&&!$(".roulette_bets_holder #r"+data.bet.roulette_bet_id).length){if(data.bet.timer_start==1){startTimer('roulette');}
  260. var betContainer='#roulette_green';if(data.bet.choice==2){betContainer='#roulette_red';}else if(data.bet.choice==3){betContainer='#roulette_black';}
  261. $(betContainer).prepend(betHTML);var old_val=parseFloat($("#value").html());var new_val=(old_val+ parseFloat(data.bet.value));$("#value").html(new_val.toFixed(2));$('.progress_value').stop(true);$({someValue:old_val}).animate({someValue:new_val.toFixed(2)},{duration:200,easing:'swing',step:function(){$('.progress_value').text(this.someValue.toFixed(2));},complete:function(){$('.progress_value').text(new_val.toFixed(2));}});setTimeout(function(){$('.progress_value').stop(true).text(new_val.toFixed(2));},250);var newColorVal=Math.round((parseFloat($(betContainer+"_total").html().replace(" Credits"))+ parseFloat(data.bet.value))*100)/ 100;
  262. $(betContainer+"_total").html(newColorVal+" Credits");document.title=new_val.toFixed(2)+' - Roulette | CSGOSpeed';$(".blop").trigger('play');}
  263. if(data.player.user_id==userID&&!$("#global_roulette_bets #r"+data.bet.roulette_bet_id).length){$("#global_roulette_bets").append(betHTML);}}
  264. function startRouletteAnimation(data){if($(".roulette_table").length>0){var number=data.roulette.winner_number;var targetColor='';if(number==0){targetColor='green';numberCalc=0;}else if(number>10){targetColor='black';numberCalc=2*(number- 10);}else{targetColor='red';numberCalc=2*(number)- 1;}
  265. var numberMargin=60*numberCalc;var randPos=Math.floor(Math.random()*52)+ 6
  266. var centerMargin=-21*60+ 60*7+ $("#page_content").width()/2;
  267. var startMargin=centerMargin- numberMargin- randPos;$("#round_draw_pointer").show();$(".roulette_table").css('left',startMargin+'px').addClass('roulette_animate');$(".click").trigger('play');timeouts.push(setTimeout(function(){$(".click").trigger('pause');$(".click").prop("currentTime",0);},5200));timeouts.push(setTimeout(function(){endRouletteAnimation(data);},11000));timeouts.push(setTimeout(function(){calcRouletteBets(targetColor);$(".roulette_table").css({transform:'translate(-1680px, 0)'});},8000));}
  268. setTimeout(function(){checkRouletteWin(data);},8000);}
  269. function calcRouletteBets(color){$(".roulette_choice_bets").each(function(){var that=$(this);var thatTotal=0;var thatSign='-';var thatClass='losses';var thatColor=that.attr("id").replace('roulette_','');that.find(".roulette_bets .roulette_bets_value").each(function(){thatTotal+=parseFloat($(this).text());});thatTotal=(Math.round(thatTotal*100)/ 100)
  270. if(thatColor==color){thatSign='+';thatClass='winnings';if(color=='green'){thatTotal=thatTotal*15;}else{thatTotal=thatTotal*2;}}
  271. $('#roulette_'+thatColor+'_total').addClass(thatClass);$({someValue:0}).animate({someValue:thatTotal.toFixed(2)},{duration:300,easing:'swing',step:function(){$('#roulette_'+thatColor+'_total').text(thatSign+" "+ this.someValue.toFixed(2)+" Credits");},complete:function(){$('#roulette_'+thatColor+'_total').text(thatSign+" "+ thatTotal.toFixed(2)+" Credits");}});});}
  272. function endRouletteAnimation(data){$(".roulette_bets_total span").html('0 Credits').removeClass('winnings').removeClass('losses');$("#round_draw_pointer").hide();$(".roulette_table").css('left','0').removeClass('roulette_animate').css({transform:'translate(0, 0)'});$(".roulette_choice_bets").html('');document.title='0 - Roulette | CSGOSpeed';$(".progress_value").html('0');$("#value").html('0');$("#progress_load_holder_roulette").stop(true).animate({width:"0%"},1000);$("#timer_seconds_roulette").html('30');$("#timer_minutes_roulette").html('0');$(".load").trigger('play');setTimeout(function(){$(".load").trigger('pause');$(".load").prop("currentTime",0);},1000);$(".roulette_id").html(data.roulette.new_roulette_id);var bgColor='';if(data.roulette.winner_number==0){bgColor='#5FAE63';}else if(data.roulette.winner_number>=11){bgColor='#1b1e27';}else{bgColor='#bc5652';}
  273. if($("#rr"+data.roulette.roulette_id).length==0){$(".roulette_results_holder").prepend('<div class="roulette_result" id="rr'+data.roulette.roulette_id+'" style="background: '+bgColor+'">'+data.roulette.winner_number+'</div>');}}
  274. var checkingRouletteWin=false;function checkRouletteWin(data){if(!checkingRouletteWin){checkingRouletteWin=true;var total=0;$("#global_roulette_bets .roulette_bets[data-user='"+userID+"']").each(function(){var betChoice=$(this).attr("data-choice");if((betChoice-1)*10>=data.roulette.winner_number&&(betChoice-1)*10-9<=data.roulette.winner_number){var times=2;if(betChoice==1){times=15;}
  275. total+=parseFloat($(this).find('.roulette_bets_value').html())*times;}});if(total>0){updateCredits(total);$.growl.notice({title:'Roulette',message:phraser('WON_A_TOTAL_OF')+" <b>"+parseFloat(total).toFixed(2)+"</b>"+phraser('CREDITS_ON')+" Roulette."});}
  276. setTimeout(function(){checkingRouletteWin=false;},5000);}
  277. $("#global_roulette_bets").html('');}
  278. function sortHeadsup(){$('#headsup_bets').find('.headsup_thumb').sort(function(a,b){return parseInt($(b).attr('data-sort'))- parseInt($(a).attr('data-sort'));}).prependTo('#headsup_bets');}
  279. function addHeadsup(data){if($("#h"+data.game.headsup_id).length==0){$("#headsup_bets").append('<div class="headsup_thumb" id="h'+data.game.headsup_id+'" data-sort="'+data.game.value+'"><div class="headsup_thumb_info"><span>'+data.game.value+'</span> Credits<a class="headsup_go"><i class="fa fa-play-circle"></i></a></div><img src="'+data.creator.avatar+'"></div>');sortHeadsup();}}
  280. function endHeadsup(data){$("#h"+data.game.headsup_id).remove();if(data.creator.user_id==userID){var credits=data.game.value;var choiceText='';var oppText='';if(data.creator.choice==1){choiceText=phraser('ROCK');}else if(data.creator.choice==2){choiceText=phraser('PAPER');}else if(data.creator.choice==3){choiceText=phraser('SCISSOR');}
  281. if(data.challenger.choice==1){oppText=phraser('ROCK');}else if(data.challenger.choice==2){oppText=phraser('PAPER');}else if(data.challenger.choice==3){oppText=phraser('SCISSOR');}
  282. if(data.game.result=='0'){$.growl.warning({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('DRAW')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});updateCredits(0.95*credits);}else if(data.game.result=='2'){$.growl.notice({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});updateCredits(1.95*credits);}else if(data.game.result=='1'){$.growl.error({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});}}}
  283. function sortUsers(){$('.round_players_holder').find('.round_player').sort(function(a,b){return $(b).attr('data-sort')- $(a).attr('data-sort');}).prependTo('.round_players_holder');}
  284. function sortDeposits(){$('.round_bets_holder').find('.round_bet').sort(function(a,b){return parseInt($(b).attr('data-sort'))- parseInt($(a).attr('data-sort'));}).prependTo('.round_bets_holder');}
  285. function addBet(data){if(!$("#r"+data.deposit.deposit_id).length&&$("#round_draw_spinner").length){if(data.deposit.timer_start==1){startTimer('jackpot');}
  286. $("#round_items_empty").hide();$("#round_players_empty").hide();$("#round_deposits_empty").hide();if(!$("#round_player_"+data.player.user_id).length){$(".round_players_holder").prepend('<a show-profile="'+data.player.user_id+'" class="round_player tool" data-sort="'+data.deposit.value+'" id="round_player_'+data.player.user_id+'" title="'+data.player.persona+'"><span class="round_player_chance" id="val_'+data.deposit.value+'">'+data.deposit.chance+'%</span><img src="'+data.player.avatar+'"></a>');}else{var new_player_value=parseFloat($("#round_player_"+data.player.user_id).attr('data-sort'))+ parseFloat(data.deposit.value);var new_player_chance=parseFloat($("#round_player_"+data.player.user_id).find('.round_player_chance'))+ parseFloat(data.deposit.chance);$("#round_player_"+data.player.user_id).attr('data-sort',new_player_value);$("#round_player_"+data.player.user_id).find('.round_player_chance').attr('id','val_'+new_player_value).html(new_player_chance+'%');}
  287. $(".round_bets_holder").prepend('<div class="round_bet" id="r'+data.deposit.deposit_id+'" data-sort="'+data.deposit.date+'"><a show-profile="'+data.player.user_id+'"><img src="'+data.player.avatar+'"></a> <b>'+data.player.persona+'</b> '+phraser('DEPOSITED')+' '+data.deposit.value+' Credits</div>');sortUsers();sortDeposits();var old_val=parseFloat($("#value").html());var new_val=(old_val+ parseFloat(data.deposit.value));$("#value").html(new_val.toFixed(2));$('.progress_value').stop(true);$({someValue:old_val}).animate({someValue:new_val.toFixed(2)},{duration:200,easing:'swing',step:function(){$('.progress_value').text(this.someValue.toFixed(2));},complete:function(){$('.progress_value').text(new_val.toFixed(2));}});setTimeout(function(){$('.progress_value').stop(true).text(new_val.toFixed(2));},250);document.title=new_val.toFixed(2)+' - Jackpot | CSGOSpeed';$(".round_player_chance").each(function(){var new_chance=$(this).attr('id');var total_val=$("#value").html();if(new_chance!=undefined){new_chance=new_chance.replace('val_','');new_chance=(parseFloat(new_chance)/total_val)*100;
  288. $(this).text(new_chance.toFixed(2)+"%");}});$(".blop").trigger('play');}}
  289. function drawWinner(data){if($("#round_draw_spinner").length){$(".tipsy").remove();var randPos=($("#page_content").width()/2) + Math.floor(Math.random() * 112) + 6;
  290. $("#round_draw_players").css('margin-left',(randPos-840)+'px').html(data.spinner.html);$("#round_draw_players").addClass('jackpot_animate');$("#round_draw_pointer").fadeIn();$("#round_holder").fadeOut(300);$("#round_draw_holder").fadeIn(300);timeouts.push(setTimeout(function(){$(".click").trigger('play');timeouts.push(setTimeout(function(){$(".click").trigger('pause');$(".click").prop("currentTime",0);},5200));},500));timeouts.push(setTimeout(function(){$("#round_draw_players").css({transform:'translate(-2280px, 0)'});$("#round_draw_pointer").fadeOut();$(".win_pic").addClass('winning_picture');$("#round_draw_winner").html("<span id='type_winner_persona'><i class='fa fa-user'></i> </span><div class='round_info_title'><i class='fa fa-info-circle'></i> "+phraser('DETAILS')+"</div><table class='round_draw_winner_table waiting_table' style='margin:20px auto 0;'><tr><td>"+phraser("ROUND_L")+"</td><td>#"+data.round.round_id+"</td></tr><tr><td>"+phraser("VALUE")+"</td><td><b class='navi-color-yellow'>"+ parseFloat(data.round.value).toFixed(2)+" Credits</b></td></tr><tr><td>"+phraser("CHANCE")+"</td><td><b>"+ parseFloat(data.round.winner_chance).toFixed(2)+"%</b></td></tr><tr><td>"+phraser("WINNER_PERCENTAGE")+"</td><td>"+data.round.winner_percentage+"%</td></tr></table>").fadeIn('slow');changeText(data.round.winner_persona,$("#type_winner_persona"),(data.round.winner_persona.length-10)*-5+120);},7300));timeouts.push(setTimeout(function(){newRound(data);},11*1000));}
  291. setTimeout(function(){if(data.round.winner_user_id==userID){updateCredits(data.round.value*data.round.winner_take);$.growl.notice({title:'Jackpot',message:phraser('WON_A_TOTAL_OF')+" <b>"+parseFloat(data.round.value*data.round.winner_take).toFixed(2)+"</b>"+phraser('CREDITS_ON')+" Jackpot."});}},7000);}
  292. function newRound(data){$(".tipsy").remove();timerStarted=false;$(".round_players_holder").html('');$(".round_items_holder").html('');$(".round_bets_holder").html('');$("#round_items_empty").show();$("#round_players_empty").show();$("#round_deposits_empty").show();$(".round_info_extra").find('.round_old_player:first').remove();$(".round_info_extra").prepend('<a show-profile="'+data.round.winner_user_id+'" class="round_old_player tool-top" title="<b>'+phraser('ROUND_L')+':</b><br>'+data.round.round_id+'<br><br><b>'+phraser('WIN_PERCENTAGE')+':</b><br>'+data.round.winner_percentage+'<br><br><b>'+phraser('HASH')+':</b><br>'+data.round.hash+'"><span class="round_old_chance"><b>'+data.round.value+'</b> Credits<br>@ <b>'+data.round.winner_chance.toFixed(2)+'%</b></span><img src="'+data.round.winner_avatar+'"></a>');$(".round_info_extra").prepend('<a class="round_old_player tool-top" title="<b>'+phraser('ROUND_L')+'</b>:<br>'+data.new_round.round_id+'<br><br><b>'+phraser('HASH')+':</b><br>'+data.new_round.hash+'"><span class="round_old_chance"><b>TBD</b><br>TBD</span><img src="'+site+'/images/no_user.jpg"></a>');$("#round_draw_holder").hide(500);$("#round_holder").show(500);$("#round_draw_players").html('').removeClass('spinner_animate').css({transform:'translate(0, 0)'});$("#round_draw_winner").html('').hide();$("#progress_load_holder_jackpot").animate({width:"0%"},1000);$("#value").html('0');$(".progress_value").text("0");document.title='0 - Jackpot | CSGOSpeed';$("#timer_seconds_jackpot").html('30');$("#timer_minutes_jackpot").html('0');$(".load").trigger('play');setTimeout(function(){$(".load").trigger('pause');$(".load").prop("currentTime",0);},1000);}
  293. var ongoingTimerInterval;function ongoingTimer(){clearInterval(ongoingTimerInterval);var counter=parseInt($(".round_draw_ongoing_timer").html());ongoingTimerInterval=setInterval(function(){counter--;if(counter<0){$(".round_draw_ongoing").fadeOut();clearInterval(ongoingTimerInterval);}else{$(".round_draw_ongoing_timer").html(counter);}},1000);}
  294. timerStarted=false;timerFinishedPage=false;function startTimerTick(type,text){var tMin=Math.floor(parseInt(text)/60);
  295. var tSec=parseInt(text)- tMin*60;var progTime=text*1000;var progWidth=100*((30-text)/30);
  296. if(tSec<10){tSec="0"+ tSec;}
  297. if(text<-20){tSec="30";tMin="0";}else if(text<=0){tSec="00";tMin="0";}
  298. var startTime=new Date().getTime();var startSec=parseInt(text);$("#timer_seconds_"+type).html(tSec);$("#timer_minutes_"+type).html(tMin);$("#timer_counter_"+type).show();$("#timer_loader_"+type).hide();if(text>-20){$("#progress_load_holder_"+type).animate({width:progWidth+'%'},500,'linear');setTimeout(function(){$("#progress_load_holder_"+type).animate({width:'100%'},progTime,'linear');},500);}
  299. if(!timerStarted&&text>0){timerStarted=true;var countTimer=setInterval(function(){var timeElapse=Math.floor((new Date().getTime()- startTime)/1000);
  300. var timerNow=startSec- timeElapse;var min=Math.floor(timerNow/60);var sec=timerNow- min*60;if(min<0){timerStarted=false;sec=0;min=0;clearInterval(countTimer);}else if(sec==0&&min>0){sec=59;min=min- 1;}else if(sec>0){sec=sec- 1;}else if(sec==0&&min==0){timerStarted=false;clearInterval(countTimer);}
  301. if(sec<10){sec="0"+ sec;}
  302. $("#timer_seconds_"+type).html(sec);$("#timer_minutes_"+type).html(min);if(timerFinishedPage){$("#progress_load_holder_"+type).stop(true).width('0%')
  303. $("#timer_seconds_"+type).html('30');$("#timer_minutes_"+type).html('0');timerStarted=false;timerFinishedPage=false;clearInterval(countTimer);}},1000);}}
  304. function startTimer(type,attempt){setTimeout(function(){$("#timer_loader_"+type).show();$("#timer_counter_"+type).hide();attempt=attempt||0;finishRoundExec=false;$.ajax({type:"GET",url:"/"+type+"_timer.php",success:function(text){if($("."+type+"_hidden_value").length){timerFinishedPage=false;startTimerTick(type,text);}},error:function(){if(attempt<=1){startTimer(type,attempt+ 1);}else{swal({title:phraser('ERROR'),html:phraser('PLEASE_TRY_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}}});},Math.floor(Math.random()*400)+ 1);}
  305. function docTitle(string){return(string.charAt(0).toUpperCase()+ string.slice(1)).replace(".php","");}
  306. var timeouts=[];function clearTimeouts(){for(var i=0;i<timeouts.length;i++){clearTimeout(timeouts[i]);clearInterval(timeouts[i]);}
  307. timeouts=[];timerFinishedPage=true;}
  308. function stopAnimations(){$(".audio_file").each(function(){$(this).trigger('pause').prop("currentTime",0);});$(".roulette_table, .progress_load_holder").stop(true);$("#crash_overlay").css('height','100%');$(crashAnimation).stop(true,false);$(crashParticleAnimation).stop(true);clearTimeouts();crashAutoBet=false;}
  309. freeToLoad=true;function loadPage(page,type){var extrasGET='';var extrasURL='';if(typeof type!=='undefined')
  310. {extrasGET='?type='+type;extrasURL='/'+type;}
  311. var thisPage=document.location.pathname.replace("/","");$("#page_content").html('<div class="loader"></div>');stopAnimations();$.ajax({type:"GET",url:"/"+page+extrasGET,success:function(resp){document.title=docTitle(page)+' | CSGOSpeed';$("#page_content").html(resp);if(thisPage!=page.replace(".php","")){window.history.pushState("","",'/'+ page.replace(".php","")+extrasURL);}
  312. setTimeout(function(){freeToLoad=true;},100);},error:function(xhr,ajaxOptions,thrownError){setTimeout(function(){freeToLoad=true;},100);swal({title:phraser('ERROR'),html:phraser('PLEASE_TRY_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}});}
  313. function loadSupport(statsType,ticketID){ticketID=ticketID||'';$("#user_stats_response").hide();$("#user_stats_loader").show();$.ajax({type:"GET",url:"/support_stats.php",data:{stats:statsType,ticket_id:ticketID},success:function(text){$("#user_stats_response").html(text);$("#user_stats_loader").hide();$("#user_stats_response").show();}});}
  314. function loadUserStats(statsType){$("#user_stats_response").hide();$("#user_stats_loader").show();var user_id=0;if($("#stats_user_id").length>0){user_id=$("#stats_user_id").html();}
  315. $.ajax({type:"GET",url:"/user_stats.php",data:{stats:statsType,user_id:user_id},success:function(text){$("#user_stats_loader").hide();$("#user_stats_response").html(text).show();}});}
  316. function loadTopList(chosenDate,chosenType){$("#players_result").hide().html('');$("#players_load").show();$.ajax({type:"GET",url:"/players_stats.php",data:{date:chosenDate,type:chosenType},success:function(text){$("#players_load").hide();$("#players_result").html(text).show();}});}
  317. var loadAdminFinished=false;function loadAdmin(page){loadAdminFinished=false;$("#admin_response").hide();$("#admin_loader").show();$.ajax({type:"GET",url:"/admin_pages.php",data:{page:page},success:function(text){loadAdminFinished=true;$("#admin_loader").hide();$("#admin_response").html(text).show();}});}
  318. function addNotice(data){$(".admin_notice_message").html(data.message);$(".admin_notice").fadeIn(300);}
  319. function removeNotice(data){$(".admin_notice").hide();}
  320. function ticketResponse(data){$.growl.warning({title:phraser('SUPPORT'),message:phraser('TICKET_ANSWERED')});}
  321. function adminLoadUser(user_id){if(!$("#admin_response").length){loadPage('admin.php');}
  322. var loadTick=setInterval(function(){if($("#admin_response").length){clearInterval(loadTick);adminLoadUsers(user_id);}},100);}
  323. function adminLoadUsers(user_id){if(!$("#admin_user_response").length){loadAdmin('users');}
  324. var loadTick=setInterval(function(){if($("#admin_user_response").length){clearInterval(loadTick);adminLoadUserFinal(user_id);}},100);}
  325. function adminLoadUserFinal(user_id){$("#admin_menu li").each(function(){$(this).removeClass('active');});$("a[data-page='users']").parent().addClass('active');$(".tipsy").remove();$("#admin_user_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'users',user_id:user_id},success:function(text){$("#admin_user_response").html(text);}});}
  326. function adminGetListed(start){$("#admin_bots_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{get_listed:true,start:start},success:function(text){$("#admin_bots_loader").hide().before(text);if(text.indexOf("All Bots")==-1)
  327. {adminGetListed(start+1);}}});}
  328. function removeChatMessage(data){$(".tipsy").remove();$('.chat_message[data-user="'+data.user_id+'"]').remove();}
  329. function addChatMessage(data){var muted_users=$("#chat_mutes").html().split(";");if(muted_users.indexOf(data.user_id)>-1){return;}
  330. var scrolled=false;var elem=$("#chat_cell");if(elem[0].scrollHeight- elem.scrollTop()>elem.outerHeight()+50){scrolled=true;}
  331. var usrMod=[];if(data.level==3){usrMod[data.user_id]='chat_message_admin';}else if(data.level==2){usrMod[data.user_id]='chat_message_mod';}else if(data.bot==1){usrMod[data.user_id]='chat_message_bot';}else{usrMod[data.user_id]='';}
  332. var mute=[];if(userID!=0&&usrMod[data.user_id]==''){mute[data.user_id]='<a class="mute_user tool-left" data-id="'+data.user_id+'" title="Mute"><i class="fa fa-user-times"></i></a>';}else{mute[data.user_id]='';}
  333. var chatModLink=[];if(chatMod&&usrMod[data.user_id]==''){chatModLink[data.user_id]='<a sID="'+data.steamID+'" class="chat_ban" data-title="'+data.persona+'"><i class="fa fa-ban"></i></a>';}else{chatModLink[data.user_id]='';}
  334. var level=[];if(data.bot==1){level[data.user_id]='<span class="chat_user_level">1337</span>';}else{level[data.user_id]='<span class="chat_user_level">'+data.user_level+'</span>';}
  335. $("#chat_cell").append('<div class="chat_message" data-user="'+data.user_id+'"><div class="chat_message_title '+usrMod[data.user_id]+'">'+ chatModLink[data.user_id]+ mute[data.user_id]+ level[data.user_id]+'<a show-profile="'+data.user_id+'"><img src="'+ data.steamPic+'"></a>'+ data.steamName+'</div><div class="chat_message_text">'+ data.message+'</div></div>');if(!scrolled){elem.stop(true).animate({scrollTop:elem[0].scrollHeight},100);}
  336. if($('#chat_cell').find('.chat_message').length>30&&!scrolled){$('#chat_cell').find('.chat_message:lt('+($('#chat_cell').find('.chat_message').length- 30)+')').remove();}}
  337. function postChatMessage(e){var isTrusted=false;if(e.screenX&&e.screenX!=0&&e.screenY&&e.screenY!=0){isTrusted=true;}
  338. if(e.keyCode==13||e.which==13){isTrusted=true;}
  339. if(!isTrusted){$.ajax({type:"POST",url:"/chat_message.php",data:{illegal:true},success:function(text){}});return;}
  340. if($("#chat_message_textarea").val().length==0){return;}
  341. var messageVal=$("#chat_message_textarea").val();$("#chat_message_textarea").val('');$("#chat_message_send").prop('disabled',true).css("background-color","#2d2d2d");var cmdTitle="";var cmdText="";if(messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"")=='/help'){cmdTitle="COMMANDS";cmdText='/help to show all commands<br>/rules to show chat rules<br>/recruits to get link to enter code<br>/hint to see the current chat giveaway hint';}else if(messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"")=='/rules'){cmdTitle="CHAT RULES";cmdText='Do not beg.<br>Do not post links.<br>Do not advertise.<br>Speaking english is preferred.<br>Treat people how you want to be treated yourself.';}else if(messageVal.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"")=='/recruits'){cmdTitle="RECRUITS";cmdText='Go to <a class="menu_item" data-page="recruits.php">Recruits</a>';}
  342. if(cmdText!=""&&cmdTitle!=""){$("#chat_cell").append('<div class="chat_message" data-user="21"><div class="chat_message_title chat_message_bot"><span class="chat_user_level">1337</span><a show-profile="21"><img src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/4c/4cdc67b6ef726812b43e7af7c2f66648f7ebc661.jpg"></a>Chat BOT</div><div class="chat_message_text"><center><b>['+cmdTitle+']</b></center>'+cmdText+'</div></div>');$("#chat_cell").stop(true).animate({scrollTop:$("#chat_cell")[0].scrollHeight},100);$("#chat_message_send").prop('disabled',false).css("background-color","#e69b23");return;}
  343. $.ajax({type:"POST",url:"/chat_message.php",data:{message:messageVal},success:function(text){if(text=="errorSpam"){swal({title:phraser('ERROR'),html:phraser('SPAMMING_CHAT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=="errorSlowMode"){swal({title:phraser('ERROR'),html:phraser('SLOW_MODE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=="errorModMode"){swal({title:phraser('ERROR'),html:phraser('MOD_MODE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text.indexOf("errorBanned")>-1){swal({title:phraser('ERROR'),html:text.replace("errorBanned",""),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}
  344. $("#chat_message_send").prop('disabled',false).css("background-color","#e69b23");},error:function(xhr,ajaxOptions,thrownError){swal({title:phraser('ERROR'),html:phraser('PLEASE_TRY_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});$("#chat_message_send").prop('disabled',false).css("background-color","#e69b23");}});}
  345. function loadSteamStatus(){$("#steam_status_text").hide();$("#steam_status_progress").hide();$("#steam_status_loader").show();$.ajax({type:"GET",url:"/steamstatus.php",success:function(text){var statusPercent=0;var statusClass='';switch(text){case'Normal':statusPercent=100;statusClass='progress-bar-success';break;case'Inventory Delayed':statusPercent=60;statusClass='progress-bar-warning';break;case'Sessions Delayed':statusPercent=50;statusClass='progress-bar-warning';break;case'Inventory Critical':statusPercent=35;statusClass='progress-bar-warning';break;case'Going Down':statusPercent=20;statusClass='progress-bar-danger';break;case'Session Surge':statusPercent=15;statusClass='progress-bar-danger';break;case'Sessions Surge':statusPercent=15;statusClass='progress-bar-danger';break;case'No Session':statusPercent=10;statusClass='progress-bar-danger';break;case'WebAPI Offline':statusPercent=5;statusClass='progress-bar-danger';break;default:statusPercent=90;statusClass='progress-bar-success';break;}
  346. $("#steam_status_text").show();$("#steam_status_progress").show();$("#steam_status_loader").hide();$("#steam_status").html(text);$("#steam_status_percentage").html(statusPercent+"%");$("#steam_status_bar").removeClass().addClass('progress-bar '+statusClass).width(statusPercent+'%');}});}
  347. deals_bot_loading=false;botDealsPage=1;function loadBotDeals(more,min,max){if(!more){$('#withdraw_result').html('<div class="loader_small"></div>');$("#withdraw_empty").show();$("#withdraw_choose").html('').hide();$('#withdraw_bot_chosen').html('');$('#item_pot_value_bot').html('0 Credits');}else{$('#withdraw_result').append('<div class="withdraw_clear" style="clear: both;"></div><div class="loader_small"></div>');}
  348. if(!deals_bot_loading){deals_bot_loading=true;$.ajax({type:"GET",url:"/withdraw_deals.php?min="+min+"&max="+max+"&page="+botDealsPage,success:function(text){deals_bot_loading=false;if(!more){$('#withdraw_result').html(text);}else{$('#withdraw_result .loader_small, #withdraw_result .withdraw_clear').remove();$('#withdraw_result').append(text);$("#withdraw_choose .inventory_item").each(function(){var itemID=$(this).attr('id');$("#withdraw_result #"+itemID).remove();});}}});}}
  349. inventory_bot_loading=false;botInventoryPage=1;function loadBotInventory(more,search){var order=$("#withdraw_order").val();var name=$("#withdraw_search").val();var min=$("#withdraw_min").val();var max=$("#withdraw_max").val();if(!more&&!search){$('#withdraw_result').html('<div class="loader_small"></div>');$("#withdraw_empty").show();$("#withdraw_choose").html('').hide();$('#withdraw_bot_chosen').html('');$('#item_pot_value_bot').html('0 Credits');}else if(search){$('#withdraw_result').html('<div class="loader_small"></div>');}else{$('#withdraw_result').append('<div class="withdraw_clear" style="clear: both;"></div><div class="loader_small"></div>');}
  350. if(!inventory_bot_loading){inventory_bot_loading=true;$.ajax({type:"GET",url:"/withdraw_load.php?order="+order+"&name="+name+"&min="+min+"&max="+max+"&page="+botInventoryPage,success:function(text){inventory_bot_loading=false;if(!more&&!search){$('#withdraw_result').html(text);}else{$('#withdraw_result .loader_small, #withdraw_result .withdraw_clear').remove();$('#withdraw_result').append(text);$("#withdraw_choose .inventory_item").each(function(){var itemID=$(this).attr('id');$("#withdraw_result #"+itemID).remove();});}}});}}
  351. function refreshBotInventory(bot_id,bot_type,amount){$.ajax({type:"GET",url:"/admin_save.php",data:{refresh_bot_inventory:true,bot_id:bot_id,bot_type:bot_type,amount:amount},success:function(text){if(text!='finished'){$("#admin_bots_loader").before(text);refreshBotInventory(bot_id,bot_type,amount+1);}else{$("#admin_bots_loader").hide();}}});}
  352. inventory_loading=false;function loadInventory(){$('#inventory_result').html('');$("#inventory_load").show();if(!inventory_loading){inventory_loading=true;$.ajax({type:"GET",url:"/deposit_load.php?load",success:function(text){inventory_loading=false;$('#inventory_result').html(text);$("#inventory_load").hide();$('#inventory_result').find('.inventory_item').sort(function(a,b){return $(b).attr('data-sort')- $(a).attr('data-sort');}).prependTo('#inventory_result');}});}}
  353. inventory_refresh=false;function refreshInventory(attempt){if(!inventory_refresh&&!inventory_loading){inventory_refresh=true;$('#inventory_attempt').html(phraser('ATTEMPT')+' #'+(attempt+1));$('#inventory_attempt').show();$("#inventory_load").show();$('#inventory_result').html('');$('#pot_result').html('');$("#item_pot_value_user").text("0 Credits");$("#pot_empty").show();$("#pot_result").hide();$.ajax({type:"GET",url:"/deposit_load.php?refresh",success:function(text){if(text=='success'){$('#inventory_attempt').hide();inventory_refresh=false;loadInventory();}else{if(attempt>=49){inventory_refresh=false;$('#inventory_attempt').hide();$("#inventory_load").hide();$('#inventory_result').html('<div id="inventory_empty" style="display: block;padding-top: 35px;">'+phraser('COULDNT_GET_INVENTORY')+'</div>');}else{inventory_refresh=false;refreshInventory(attempt+1);}}}});}}
  354. function tradeOfferStatus(type,attempt){attempt=attempt||0;$.ajax({type:"GET",url:"/"+type+"_response.php",data:{trade_offer_id:$("#waiting_deposit_id").attr('data-id')},success:function(text){var response=text.split(";");if(response[0]=='success'){$("#waiting_deposit_id").hide();$("#accept_link_browser").prop('href','https://steamcommunity.com/tradeoffer/'+response[1]+'/');$("#accept_link_steam").prop('href','steam://url/ShowTradeOffer/'+response[1]+'/');$(".accept_link").show();}else if(response[0]=='error'||attempt>=60*5){if(response[1]=='not_found'||response[1]=='inventory'){swal({title:phraser('ERROR'),html:phraser('COULDNT_FIND_ALL_ITEMS_'+type.toUpperCase()),type:'error',confirmButtonText:phraser('OKAY')});}else if(response[1]=='inventory'){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER_INVENTORY'),type:'error',confirmButtonText:phraser('OKAY')});}else if(response[1]=='trade_url'){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER_URL'),type:'error',confirmButtonText:phraser('OKAY')});}else if(response[1]=='escrow'){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER_ESCROW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(response[1]=='no_slots'){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER_SLOTS'),type:'error',confirmButtonText:phraser('OKAY')});}else if(response[1]=='steam_error'||attempt>=60*5){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER'),type:'error',confirmButtonText:phraser('OKAY')});}
  355. loadPage(type+'.php');}else{timeouts.push(setTimeout(function(){tradeOfferStatus(type,attempt+1);},1500));}},error:function(){timeouts.push(setTimeout(function(){tradeOfferStatus(type,attempt+1);},1000));}});}
  356. $(function(){$(window).bind('popstate',function(e){var newPage=document.location.pathname.replace("/","");if(newPage.length>1){loadPage(newPage+'.php');}});$("#chat_cell").animate({scrollTop:$('#chat_cell')[0].scrollHeight},500);$('.tool').tipsy();$('.tool-top').tipsy({html:true,gravity:'s'});$('.tool-left').tipsy({html:true,gravity:'e'});$('body').on('keyup','#send_steam_credits, #crash_bet, #crash_cashout, #deposit_value, .roulette_form_value, #headsup_value, #blender_value, #taxi_value, #slot_bet_credits, .betting_value, #send_credits_amount',function(e){if(this.value.charAt(0)=="."||this.value.charAt(0)==","){this.value="0"+this.value;}
  357. this.value=this.value.replace(",",".");if($.isNumeric(this.value)===false){this.value=this.value.slice(0,-1);}});$('body').on('click','#sign_in_steam',function(){$(this).css('opacity','0.5');window.location=site+"/login_request.php?steam";});$('body').on('click','.sign_in_new',function(){loadPage("login.php");});$('body').on('click','.sign_up_new',function(){loadPage("register.php");});$('body').on('mousedown','.menu_item',function(e){if(freeToLoad){if(e.which==2){window.open(site+'/'+$(this).attr('data-page').replace(".php",""),'_blank');self.blur();}else if(e.which==1){loadPage($(this).attr('data-page'));freeToLoad=false;}}});$('body').on('click','.chat_username_respond',function(){var uName=$(this).text();if($('#chat_message_textarea').val().length+ uName.length<=200){$('#chat_message_textarea').val(function(i,text){return text+" ["+ uName.replace(/\]/g,"").replace(/\[/g,"")+"] ";});$('#chat_message_textarea').focus();}});$('#chat_message_textarea').keypress(function(e){var keycode=(e.keyCode?e.keyCode:e.which);if(keycode==13&&!e.shiftKey){e.preventDefault();postChatMessage(e);}});$("#chat_message_send").click(function(e){e.preventDefault();postChatMessage(e);});$(".chat_form").submit(function(e){e.preventDefault();});$('body').on('click','.chat_icons',function(){var target=$(this).attr('data-target');$(".chat_icon_preview img").attr('data-target',target);swal({title:phraser('CHAT_ICONS'),html:$("#chat_icons_html").html(),confirmButtonText:phraser('OKAY')});});$('body').on('click','.chat_icon_preview img',function(){var dataShort=$(this).attr('data-keyword');var target=$(this).attr('data-target');$('#'+target+'_message_textarea').val(function(i,text){return text+" "+ dataShort;});});$('body').on('click','.chat_ban',function(){var steamID=$(this).attr('sID');var steamName=$(this).attr('data-title');if(typeof steamName=='undefined'){steamName=$(this).attr('data-name');}
  358. swal({title:"Ban User",html:'<div id="ban_holder">'+$("#user_ban_form").html().replace("steamName",steamName)+'</div>',type:"warning",confirmButtonText:"SAVE",showCancelButton:true,closeOnConfirm:false,allowOutsideClick:false,animation:"slide-from-top"},function(){swal.disableButtons();$.ajax({type:"POST",url:"/admin_save.php",data:{ban_type:$("#ban_holder #user_ban_type").val(),ban_length:$("#ban_holder #user_ban_length").val(),steam_id:steamID},success:function(text){if(text=="success"){swal({title:phraser("SUCCESS"),html:"Your ban was successfully saved.",type:'success',confirmButtonText:phraser('OKAY')});}else{swal({title:phraser('ERROR'),html:"Your ban could not be saved",type:'error',confirmButtonText:phraser('OKAY')});}}});});});$('body').on('click','.volume',function(){var volumeOn;if($(this).hasClass('on')){$(this).removeClass('on').addClass('off').html('<i class="fa fa-volume-off"></i>');volumeOn='off';$(".audio_file").each(function(){$(this).prop("volume",0);});}else{$(this).removeClass('off').addClass('on').html('<i class="fa fa-volume-up"></i>');volumeOn='on';$(".audio_file").each(function(){var volume=$(this).attr("data-volume");$(this).prop("volume",volume);});}
  359. $.ajax({type:"GET",url:"/save_volume.php",data:{volume:volumeOn}});});$('#steam_status_holder').click(function(){if($(this).width()>100){loadSteamStatus();}});$('body').on('click','#inventory_result .inventory_item',function(e){if($(this).hasClass('inventory_item_untradable')){swal({title:phraser('ERROR'),html:phraser('ITEM_IS_NOT_TRADABLE'),type:'error',confirmButtonText:phraser('OKAY')});return;}
  360. if($("#pot_result .inventory_item").length>=50){swal({title:phraser('ERROR'),html:phraser('MAXIMUM_ITEMS_PER_TRADE'),type:'error',confirmButtonText:phraser('OKAY')});return;}
  361. var old_pot=$(".item_pot_value").text().replace(" Credits","");var new_val=$(this).find(".round_item_price span").text();var new_pot=parseFloat(old_pot)+parseFloat(new_val);$(".item_pot_value").text(new_pot.toFixed(2)+" Credits");if(new_pot>=1){$(".pot_deposit").removeClass("pot_deposit_disabled");}
  362. $("#pot_empty").hide();$("#pot_result").show();$(this).appendTo("#pot_result");});$('body').on('click','#pot_result .inventory_item',function(e){var old_pot=$(".item_pot_value").text().replace(" Credits","");var new_val=$(this).find(".round_item_price span").text();var new_pot=parseFloat(old_pot)-parseFloat(new_val);$(".item_pot_value").text(new_pot.toFixed(2)+" Credits");if($("#pot_result .inventory_item").length==1){$("#pot_empty").show();$("#pot_result").hide();}
  363. if(new_pot<1){$(".pot_deposit").addClass("pot_deposit_disabled");}
  364. $(this).appendTo("#inventory_result");$('#inventory_result').find('.inventory_item').sort(function(a,b){return $(b).attr('data-sort')- $(a).attr('data-sort');}).prependTo('#inventory_result');});$('body').on('click','.inventory_refresh',function(){refreshInventory(0);});$('body').on('click','#deposit_deposit',function(){var numberOfItems=0;var arr=[];$('#pot_result').children('.inventory_item').each(function(){var itemID=$(this).attr('id').replace("ih","");if(!arr.indexOf(itemID)!=-1){arr.push(itemID);$("#items").val($("#items").val()+itemID+';');numberOfItems+=1;}});if(numberOfItems>0&&numberOfItems<=50&&parseFloat($(".item_pot_value").html().replace(" Credits",""))>=1){$(".accept_link").hide();$("#user_inventory_holder").slideUp();$("#user_deposit").slideDown();$("#waiting_pot_value").text($(".item_pot_value").text());$.ajax({type:"GET",url:"/deposit_save.php",data:{items:$("#items").val()},success:function(text){if(text=='error amount'||text=='error access'||text=='error item'||text=='error value'||text=='error bot'){setTimeout(function(){$(".accept_link").hide();$("#user_inventory_holder").slideDown();$("#user_deposit").slideUp();swal({title:phraser('ERROR'),text:text.replace(" ","_").toUpperCase(),type:'error',confirmButtonText:phraser('OKAY')});},500);}else{var response=text.split(";");$("#waiting_pot_value").text($(".item_pot_value").text());$("#waiting_code").text(response[0]);$("#waiting_deposit_id").attr('data-id',response[1]);$("#waiting_bot").text(response[2]);timeouts.push(setTimeout(function(){tradeOfferStatus('deposit');},1000));}}});}else{swal({title:phraser('ERROR'),html:phraser('MAXIMUM_ITEMS_PER_TRADE'),type:'error',confirmButtonText:phraser('OKAY')});}});var stopScrollTick=false;$('body').on('mousedown touchstart','.scroller',function(e){e.stopPropagation();stopScrollTick=false;var sender=$(this);var target=$(sender.attr('data-target'));var child=sender.attr('data-child');var pos=target.scrollLeft();var scrollSpeed=2;var scrollTime=0;var scrollTick=setInterval(function(){var max=target.find(child).length*target.find(child).outerWidth()- $("#page_content").width();if(!sender.hasClass('left')){pos=pos+ 10+ scrollSpeed;}else{pos=pos- 10- scrollSpeed;}
  365. if(pos>max&&max<0){pos=0;}else if(pos>max){pos=max}
  366. target.scrollLeft(pos);if(scrollTime%50==0){scrollSpeed=Math.pow(scrollSpeed,2);}
  367. scrollTime++;if(stopScrollTick||pos==max){clearInterval(scrollTick);}},10);}).on('mouseup touchend','.scroller',function(){stopScrollTick=true;}).on('mouseleave touchmove','.scroller',function(){stopScrollTick=true;});$('body').on('click','.accept_link',function(){var page=$(this).attr('data-page');loadPage(page);});$('body').on('click','#user_stats_menu li a',function(){var clickedThis=$(this);$("#user_stats_menu li").each(function(){$(this).removeClass('active');});clickedThis.parent('li').addClass('active');loadUserStats($(this).attr('data-stats'));});$('body').on('click','#players_menu li a',function(){$("#players_menu li").each(function(){$(this).removeClass('active');});$(this).parent('li').addClass('active');loadTopList($(this).attr('data-stats'),$("#top_select").val());});$('body').on('change','#top_select',function(){loadTopList($("#players_menu li.active a").attr('data-stats'),$("#top_select").val());});$('body').on('click','#recruits_menu li a',function(){var clickedThis=$(this);$("#recruits_menu li").each(function(){$(this).removeClass('active');});clickedThis.parent('li').addClass('active');loadRecruits($(this).attr('data-stats'));});$('body').on('submit','#settings_form',function(e){e.preventDefault();$("#settings_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');if(!validateTradeURL($("#trade_url").val())&&$("#trade_url").val()!=""){swal({title:phraser('ERROR'),html:phraser('PLEASE_ENTER_A_VALID_TRADE_URL'),type:'error',confirmButtonText:phraser('OKAY')});$("#settings_form button").prop('disabled',false).html(phraser('SAVE'));return;}
  368. $.ajax({type:"GET",url:"/settings_save.php",data:{trade_url:$("#trade_url").val(),stream_link:$("#stream_link").val(),status_message:$("#status_message").val(),hide_steam:$("#hide_steam").prop('checked'),timezone:$("#timezone").val(),language:$("#language").val()},success:function(text){$("#settings_form button").prop('disabled',false).html(phraser('SAVE'));if(text=='errorTradeURL'){swal({title:phraser('ERROR'),html:'bruh... stahp! you aint the first one to try this bruh',type:'error',confirmButtonText:phraser('OKAY')});return;}else if(text=='errorTimeZone'){swal({title:phraser('ERROR'),html:'bruh... stahp! you aint the first one to try this bruh',type:'error',confirmButtonText:phraser('OKAY')});return;}
  369. swal({title:phraser('SUCCESS'),html:phraser('SETTINGS_SUCCESSFULLY_SAVED'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){window.location.reload();});}});});$('body').on('click','.jackpot_deposit_button',function(){$("#deposit_value").val('');$(".jackpot_deposit_button").fadeOut(250);$(".jackpot_deposit_value").fadeIn(250);$("#deposit_value").focus();});$('body').on('mousedown','#deposit_value_submit',function(e){e.preventDefault();$('.jackpot_deposit_value').submit();});$('body').on('submit','.jackpot_deposit_value',function(e){e.preventDefault();$("#jackpot_form").hide();$("#jackpot_loader").show();var deposit_value=$("#deposit_value").val();$.ajax({type:"POST",url:"/jackpot_bet.php",data:{deposit_value:deposit_value,user_token:$("#user_token").val()},success:function(text){$("#jackpot_form").show();$("#jackpot_loader").hide();if(text=='success'){$("#deposit_value").val('');$(".jackpot_deposit_value").hide();$(".jackpot_deposit_button").show();updateCredits(-1*deposit_value);}else if(text=='errorValue'){needCredits();}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('TOO_MANY_BETS'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorTimer'){swal({title:phraser('ERROR'),html:phraser('TIMER_IS_CLOSING'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLastRound'){swal({title:phraser('ERROR'),html:phraser('LAST_ROUND_NOT_FINISHED'),type:'error',confirmButtonText:phraser('OKAY')});}}});});var blenderColorAvailable=true;$('body').on('click','.blender_ingredient',function(e){var flaskHeight=$("#flask_fill").height();var fruit=$(this).attr('data-fruit');var fruitColor=$(this).attr('data-color');var fruitColors=$(this).attr('data-color').split(",");var blenderColors=$("#blender_potion_content").html().split(";").length;if(blenderAvailable){$("#blender_form").show();}
  370. if(flaskHeight<400&&blenderColorAvailable){blenderColorAvailable=false;$(".woosh").trigger('play');setTimeout(function(){$(".woosh").trigger('pause');$(".woosh").prop("currentTime",0);},300);var imageOffset=$(this).find('img').offset();var potionOffset=$("#flask_fill").offset();var newFruit=$(this).find('img').clone();newFruit.appendTo("body").css({'height':'80px','position':'absolute','top':imageOffset.top+'px','left':imageOffset.left+'px','z-index':'20'}).addClass('fruit_rotate').animate({top:potionOffset.top-40,left:potionOffset.left+90,height:'40px'},400).fadeOut(200,function(){$(this).remove();});setTimeout(function(){$(".fill").trigger('play');setTimeout(function(){$(".fill").trigger('pause');$(".fill").prop("currentTime",0);},300);if(flaskHeight==0){$('#flask_wave').css('fill','rgb('+fruitColor+')');}else{var potionColor=$('#flask_wave').css('fill').replace("rgb(","").replace(/\ /g,"").replace(")","").split(",");var newColorR=(potionColor[0]*fruitColors[0])/255 +30;
  371. var newColorG=(potionColor[1]*fruitColors[1])/255 +30;
  372. var newColorB=(potionColor[2]*fruitColors[2])/255 +30;
  373. $('#flask_wave').css('fill','rgb('+Math.round(newColorR)+','+Math.round(newColorG)+','+Math.round(newColorB)+')');}
  374. $('#flask_fill').animate({height:(blenderColors*40)+'px'},300,'easeOutBack');$("#blender_potion_content").append(fruit+';');},200);setTimeout(function(){blenderColorAvailable=true;},300);}else if(blenderColorAvailable){swal({title:phraser('FULL_BOTTLE'),html:phraser('FULL_BOTTLE_TEXT'),type:'warning',confirmButtonText:phraser('OKAY')});}});var blenderAvailable=true;$('body').on('submit','#blender_form',function(e){e.preventDefault();var bet_value=$("#blender_value").val();if(blenderAvailable){blenderColorAvailable=false;blenderAvailable=false;$("#blender_submit").hide();$.ajax({type:"POST",url:"/blender_blend.php",data:{credits:bet_value,color_order:$("#blender_potion_content").html(),user_token:$("#user_token").val()},success:function(text){if(text=='errorCredits'){needCredits();blenderAvailable=true;blenderColorAvailable=true;$("#blender_submit").show();}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});blenderAvailable=true;blenderColorAvailable=true;$("#blender_submit").show();}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});blenderAvailable=true;blenderColorAvailable=true;$("#blender_submit").show();}else{$("#blender_form").hide();updateCredits(-1*bet_value);$(".shake").trigger('play');setTimeout(function(){$(".shake").trigger('pause');$(".shake").prop("currentTime",0);},1500);$("#blender_holder").effect("shake",{direction:"up",times:6,distance:15},1300);setTimeout(function(){$("#blender_holder").animate({borderSpacing:-360},{step:function(now,fx){$("#blender_holder").css({'-webkit-transform':'rotate('+ now+'deg)','-moz-transform':'rotate('+ now+'deg)','-ms-transform':'rotate('+ now+'deg)','transform':'rotate('+ now+'deg)'});},duration:'slow'},1000);},1000);setTimeout(function(){if(text=='won'){updateCredits(bet_value*1.95);$.growl.notice({title:'Blender',message:phraser('POTION_APPROVED')+"<b>"+parseFloat(bet_value*1.95).toFixed(2)+"</b> Credits."});}else{$.growl.error({title:'Blender',message:phraser('BAD_POTION')});}
  375. $("#blender_form").hide();$("#blender_submit").show();$("#blender_potion_content").html('');$("#flask_fill").height('0px');$('#flask_wave').css('fill','rgb(255,255,255)');blenderAvailable=true;blenderColorAvailable=true;},2000);}}});}});$('body').on('click','.headsup_new',function(e){$("#headsup_create").toggle(250);$("#headsup_challenge").hide(250);$("#headsup_create").find(".headsup_form_choices a").removeClass('chosen');$("#headsup_value").val('');$("#headsup_value").focus();});$('body').on('click','.headsup_form_choices a',function(e){$(this).parent().parent().find(".headsup_form_choices a").removeClass('chosen');$(this).addClass('chosen');$("#headsup_value").focus();});var headsupAvailable=true;$('body').on('submit','#headsup_form',function(e){e.preventDefault();var choice=$("#headsup_form").find("a.chosen").attr('data-choice');var credits=$("#headsup_value").val();if(headsupAvailable){headsupAvailable=false;$("#headsup_form").hide();$("#headsup_create_loader").show();if(choice==undefined){swal({title:phraser('ERROR'),html:phraser('NEED_TO_CHOOSE_OPTION'),type:'error',confirmButtonText:phraser('OKAY')});headsupAvailable=true;$("#headsup_form").show();$("#headsup_create_loader").hide();}else{if(credits>=0.001){$.ajax({type:"GET",url:"/headsup_bet.php",data:{choice:choice,credits:credits,create:true,user_token:$("#user_token").val()},success:function(text){text=text.split(";");if(text[0]=='success'){$(".woosh").trigger('pause').prop("currentTime",0).trigger('play');$("#headsup_create").toggle(250);updateCredits(-1*text[1]);}else if(text[0]=='errorCredits'){needCredits();}else if(text[0]=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}
  376. headsupAvailable=true;$("#headsup_form").show();$("#headsup_create_loader").hide();}});}else{swal({title:phraser('ERROR'),html:phraser('MINIMUM_BET_SMALL'),type:'error',confirmButtonText:phraser('ERROR')});headsupAvailable=true;$("#headsup_form").show();$("#headsup_create_loader").hide();}}}});$('body').on('click','.headsup_thumb',function(e){var newID=$(this).attr('id').replace("h","");var newVal=$(this).attr('data-sort');$("#headsup_challenge").find(".headsup_form_choices a").removeClass('chosen');$("#headsup_challenge").find('#headsup_challenge_value').html(newVal+" Credits");$("#headsup_challenge").attr('data-id',newID).show(250);$("#headsup_create").hide(250);});var headsupChallengeAvailable=true;$('body').on('click','#headsup_challenge_button',function(e){e.preventDefault();var choice=$("#headsup_challenge").find("a.chosen").attr('data-choice');var gameID=$("#headsup_challenge").attr('data-id');var credits=$("#headsup_challenge").find('#headsup_challenge_value').html().replace(" Credits","");var choiceText='';if(choice==1){choiceText=phraser('ROCK');}else if(choice==2){choiceText=phraser('PAPER');}else if(choice==3){choiceText=phraser('SCISSOR');}
  377. if(headsupChallengeAvailable){$("#headsup_challenge_loader").show();$("#headsup_challenge_button").hide();headsupChallengeAvailable=false;if(choice==undefined){swal({title:phraser('ERROR'),html:phraser('NEED_TO_CHOOSE_OPTION'),type:'error',confirmButtonText:phraser('OKAY')});headsupChallengeAvailable=true;$("#headsup_challenge_loader").hide();$("#headsup_challenge_button").show();}else{$.ajax({type:"GET",url:"/headsup_bet.php",data:{choice:choice,headsup_id:gameID,challenge:true,user_token:$("#user_token").val()},success:function(text){text=text.split(";");if(text[0]=='success'){$(".woosh").trigger('pause').prop("currentTime",0).trigger('play');updateCredits(-1*credits);var oppText='';if(text[2]==1){oppText=phraser('ROCK');}else if(text[2]==2){oppText=phraser('PAPER');}else if(text[2]==3){oppText=phraser('SCISSOR');}
  378. if(text[1]=='0'){$.growl.warning({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('DRAW')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});updateCredits(0.95*credits);}else if(text[1]=='1'){$.growl.notice({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('WIN')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});updateCredits(1.95*credits);}else if(text[1]=='2'){$.growl.error({title:'Heads Up',message:phraser('THE_GAME_OF')+" <b>"+parseFloat(credits).toFixed(2)+"</b> Credits"+phraser('ENDED_AS')+"<b>"+phraser('LOSS')+"</b>. "+phraser('YOU_CHOSE')+choiceText+phraser('OPPONENT_CHOSE')+oppText+"."});}}else if(text[0]=='errorCredits'){needCredits();}else if(text[0]=='errorUser'){swal({title:phraser('ERROR'),html:phraser('CANNOT_PLAY_YOURSELF'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text[0]=='errorGameID'){swal({title:phraser('ERROR'),html:phraser('GAME_SNATCHED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text[0]=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}
  379. $("#headsup_challenge_loader").hide();$("#headsup_challenge_button").show();headsupChallengeAvailable=true;$("#headsup_challenge").hide(250);}});}}});$('body').on('click','#support_menu li a',function(){var clickedThis=$(this);$("#support_menu li").each(function(){$(this).removeClass('active');});clickedThis.parent('li').addClass('active');loadSupport($(this).attr('data-page'));});$('body').on('click','.support_open_ticket',function(){loadSupport('user_ticket',$(this).attr('data-id'));});$('body').on('click','.support_mark',function(){var mark=$(this).attr('data-type');var ticketID=$(".support_replies").attr('data-id');if(mark=='solved'){mark=1;$(this).attr('data-type','unsolved').html('<i class="fa fa-thumbs-down"></i> '+phraser('MARK_AS_UNSOLVED'));}else{mark=0;$(this).attr('data-type','solved').html('<i class="fa fa-thumbs-up"></i> '+phraser('MARK_AS_SOLVED'));}
  380. $.ajax({type:"GET",url:"/support_save.php",data:{mark:mark,ticket_id:ticketID},success:function(text){loadSupport('user_ticket',ticketID);}});});$('body').on('submit','.support_write',function(e){e.preventDefault();if($("#support_answer").val().length>5){var reply=$("#support_answer").val();var ticketID=$(".support_replies").attr('data-id');$("#support_answer").val('');$.ajax({type:"POST",url:"/support_save.php",data:{reply:reply,ticket_id:ticketID},success:function(text){if($("#admin_loader").length==0){loadSupport('user_ticket',ticketID);}else{$("#admin_response").hide();$("#admin_loader").show();$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'tickets',ticket_id:ticketID},success:function(text){$("#admin_loader").hide();$("#admin_response").html(text).show();}});}}});}else{swal({title:phraser('ERROR'),html:phraser('TEXT_TOO_SHORT'),type:'error',confirmButtonText:phraser('OKAY')});}});$('body').on('submit','#support_new',function(e){e.preventDefault();if($("#support_new_textarea").val().length>5){var text=$("#support_new_textarea").val();var subject=$("#support_new_subject").val();$("#support_new_textarea").val('');$("#support_new").hide();$("#support_new_loader").show();$.ajax({type:"POST",url:"/support_save.php",data:{text:text,subject:subject},success:function(text){$("#support_menu li").each(function(){$(this).removeClass('active');});$("#support_menu li").first().addClass('active');loadSupport('user_tickets');}});}else{swal({title:phraser('ERROR'),html:phraser('TEXT_TOO_SHORT'),type:'error',confirmButtonText:phraser('OKAY')});}});$('body').on('click','.taxi_level',function(){$(".taxi_level").removeClass('selected');$(this).addClass('selected');$("#taxi_chance b").html($(this).attr('data-chance')+"%");$("#taxi_multiplier b").html("~"+$(this).attr('data-multiplier')+"x");});$('body').on('submit','#taxi_create',function(e){e.preventDefault();$("#taxi_create button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');var credits=parseFloat($("#taxi_value").val());var level=$(".taxi_level.selected").attr('data-level');$.ajax({type:"GET",url:"/taxi_bet.php",data:{value:credits,create:true,level:level,user_token:$("#user_token").val()},success:function(text)
  381. {$("#taxi_create button").prop('disabled',false).html(phraser('CREATE'));if(text=='errorCredits'){needCredits();}else if(text=='errorAmount'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{$(".taxi-start").trigger('play');setTimeout(function(){$(".taxi-start").trigger('pause');$(".taxi-start").prop("currentTime",0);},4000);updateCredits(-1*credits);$(".taximeter_big span").html('0');$(".taximeter_big b").html(credits);$("#taxi_hash").html('<b>'+phraser('HASH')+':</b> '+text);$("#taxi_fuel, #taxi_fuel_bg").toggle(250);}}});});var taxiChoiceAvailable=true;$('body').on('click','.route-enabled',function(e)
  382. {var that=$(this);var choice=that.attr('data-choice');if(!taxiChoiceAvailable)
  383. {return;}
  384. taxiChoiceAvailable=false;$('.route-enabled').each(function()
  385. {$(this).removeClass('route-enabled').addClass('route-disabled');});var newTaxi=$("<div>",{class:"taxi_car"});newTaxi.html('<img src="'+site+'/images/taxi.png">').appendTo("body").css({'top':that.offset().top-10+'px',}).animate({left:that.offset().left+25},400,'easeOutQuad').fadeOut(700,function()
  386. {$(this).remove();});$.ajax({type:"GET",url:"/taxi_bet.php",data:{choice:choice,bet:true,user_token:$("#user_token").val()},success:function(text)
  387. {taxiChoiceAvailable=true;text=text.split(";");var value=parseFloat(text[0]);var row=text[1];var options=text[2].split(",");var robbed=text[3];$(".route[data-row='"+row+"']").each(function()
  388. {var content=options[$(this).attr("data-choice")-1];if(content=="R")
  389. {content='<img src="'+site+'/images/customer6.png" style="opacity: 1;">';}
  390. $(this).html(content);});if(robbed==1)
  391. {$(".taxi-crash").trigger('play');setTimeout(function()
  392. {$(".taxi-crash").trigger('pause');$(".taxi-crash").prop("currentTime",0);},2000);$.growl.error({title:'Taxi',message:phraser('PICKED_UP_CRIMINAL')});timeouts.push(setTimeout(function()
  393. {$(".route[data-row='1']").removeClass('route-disabled').addClass('route-enabled');$(".route").each(function()
  394. {$(this).css('color','').html('<img src="'+site+'/images/customer'+(Math.floor(Math.random()*5)+ 1)+'.png">');});$(".taximeter_big span, .taximeter_big b").html('0');$("#taxi_fuel, #taxi_fuel_bg").toggle(250);},3000));}
  395. else
  396. {$(".taxi-horn").trigger('play');setTimeout(function()
  397. {$(".taxi-horn").trigger('pause');$(".taxi-horn").prop("currentTime",0);},500);$({someValue:parseFloat($(".taximeter_big span").html())}).animate({someValue:value},{duration:400,easing:'swing',step:function(){$('.taximeter_big span').text(this.someValue.toFixed(1));},complete:function(){$('.taximeter_big span').text(value.toFixed(2));}});setTimeout(function(){$(".taximeter_big span").html(value)},450);that.css('color','gold');if(row<5)
  398. {$(".route[data-row='"+(parseInt(row)+1)+"']").each(function()
  399. {$(this).removeClass('route-disabled').addClass('route-enabled');});}
  400. else
  401. {updateCredits(value);$.growl.notice({title:'Taxi',message:phraser('SUCCESSFULLY_DROVE')+" <b>"+value.toFixed(2)+"</b> Credits"});timeouts.push(setTimeout(function()
  402. {$(".route[data-row='1']").removeClass('route-disabled').addClass('route-enabled');$(".route").each(function()
  403. {$(this).css('color','').html('<img src="'+site+'/images/customer'+(Math.floor(Math.random()*5)+ 1)+'.png">');});$(".taximeter_big span, .taximeter_big b").html('0');$("#taxi_fuel, #taxi_fuel_bg").toggle(250);},3000));}}}});});$('body').on('click','#admin_menu li a, #admin_menu a',function(){var clickedThis=$(this);$("#admin_menu li").each(function(){$(this).removeClass('active');});clickedThis.parent('li').addClass('active');loadAdmin($(this).attr('data-page'));});$('body').on('submit','#admin_notice_form',function(e){e.preventDefault();$(this).find("input[type=submit]").hide();$.ajax({type:"GET",url:"/admin_save.php",data:{message:$(this).find("textarea").val(),enabled:$(this).find("input[type=checkbox]").prop('checked'),admin_notice:true},success:function(text){loadAdmin("notice");}});});$('body').on('submit','#admin_earnings_form',function(e){e.preventDefault();$("#earnings_result").html('<div class="loader_small"></div>');var in_out=0;if($("#earnings_in_out").is(':checked')){in_out=1;}
  404. $.ajax({type:"GET",url:"/admin_save.php",data:{earnings:true,start_date:$("#start_date").val(),end_date:$("#end_date").val(),in_out:in_out},success:function(text){$("#earnings_result").html(text);}});});$('body').on('click','#remove_ban',function(e){var that=$(this);$.ajax({type:"GET",url:"/admin_save.php",data:{remove_ban:that.attr('data-id'),ban_type:that.attr('data-type')},success:function(){that.replaceWith("Removed");}});});$('body').on('click','.mute_user',function(e){var mThis=$(this);swal({title:phraser('ARE_YOU_SURE'),text:phraser('RECOVER_IN_SETTINGS'),type:'warning',showCancelButton:true,confirmButtonText:phraser('YES'),cancelButtonText:phraser('CANCEL')},function(){$.ajax({type:"GET",url:"/chat_mute.php",data:{muted_user_id:mThis.attr('data-id'),add:true},success:function(text){$(".tipsy").remove();$('.chat_message[data-user="'+mThis.attr('data-id')+'"]').remove();$("#chat_mutes").html(text);}});});});$('body').on('click','.unmute_user',function(e){var mThis=$(this);$.ajax({type:"GET",url:"/chat_mute.php",data:{muted_user_id:mThis.attr('data-id'),remove:true},success:function(text){mThis.parent().parent().remove();$("#chat_mutes").html(text);}});});$('body').on('click','.admin_open_ticket',function(e){$("#admin_response").hide();$("#admin_loader").show();$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'tickets',ticket_id:$(this).attr('data-id')},success:function(text){$("#admin_loader").hide();$("#admin_response").html(text).show();}});});$('body').on('click','.easy-autocomplete-container ul li',function(e){var user_id=$(this).find("img").attr('data-id');adminLoadUser(user_id);});$('body').on('click','.admin_item_edit',function(e){var item_id=$(this).attr('data-id');$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'prices',item_id:item_id},success:function(text){$("#admin_response").html(text);}});});$('body').on('submit','#admin_item_save',function(e){e.preventDefault();var weapon_id=$(this).attr('data-id');var steam_price=$("#admin_steam_price").prop('value');var manual=$("#admin_steam_manual").prop('value');$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{weapon_id:weapon_id,steam_price:steam_price,manual:manual},success:function(text){loadAdmin('prices');}});});$('body').on('click','#admin_give_submit',function(e){var user_id=$(this).attr('data-id');var give_credits=$("#admin_give_credits").prop('value');$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{user_id:user_id,give_credits:give_credits},success:function(text){adminLoadUser(user_id);}});});$('body').on('click','#admin_give_played_submit',function(e){var user_id=$(this).attr('data-id');var give_credits_played=$("#admin_give_credits_played").prop('value');$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{user_id:user_id,give_credits_played:give_credits_played},success:function(text){adminLoadUser(user_id);}});});$('body').on('click','#admin_ban_ip',function(e){var user_ip=$(this).attr('data-ip');$.ajax({type:"GET",url:"/admin_save.php",data:{ban_ip:true,user_ip:user_ip},success:function(text){swal({title:'Success',text:'IP was successfully banned.',type:'success',confirmButtonText:"Okay"});}});});$('body').on('submit','#admin_keyword_save',function(e){e.preventDefault();var keyword=$("#admin_keyword").prop('value');$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{keyword:keyword},success:function(text){loadAdmin('keywords');}});});$('body').on('submit','#withdraw_form',function(e){e.preventDefault();botInventoryPage=1;loadBotInventory(false,true);});$('body').on('contextmenu','#withdraw_result .inventory_item',function(e){if(parseInt(userID)>2)
  405. {return;}
  406. if($(this).find('.withdraw_giveaway_item').length==0)
  407. {e.preventDefault();}
  408. $(".withdraw_giveaway_item").remove();var item_id=$(this).attr('data-id');var item_price=$(this).find('.round_item_price span').text();$(this).prepend('<a class="withdraw_giveaway_item">GIVEAWAY</a>');});$('body').on('click','#withdraw_result .inventory_item',function(e){if($(this).find('.withdraw_giveaway_item').length)
  409. {return;}
  410. var old_pot=$(".item_pot_value").text().replace(" Credits","");var new_val=$(this).find(".round_item_price span").text();var new_pot=parseFloat(old_pot)+parseFloat(new_val);if($("#withdraw_choose .inventory_item").length>=10)
  411. {swal({title:phraser('ERROR'),html:phraser('MAXIMUM_ITEMS_PER_TRADE_WITHDRAW'),type:'error',confirmButtonText:phraser('OKAY')});return;}
  412. if(new_pot>parseFloat($("#credits").html()))
  413. {swal({title:phraser('ERROR'),html:phraser('WALLET_EXCEEDED'),type:'error',confirmButtonText:phraser('OKAY')});return;}
  414. $(".item_pot_value").text(new_pot.toFixed(2)+" Credits");if(new_pot>=1){$(".pot_deposit").removeClass("pot_deposit_disabled");}
  415. $("#withdraw_empty").hide();$("#withdraw_choose").show();$(this).appendTo("#withdraw_choose");});$('body').on('click','#withdraw_choose .inventory_item',function(){var old_pot=$(".item_pot_value").text().replace(" Credits","");var new_val=$(this).find(".round_item_price span").text();var new_pot=parseFloat(old_pot)-parseFloat(new_val);$(".item_pot_value").text(new_pot.toFixed(2)+" Credits");if($("#withdraw_choose .inventory_item").length==1){$("#withdraw_empty").show();$("#withdraw_choose").hide();$("#withdraw_bot_chosen").html('');$("#withdraw_result .inventory_item").each(function(){$(this).fadeTo(100,1);});}
  416. if(new_pot<1){$(".pot_deposit").addClass("pot_deposit_disabled");}
  417. $(this).insertBefore("#withdraw_result .withdraw_clear");});$('body').on('click','.item_inspect, .item_inspect_instant',function(e){e.stopPropagation();});$('body').on('click','.item_inspect_instant',function(){var url=$(this).attr('data-link');swal({title:phraser('INSTANT_INSPECT'),html:'<video width="100%" height="100%" controls autoplay loop><source src="'+url+'" type="video/mp4">Video not found</video>',confirmButtonText:phraser('OKAY')});});$('body').on('click','.item_search',function(e){e.stopPropagation();$("#withdraw_search").val($(this).attr('data-name'));$("#withdraw_min, #withdraw_max").val('');$("#withdraw_order").val('price_desc');$("#withdraw_form").submit();$(".tipsy").remove();});$('body').on('click','#withdraw_deposit',function(){var withdrawItems='';var withdrawPrices='';var numberOfItems=0;var arr=[];$('#withdraw_choose').children('.inventory_item').each(function()
  418. {var itemID=$(this).attr('data-id');if(!arr.indexOf(itemID)!=-1)
  419. {arr.push(itemID);withdrawItems=withdrawItems+ itemID+',';withdrawPrices=withdrawPrices+ $(this).attr('data-price')+',';numberOfItems+=1;}});if(numberOfItems>0&&numberOfItems<=50&&parseFloat($(".item_pot_value").html().replace(" Credits",""))>=1)
  420. {$(".accept_link").hide();$("#bot_inventory_holder").slideUp();$("#user_withdraw").slideDown();$("#waiting_pot_value").text($(".item_pot_value").text());$.ajax({type:"GET",url:"/withdraw_save.php",data:{items:withdrawItems,prices:withdrawPrices},success:function(text){if(text=='errorCredits'){needCredits();}else if(text=='errorLevel'){setTimeout(function(){swal({title:phraser('ERROR'),html:phraser('ERROR_LEVEL_TOO_LOW'),type:'error',confirmButtonText:phraser('OKAY')});},500);}else if(text=='errorValue'){setTimeout(function(){swal({title:phraser('ERROR'),html:phraser('MAXIMUM_ITEMS_PER_TRADE_WITHDRAW'),type:'error',confirmButtonText:phraser('OKAY')});},500);}else if(text=='errorCreditsPlayed'){setTimeout(function(){swal({title:phraser('ERROR'),html:phraser('PLAYED_FOR_EXCEEDED'),type:'error',confirmButtonText:phraser('OKAY')});},500);}else if(text=='errorToken'){setTimeout(function(){swal({title:phraser('ERROR'),html:phraser('COULDNT_SEND_OFFER_URL'),type:'error',confirmButtonText:phraser('OKAY')});},500);}else if(text.indexOf('success')!==-1){var response=text.split(";");$("#waiting_pot_value").text($(".item_pot_value").text());$("#waiting_code").text(response[1]);$("#waiting_deposit_id").attr('data-id',response[2]);$("#waiting_bot").text(response[3]);updateCredits(-1*parseFloat($(".item_pot_value").text()));timeouts.push(setTimeout(function(){tradeOfferStatus('withdraw');},1000));}else{swal({title:phraser('ERROR'),html:phraser('UNKNOWN_ERROR')+"<br><br>#"+text,type:'error',confirmButtonText:phraser('OKAY')});}
  421. if(text.indexOf('success')==-1){$("#bot_inventory_holder").slideDown();$("#user_withdraw").slideUp();}}});}else{swal({title:phraser('ERROR'),html:phraser('MAXIMUM_ITEMS_PER_TRADE'),type:'error',confirmButtonText:phraser('OKAY')});}});$('body').on('click','.bot_deposit_change, .bot_withdraw_change',function(){var changeBtn=$(this);var bot_id=changeBtn.attr('data-id');var type='withdraw';if(changeBtn.hasClass('bot_deposit_change')){type='deposit';}
  422. var newStyle="winnings";var newStatus="On";if(changeBtn.parent().find('span').hasClass('winnings')){newStyle="losses";newStatus="Off";}
  423. changeBtn.hide();$.ajax({type:"GET",url:"/admin_save.php",data:{bot:true,bot_id:bot_id,type:type},success:function(text){changeBtn.parent().find('span').removeClass().addClass(newStyle).text(newStatus);changeBtn.show();changeBtn.parent().parent().find(".bot_items span").hide();}});});$('body').on('click','.items_information_withdraw',function(){$("#withdraw_played").fadeOut(100);$("#withdraw_played_bg").fadeOut(100);$(".background_blaze").css('overflow-y','auto');if($("#first_time").length>0){swal({title:"Trade URL",html:$("#first_time").html(),confirmButtonText:phraser('OKAY')},function(){loadPage("settings.php");});}});$('body').on('submit','#recruit_code_form',function(e){e.preventDefault();var code=$("#recruit_code").val();$("#recruit_code_form").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/recruits_save.php",data:{code:code},success:function(text){if(text=='success'){updateCredits(0.05);loadPage("recruits.php");}else{loadPage("recruits.php");swal({title:phraser('ERROR'),html:phraser('RECRUIT_'+text.toUpperCase()),type:'error',confirmButtonText:phraser('OKAY')});}}});});$('body').on('click','.withdraw_view_more',function(){var type=$(this).attr('data-type');$(".withdraw_view_more").remove();$(".withdraw_clear").remove();if(type=='withdraw'){botInventoryPage=botInventoryPage+2;loadBotInventory(true,false);}
  424. if(type=='deals'){botDealsPage=botDealsPage+2;loadBotDeals(true,$(".withdraw_deal.selected").attr('data-min'),$(".withdraw_deal.selected").attr('data-max'));}});$('body').on('click','.refresh_bot_inventory',function(){$("#admin_bots_loader").show();refreshBotInventory($(this).attr('data-id'),$(this).attr('data-type'),0);});$('body').on('submit','#admin_chat_mode',function(e){e.preventDefault();var chat_mode=$("#chat_mode").val();$("#admin_chat_mode").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{chat_mode:chat_mode},success:function(text){loadAdmin("chat");}});});$('body').on('submit','#admin_codes',function(e){e.preventDefault();var bot_id=$("#code_bot_id").val();var code_type=$("#code_bot_type").val();$("#admin_codes").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{code_request:true,bot_id:bot_id,code_type:code_type},success:function(text){loadAdmin("codes");}});});$('body').on('click','.games_change',function(e){var game_id=$(this).attr('data-id');$.ajax({type:"GET",url:"/admin_save.php",data:{game_change:true,game_id:game_id},success:function(text){loadAdmin("games");}});});$('body').on('submit','#admin_user_form',function(e){e.preventDefault();if($.isNumeric($("#user_search").val())){var user_id=$("#user_search").val();$("#admin_user_response").html('<div class="loader_small"></div>');$(".easy-autocomplete-container ul").hide();adminLoadUser(user_id);}});$('body').on('click','.refresh_user',function(e){var user_id=$(this).attr('data-id');$.ajax({type:"GET",url:"/admin_save.php",data:{refresh_user:true,user_id:user_id},success:function(text){adminLoadUser(user_id);}});});$('body').on('click','.show_user',function(e){var user_id=$(this).attr('data-user-id');adminLoadUser(user_id);});$('body').on('submit','#search_round_form',function(e){e.preventDefault();var round_type=$(this).attr('data-type');var round_id=$("#search_round_text").val();$("#search_round_result").show();$("#search_round_result").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/"+round_type+"s_search.php",data:{round_id:round_id},success:function(text){$("#search_round_result").html(text);}});});$('body').on('submit','#search_offer_form',function(e){e.preventDefault();var offer_type=$("#search_round_select").val();var security_code=$("#search_round_text").val();$("#search_round_result").html('<div class="loader_small"></div>').show();$.ajax({type:"GET",url:"/admin_save.php",data:{security_code:security_code,offer_type:offer_type},success:function(text){$("#search_round_result").html(text);}});});$('body').on('submit','#blackjack_create_form',function(e){e.preventDefault();var credits=parseFloat($("#blackjack_bet_value").html());credits=Math.round(credits*100.0)/ 100.0;
  425. $("#blackjack_create_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');var chips='';$("#blackjack_chips_container div").each(function(){chips=chips+ $(this).attr('data-val')+";";});$.ajax({type:"POST",url:"/blackjack_bet.php",data:{create:true,credits:credits,chips:chips,user_token:$("#user_token").val()},success:function(text){$("#blackjack_create_form button").prop('disabled',false).html(phraser("CREATE"));if(text=='errorCredits'){needCredits();}else if(text=='errorMin'|| text=='errorMax'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*credits);$(".blackjack_hash").html("<b>"+phraser("HASH")+":</b> "+text);$(".blackjack_block").show();$("#blackjack_player").show();$("#blackjack_better").hide();$("#deal_shuffle").show();$("#blackjack_value_number_player").html('0');$("#blackjack_value_number_dealer").html('0');$(".blackjack_game_value").html(credits+' Credits').show();$("#blackjack_chips_container_ongoing").html($("#blackjack_chips_container").html());$(".stand").trigger('play');setTimeout(function(){$(".stand").trigger('pause');$(".stand").prop("currentTime",0);},900);}}});});$('body').on('click','.blackjack_deal',function(e){var button=$(this);button.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"GET",url:"/blackjack_bet.php",data:{deal:true,user_token:$("#user_token").val()},success:function(text){if(text=='errorCards'||text=='errorGameID'||text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{blackJackDeal(text);}
  426. button.prop('disabled',false).html(phraser('DEAL'));}});});$('body').on('click','.blackjack_shuffle',function(e){var button=$(this);button.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"GET",url:"/blackjack_bet.php",data:{shuffle:true,user_token:$("#user_token").val()},success:function(text){if(text=='errorAction'||text=='errorGameID'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{$(".blackjack_hash").html("<b>"+phraser("HASH")+":</b> "+text);$(".stand").trigger('play');setTimeout(function(){$(".stand").trigger('pause');$(".stand").prop("currentTime",0);},900);}
  427. button.prop('disabled',false).html(phraser('SHUFFLE'));}});});$('body').on('click','.blackjack_hit, .blackjack_double',function(e){if(!$(this).hasClass('disabled')){var button=$(this);button.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$(".blackjack_hit").addClass('disabled');$(".blackjack_double").addClass('disabled');var doubled=false;var buttonString=phraser('HIT');if($(this).hasClass('blackjack_double')){doubled=true;updateCredits(-1*parseFloat($(".blackjack_game_value").html().replace(' Credits','')));buttonString=phraser('DOUBLE');}
  428. $.ajax({type:"GET",url:"/blackjack_bet.php",data:{hit:true,doubled:doubled,user_token:$("#user_token").val()},success:function(text){if(text=='errorCards'||text=='errorGameID'||text=='errorTotal'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCredits'){$(".blackjack_hit").removeClass('disabled');needCredits();}else{blackJackHit(text,doubled);if(doubled){$("#blackjack_chips_container_ongoing").html($("#blackjack_chips_container_ongoing").html()+' '+$("#blackjack_chips_container_ongoing").html());}}
  429. button.prop('disabled',false).html(buttonString);}});}});$('body').on('click','.blackjack_stand',function(e){if(!$(this).hasClass('disabled')){blackJackStand();}});$('body').on('click','#refresh_steam_info',function(e){$("#refresh_steam_info").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/settings_save.php",data:{refresh_steam:true},success:function(text){$("#refresh_steam_info").prop('disabled',false).html(phraser('REFRESH'));swal({title:phraser('SUCCESS'),html:phraser('SETTINGS_SUCCESSFULLY_SAVED'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){window.location.reload();});}});});$('body').on('click','#blackjack_better .chip',function(e){var chip=$(this).clone();var bet_val=parseFloat($("#blackjack_bet_value").html());if($(this).parent().attr('id')=='blackjack_chips'){$("#blackjack_chips_container").prepend(chip);bet_val+=parseFloat(chip.attr('data-val'));}else{$(this).remove();bet_val-=parseFloat(chip.attr('data-val'));}
  430. bet_val=Math.round(bet_val*100)/ 100;
  431. $("#blackjack_bet_value").html(bet_val)
  432. $(".blackjack_bet_value").html(bet_val+' Credits');});var slot_available=true;$('body').on('click submit','#slot_spin, #slot_bet',function(e){e.preventDefault();if($(this).attr('id')=="slot_bet"&&e.type=='click'){return;}
  433. if(slot_available){slot_available=false;var credits=parseFloat($("#slot_bet_credits").val());$("#slot_spin").addClass('slot_spin_disabled');$("#slot_winner").removeClass('slot_winner_highlight');$(".slot_legend_result").removeClass('slot_legend_highlight');$.ajax({type:"GET",url:"/slot_bet.php",data:{credits:credits,user_token:$("#user_token").val()},success:function(text){if(text=='errorCredits'){needCredits();$("#slot_spin").removeClass('slot_spin_disabled');slot_available=true;}else if(text=='errorMin'|| text=='errorMax'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET_10'),type:'error',confirmButtonText:phraser('OKAY')});$("#slot_spin").removeClass('slot_spin_disabled');slot_available=true;}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{$(".spin").trigger('play');setTimeout(function(){$(".spin").trigger('pause');$(".spin").prop("currentTime",0);},900);updateCredits(-1*credits);var fruits=text.split(";");var i=0;slotFill();$(".slot_child_content").each(function(){$(this).append('<img src="'+site+'/images/'+fruits[i]+'.png">');$(this).append('<img src="'+site+'/images/'+fruits[(i+1)]+'.png">');i+=2;});slotSpinAll();setTimeout(function(){$("#slot_spin").removeClass('slot_spin_disabled');slot_available=true;if(fruits[7]=='win'){if(fruits[0]=='treasure'||fruits[0]=='blueberry'){$(".win_big").trigger('play');setTimeout(function(){$(".win_big").trigger('pause');$(".win_big").prop("currentTime",0);},1500);}else{$(".win_normal").trigger('play');setTimeout(function(){$(".win_normal").trigger('pause');$(".win_normal").prop("currentTime",0);},1500);}
  434. updateCredits(fruits[6]);$("#slot_winner").addClass('slot_winner_highlight');$("#"+fruits[0]).addClass('slot_legend_highlight');setTimeout(function(){$("#slot_winner").removeClass('slot_winner_highlight');$("#"+fruits[0]).removeClass('slot_legend_highlight');},2000);}},2500);}}});}});$('body').on('submit','#jukebox_form',function(e){e.preventDefault();$("#jukebox_form").hide();$("#jukebox_loader").show();$.ajax({type:"GET",url:"/jukebox.php",data:{create:true,track_url:$("#track_url").val()},success:function(text){if(text=='errorCredits'){needCredits();}else if(text=='errorURL'){swal({title:phraser('ERROR'),html:phraser('JUKEBOX_URL_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAvailable'){swal({title:phraser('ERROR'),html:phraser('JUKEBOX_AVAILABLE_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else{$("#track_url").val('');var jukeboxTokens=parseInt($("#jukebox_tokens b").html());if(jukeboxTokens==0&&!chatMod&&!userVIP){updateCredits(-1);}else if(jukeboxTokens>0){$("#jukebox_tokens b").html((jukeboxTokens-1));}}
  435. $("#jukebox_form").show();$("#jukebox_loader").hide();}});});$("#jukebox_slider").bind("slider:changed",function(event,data){var newVolume=Math.round((data.ratio)*100);youtubePlayer.setVolume(newVolume);saveJukeboxVolume(newVolume);$("#jukebox_volume_holder").val(data.ratio);});$('body').on('click','#jukebox_toggle',function(e){var newVolume=0.75;if($("#jukebox_volume_holder").val()>0){newVolume=0;}
  436. $("#jukebox_slider").simpleSlider("setValue",newVolume);$("#jukebox_volume_holder").val(newVolume);});$('body').on('click','#mini_guide_terms',function(e){loadPage('terms.php');});$('body').on('click','[show-profile]',function(e){var isVisible=$("#user_profile").is(':visible');var user_id=$(this).attr('show-profile');$("#user_profile_links").show();$("#send_credits").hide();$("#user_profile").html('<div class="loader_small_darker" style="margin-top: 60px;"></div>').fadeIn(100);$.ajax({type:"GET",url:"/user_info.php",data:{user_id:user_id},success:function(text){$("#user_profile").attr("data-user",user_id);$("#user_profile").html(text);}});if(!isVisible){var posTop=e.pageY-40;var posLeft=e.pageX-30;if(isMobile){posLeft+=30;}
  437. if(posLeft+$("#user_profile").width()>$('body').width()){posLeft-=posLeft+$("#user_profile").width()- $('body').width()+10;}
  438. if(posTop+$("#user_profile").height()>$('body').height()){posTop-=posTop+$("#user_profile").height()- $('body').height()+10;}
  439. $("#user_profile").html('<div class="loader_small_darker" style="margin-top: 60px;"></div>').css({top:posTop,left:posLeft}).fadeIn(100);}});$('body').on('click','#user_profile_close',function(e){$(this).parent().hide();});var chatOriginalWidth,chatOriginalHeight;$('body').on('click','#chat_hide',function(e){chatOriginalWidth=$(".chat").width();chatOriginalHeight=$(".chat").height();$("#chat_show").show();$(".chat").animate({'width':'0','height':'0'},300,function(){$(".chat").css({'display':'none','width':'','height':''});});pusherChat.unsubscribe("chat_channel");});$('body').on('click','#chat_show',function(e){$(".chat").css('display','table-cell');$("#chat_show").hide();$(".chat").animate({'width':chatOriginalWidth+'px','height':chatOriginalHeight+'px'},300,function(){$(".chat").css({'width':'','height':''});});var cChannel=pusherChat.subscribe('chat_channel');cChannel.bind('chat_message_new',function(data){addChatMessage(data);});cChannel.bind('chat_message_remove',function(data){removeChatMessage(data);});cChannel.bind('chat_giveaway_new',function(data){handleGiveaway(data);});});$('body').on('change','#giveaway_random',function(e){if(!$("#giveaway_random").is(':checked')){$("#giveaway_answer").attr('disabled','disabled');$("#giveaway_hint").attr('disabled','disabled');}else{$("#giveaway_answer").removeAttr('disabled');$("#giveaway_hint").removeAttr('disabled');}});$('body').on('submit','#giveaway_form',function(e){e.preventDefault();$(this).hide();var answer="";var hint="";var type="random";if($("#giveaway_random").is(':checked')){type="trivia";answer=$("#giveaway_answer").val();hint=$("#giveaway_hint").val();}
  440. $.ajax({type:"GET",url:"/admin_save.php",data:{start_giveaway:true,answer:answer,hint:hint,type:type},success:function(text){loadAdmin("chat");}});});$('body').on('click','.jukebox_stop',function(e){if(confirm('Are you sure?')){$.ajax({type:"GET",url:"/admin_save.php",data:{jukebox_stop:true},success:function(text){}});}});$('body').on('click','.betting_game_minimize',function(e){$(this).hide();$(this).parent().find('.betting_game_loader, .betting_game_result').hide();$(this).parent().addClass('betting_game_small').css('height','100px');$(this).parent().find('.betting_game_bg').css('height','100px');});$('body').on('click','.betting_game_small',function(e){$(".betting_game").each(function(){$(this).find('.betting_game_minimize, .betting_game_loader, .betting_game_result').hide();$(this).addClass('betting_game_small').css('height','100px');$(this).find('.betting_game_bg').css('height','100px');});var game_id=$(this).attr('show-game');var content_height=120+$(this).find('.betting_game_result').height();$(this).find('.betting_game_minimize').show();$(this).removeClass('betting_game_small').css('height',content_height+'px');$(this).find('.betting_game_bg').css('height',content_height+'px');$(this).find('.betting_game_result').fadeIn(500);});$('body').on('click','.betting_create_team',function(e){$(".betting_create_team").removeClass('betting_selected');$(this).addClass('betting_selected');});var betting_bet_available=true;$('body').on('submit','.betting_create',function(e){e.preventDefault();var that=$(this);if(betting_bet_available){betting_bet_available=false;var credits=that.find(".betting_value").val();var team_id=that.find(".betting_selected").attr('data-id');var game_id=that.attr('data-id');$("#betting_create_loader").show();$("#betting_create_info").hide();$.ajax({type:"GET",url:"/betting_bet.php",data:{game_id:game_id,team_id:team_id,credits:credits,user_token:$("#user_token").val()},success:function(text){betting_bet_available=true;$("#betting_create_loader").hide();$("#betting_create_info").show();if(text=='errorCredits'){needCredits();}else if(text=='errorMin'||text=='errorMax'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('ERROR')});}else if(text=='errorStarted'){swal({title:phraser('ERROR'),html:phraser('MATCH_IS_LIVE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*credits);loadPage('betting.php');}}});}});var betting_swap_available=true;$('body').on('click','.betting_swap',function(e){if(betting_swap_available){betting_swap_available=false;var bet_id=$(this).attr('data-id');$("#betting_swap_loader").show();$.ajax({type:"GET",url:"/betting_bet.php",data:{bet_id:bet_id,user_token:$("#user_token").val()},success:function(text){$("#betting_swap_loader").hide();betting_swap_available=true;if(text=='errorStarted'){swal({title:phraser('ERROR'),html:phraser('MATCH_IS_LIVE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{loadPage('betting.php');}}});}});$('body').on('keyup','.betting_value',function(e){var value=$(this).val();var home_multiplier=parseFloat($('.betting_home_multiplier').html());var away_multiplier=parseFloat($('.betting_away_multiplier').html());if(value.length==0){value=0;}
  441. $(".betting_both_value").html(value);$(".betting_home_reward").html(Math.round(value*home_multiplier*100.0)/ 100.0);
  442. $(".betting_away_reward").html(Math.round(value*away_multiplier*100.0)/ 100.0);
  443. });$('body').on('change','#home_team_id, #away_team_id',function(){if($("#home_team_id").val()==$("#away_team_id").val()){alert("You can't choose same team for both home and away!");if($("#home_team_id").val()=="16"){$(this).val("3");}else{$(this).val("16");}}});$('body').on('submit','#betting_game_link',function(e){e.preventDefault();$("#betting_link_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_create_game:true,url:$("#betting_game_link_url").val()},success:function(text){$("#betting_link_loader").hide();if(text!='success'){swal({title:phraser('ERROR'),html:text,type:'error',confirmButtonText:phraser('OKAY')});}else{loadAdmin("betting_game_link");}}});});var betting_create_available=true;$('body').on('submit','#betting_game_create',function(e){e.preventDefault();if(betting_create_available){betting_create_available=false;$("#betting_create_loader").show();$("#betting_game_create").hide();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_create:true,event_id:$("#event_id").val(),home_team_id:$("#home_team_id").val(),away_team_id:$("#away_team_id").val(),stream_url:$("#stream_url").val(),stats_url:$("#stats_url").val(),best_of:$("#best_of").val(),start_date:$("#start_date").val(),comments:$("#comments").val()},success:function(text){betting_create_available=true;loadAdmin("betting_game_create");}});}});var betting_edit_available=true;$('body').on('submit','#betting_game_edit',function(e){e.preventDefault();if(betting_edit_available){betting_edit_available=false;$("#betting_create_loader").show();$("#betting_event_edit").hide();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_edit:true,game_id:$("#game_id").val(),event_id:$("#event_id").val(),home_team_id:$("#home_team_id").val(),home_team_id_old:$("#home_team_id_old").val(),away_team_id:$("#away_team_id").val(),away_team_id_old:$("#away_team_id_old").val(),home_result:$("#home_result").val(),away_result:$("#away_result").val(),stream_url:$("#stream_url").val(),stats_url:$("#stats_url").val(),best_of:$("#best_of").val(),start_date:$("#start_date").val(),comments:$("#comments").val()},success:function(text){betting_edit_available=true;$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'betting_game_edit',game_id:$("#game_id").val()},success:function(text){$("#admin_response").html(text);}});}});}});$('body').on('click','.betting_game_edit',function(e){var game_id=$(this).attr('data-id');$("#betting_create_loader").show();$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'betting_game_edit',game_id:game_id},success:function(text){$("#admin_response").html(text);}});});$('body').on('click','#betting_finish',function(e){if(!confirm('Are you sure?')){return;}
  444. var game_id=$("#game_id").val();$("#betting_create_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_finish:true,game_id:game_id},success:function(text){loadAdmin("betting_game_edit");}});});$('body').on('click','.betting_game_rollback',function(e){if(!confirm('Are you sure?')){return;}
  445. var game_id=$(this).attr('data-id');$("#betting_create_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_game_rollback:true,game_id:game_id},success:function(text){loadAdmin("betting_game_edit");}});});var betting_create_available=true;$('body').on('submit','#betting_event_create',function(e){e.preventDefault();if(betting_create_available){betting_create_available=false;$("#betting_create_loader").show();$("#betting_event_create").hide();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_event_create:true,name:$("#name").val(),image:$("#image").val()},success:function(text){betting_create_available=true;loadAdmin("betting_event_create");}});}});var betting_edit_available=true;$('body').on('submit','#betting_event_edit',function(e){e.preventDefault();if(betting_edit_available){betting_edit_available=false;$("#betting_create_loader").show();$("#betting_event_create").hide();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_event_edit:true,event_id:$("#event_id").val(),name:$("#name").val(),image:$("#image").val()},success:function(text){betting_edit_available=true;loadAdmin("betting_event_edit");}});}});$('body').on('click','.betting_event_edit',function(e){$("#betting_create_loader").show();$.ajax({type:"GET",url:"/admin_pages.php",data:{page:'betting_event_edit',event_id:$(this).attr('data-id')},success:function(text){$("#admin_response").html(text);}});});$('body').on('click','.coinflip_list_status_join',function(e){$(".coinflip_list_status_join").removeClass('coinflip_list_status_join_final').html('<i class="fa fa-play-circle"></i> '+phraser("CHALLENGE"));$(this).addClass('coinflip_list_status_join_final').html('<i class="fa fa-arrow-right"></i> '+phraser("CONTINUE"));});var coinflip_challenge_available=true;$('body').on('click','.coinflip_list_status_join_final',function(e){var coinflip_id=$(this).attr('data-id');var value=$(this).attr('data-value');var buttonHTML=$(this).html();var button=$(this);if(coinflip_challenge_available){coinflip_challenge_available=false;button.html('<div class="loader_small" style="width: 18px;height: 18px;margin: 15px auto;"></div>');$.ajax({type:"GET",url:"/coinflip_bet.php",data:{challenge:true,coinflip_id:coinflip_id,user_token:$("#user_token").val()},success:function(text){coinflip_challenge_available=true;button.html(buttonHTML);if(text=='errorCredits'){needCredits();}else if(text=='errorGameID'){swal({title:phraser('ERROR'),html:phraser('GAME_SNATCHED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorUser'){swal({title:phraser('ERROR'),html:phraser('CANNOT_PLAY_YOURSELF'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAvailable'){swal({title:phraser('ERROR'),html:phraser('JUKEBOX_AVAILABLE_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*value);coinLoad("game",coinflip_id);}}});}});$('body').on('click','.coinflip_list_status_view',function(e){var coinflip_id=$(this).attr('data-id');coinLoad("game",coinflip_id);});$('body').on('click','.coinflip_view_all',function(e){loadPage("coinflip.php");});$('body').on('click','#coinflip_create img',function(e){$("#coinflip_create img").removeClass('coinflip_selected');$(this).addClass('coinflip_selected');});$('body').on('submit','#coinflip_create',function(e){e.preventDefault();$("#coinflip_create button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');var value=$("#coinflip_value").val();var choice=$(".coinflip_selected").attr('data-side');$.ajax({type:"GET",url:"/coinflip_bet.php",data:{create:true,credits:value,choice:choice,user_token:$("#user_token").val()},success:function(text){$("#coinflip_create button").prop('disabled',false).html(phraser('CREATE'));if(text=='errorCredits'){needCredits();}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_BET_SMALL'),type:'error',confirmButtonText:phraser('ERROR')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorChoice'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('TOO_MANY_BETS'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*value);}}});});$('body').on('click','.dragrace_list_status_join',function(e){$(".dragrace_list_status_join").removeClass('dragrace_list_status_join_final').html('<i class="fa fa-play-circle"></i> '+phraser("CHALLENGE"));$(this).addClass('dragrace_list_status_join_final').html('<img src="'+site+'/images/race_car1.png" data-choice="1"> <img src="'+site+'/images/race_car2.png" data-choice="2"> <img src="'+site+'/images/race_car3.png" data-choice="3"> <img src="'+site+'/images/race_car4.png" data-choice="4">');});var dragrace_challenge_available=true;$('body').on('click','.dragrace_list_status_join img',function(e){var dragrace_id=$(this).parent().attr('data-id');var value=$(this).parent().attr('data-value');var choice=$(this).attr('data-choice');if(dragrace_challenge_available){dragrace_challenge_available=false;$("#dragrace_challenge_loader").show();$.ajax({type:"GET",url:"/dragrace_bet.php",data:{challenge:true,dragrace_id:dragrace_id,choice:choice,user_token:$("#user_token").val()},success:function(text){dragrace_challenge_available=true;$("#dragrace_challenge_loader").hide();if(text=='errorCredits'){needCredits();}else if(text=='errorGameID'){swal({title:phraser('ERROR'),html:phraser('GAME_SNATCHED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorUser'){swal({title:phraser('ERROR'),html:phraser('CANNOT_PLAY_YOURSELF'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAvailable'){swal({title:phraser('ERROR'),html:phraser('JUKEBOX_AVAILABLE_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*value);raceLoad("game",dragrace_id);}}});}});$('body').on('click','.dragrace_list_status_view',function(e){var dragrace_id=$(this).attr('data-id');raceLoad("game",dragrace_id);});$('body').on('click','.race_view_all',function(e){loadPage("dragrace.php");});$('body').on('click','#dragrace_create img',function(e){$("#dragrace_create img").removeClass('dragrace_selected');$(this).addClass('dragrace_selected');});var dragrace_create_available=true;$('body').on('submit','#dragrace_create',function(e){e.preventDefault();if(dragrace_create_available){dragrace_create_available=false;var value=$("#dragrace_value").val();var choice=$(".dragrace_selected").attr('data-choice');$("#dragrace_create_loader").show();$("#dragrace_create").hide();$.ajax({type:"GET",url:"/dragrace_bet.php",data:{create:true,credits:value,choice:choice,user_token:$("#user_token").val()},success:function(text){dragrace_create_available=true;$("#dragrace_create_loader").hide();$("#dragrace_create").show();if(text=='errorCredits'){needCredits();}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_BET_SMALL'),type:'error',confirmButtonText:phraser('ERROR')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('TOO_MANY_BETS'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*value);}}});}});$('body').on('click','.giveaway_win',function(e){$(this).html('<div class="loader_small" style="margin-top: 0;"></div>');$.ajax({type:"GET",url:"/giveaway_bet.php",data:{winner:true},success:function(text){if(text=='errorNotFound'){swal({title:phraser('ERROR'),html:phraser('PLEASE_TRY_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorName'){swal({title:phraser('ERROR'),html:phraser('GIVEAWAY_NEED_NAME'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(text);loadPage("giveaway.php");}}});});$('body').on('change','#admin_language_select',function(e){if($(this).val()=='empty')
  446. {return;}
  447. $("#admin_language_iframe").attr('src',site+'/lang/compare.php?compare_lang='+$(this).val());});$('body').on('submit','#admin_giveaway_create',function(e){e.preventDefault();var item_name=$("#item_name").val();var item_exterior=$("#item_exterior").val();var item_image=$("#item_image").val();var item_price=$("#item_price").val();var end_date=$("#end_date").val();$("#admin_giveaway_create input[type='submit']").attr('disabled','disabled');$.ajax({type:"GET",url:"/admin_save.php",data:{giveaway_create:true,item_name:item_name,item_exterior:item_exterior,item_image:item_image,item_price:item_price,end_date:end_date},success:function(text){if(text!='success'){alert(text);}else{}}});});$('body').on('click','#gather_keys',function(e){$("#admin_bots_loader").show();var bot_id=$("#gather_keys_select").val();var max_amount=$("#gather_keys_max_amount").val();var max_offers=$("#gather_keys_max_offers").val();$.ajax({type:"GET",url:"/admin_save.php",data:{gather_keys:true,bot_id:bot_id,max_amount:max_amount,max_offers:max_offers},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('click','#gather_items',function(e){$("#admin_bots_loader").show();var bot_id=$("#gather_items_select").val();var max_amount=$("#gather_items_max_amount").val();var max_offers=$("#gather_items_max_offers").val();var sorted=$('.bots_sortable').toArray().sort(function(a,b){var aVal=parseInt($(a).attr('data-sort')),bVal=parseInt($(b).attr('data-sort'));return bVal- aVal;});var bot_ids="";for(i=0;i<61;i++){if(bot_id!=25){bot_ids=bot_ids+ $(sorted[i]).attr('data-id')+";";}}
  448. $.ajax({type:"GET",url:"/admin_save.php",data:{gather_items:true,bot_id:bot_id,bot_ids:bot_ids,max_amount:max_amount,max_offers:max_offers},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('click','#sell_items',function(e){$("#admin_bots_loader").show();var bot_id=$("#sell_items_select").val();var max_amount=$("#sell_items_max_amount").val();var max_offers=$("#sell_items_max_offers").val();$.ajax({type:"GET",url:"/admin_save.php",data:{sell_items:true,bot_id:bot_id,max_amount:max_amount,max_offers:max_offers},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('click','#update_prices',function(e){updatePrices($("#update_prices_select").val(),$("#update_prices_type").val(),0,1);});$('body').on('click','#reset_prices',function(e){$("#admin_bots_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{reset_prices:true},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('click','#get_listed',function(e){adminGetListed(0);});$('body').on('click','#get_balance',function(e){$("#admin_bots_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{get_balance:true},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('click','#gather_balance',function(e){$("#admin_bots_loader").show();$.ajax({type:"GET",url:"/admin_save.php",data:{gather_balance:true},success:function(text){$("#admin_bots_loader").hide().before(text);}});});$('body').on('change','#answer_select',function(e){var new_text=$("#answer_"+$(this).val()).text();$("#support_answer").val(new_text);});$('body').on('click','#go_to_settings',function(e){loadPage("settings.php");$(".sweet-alert").removeClass('visible').hide();$(".sweet-overlay").hide();});$('body').on('click','.send_credits_button',function(e){$("#user_profile_links").hide();$("#send_credits").show();});$('body').on('click','.send_credits_back',function(e){$("#user_profile_links").show();$("#send_credits").hide();});$('body').on('submit','#send_credits form',function(e){e.preventDefault();$(".loader_small_dark").show();$("#send_credits_form").hide();var credits=$("#send_credits_amount").val();var user_id=$("#user_profile").attr('data-user');$.ajax({type:"GET",url:"/send_credits.php",data:{user_id:user_id,credits:credits,user_token:$("#user_token").val()},success:function(text){$(".loader_small_dark").hide();$("#send_credits_form").show();if(text=='errorValue'){swal({title:phraser('ERROR'),html:phraser('DAILY_SEND_LIMIT_NEW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCredits'){needCredits();}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLevel'){swal({title:phraser('ERROR'),html:phraser('ERROR_LEVEL_TOO_LOW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAmount'){swal({title:phraser('ERROR'),html:phraser('SEND_ERROR_AMOUNT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorUser'){swal({title:phraser('ERROR'),html:phraser('COULD_NOT_FIND_USER'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorDeposit'){swal({title:phraser('ERROR'),html:phraser('SEND_NEED_DEPOSIT'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*credits);$("#user_profile_links").show();$("#send_credits").hide();swal({title:phraser('SUCCESS'),html:phraser('CREDITS_SUCCESSFULLY_SENT'),type:'success',confirmButtonText:phraser('OKAY')});}}});});$('body').on('mousedown touchstart','#user_profile_background_holder',function(e){e.preventDefault();moveElement(e,"#user_profile");});$('body').on('submit','#scratchy_form',function(e){e.preventDefault();$("#scratchy_loader").show();$("#scratchy_form").hide();var oldTokens=parseInt($(".amount_tokens b").html());var newTokens=oldTokens-1;if(newTokens<0){newTokens=0;}
  449. $.ajax({type:"GET",url:"/scratchy_bet.php",data:{user_token:$("#user_token").val()},success:function(text){$("#scratchy_loader").hide();$("#scratchy_form").show();$(".amount_tokens b").html(newTokens);if(text=='errorCredits'){needCredits();}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorUser'){swal({title:phraser('ERROR'),html:phraser('CANNOT_SEND_YOURSELF'),type:'error',confirmButtonText:phraser('OKAY')});}else{$("#scratchy_form").hide();$('#scratchy_pad').wScratchPad('enable',true);var result=text.split(";");var chestResult=result[0].split("_");$('#scratchy_pad img').attr('src',site+'/images/scratchy_'+result[0]+'.png');$("#scratchy_result").html(chestResult[0]+";"+result[1]);if(oldTokens==0){updateCredits(-3);}}}});});$('body').on('click','.show_offer',function(e){var security_code=$(this).attr('data-code');var offer_type="deposit";loadAdmin('offer');$("#admin_menu li").each(function(){$(this).removeClass('active');});$("a[data-page='offer']").parent().addClass('active');$(".tipsy").remove();setTimeout(function(){$("#search_round_text").val(security_code);$("#search_round_result").html('<div class="loader_small"></div>').show();$.ajax({type:"GET",url:"/admin_save.php",data:{security_code:security_code,offer_type:offer_type},success:function(text){$("#search_round_result").html(text);}});},500);});var safebox_available=true;$('body').on('click','#safe_box_pad div',function(e){var code=$("#safe_box_pin_code").text();var button=$(this).attr('data-pad');var newCode='';$(".beep").trigger('play');setTimeout(function(){$(".beep").trigger('pause');$(".beep").prop("currentTime",0);},100);if(button=='BACK'&&code!='CODE'){if(code.length==1){newCode='CODE';}else{newCode=code.substring(0,code.length- 1);}
  450. $("#safe_box_pin_code").text(newCode);}
  451. if(button!='BACK'&&button!='GO'){if(code=='CODE'){newCode=button;}else if(code.length<4){newCode=code+''+button;}else{newCode=code;}
  452. $("#safe_box_pin_code").text(newCode);}
  453. if(button=='GO'&&safebox_available){if(code.length==4&&code!='CODE'){var oldTokens=parseInt($(".amount_tokens b").html());var newTokens=oldTokens-1;if(newTokens<0){newTokens=0;}
  454. safebox_available=false;$.ajax({type:"GET",url:"/safebox_bet.php",data:{code:code,user_token:$("#user_token").val()},success:function(text){$(".amount_tokens b").html(newTokens);safebox_available=true;text=text.split(";");if(oldTokens==0){updateCredits(-0.5);}
  455. if(text[0]=='errorCredits'){setTimeout(function(){needCredits();},100);}else if(text[0]=='errorAction'){setTimeout(function(){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});},100);}else if(text[0]=='success'){if(text[1]=='correct'){updateCredits(parseFloat(text[2]));$("#safe_box_circle").addClass('safe_circle_green');$(".win_big").trigger('play');setTimeout(function(){$(".win_big").trigger('pause');$(".win_big").prop("currentTime",0);},1500);}else{$("#safe_box_circle").addClass('safe_circle_red');$(".error").trigger('play');setTimeout(function(){$(".error").trigger('pause');$(".error").prop("currentTime",0);},1500);}}
  456. timeouts.push(setTimeout(function(){$('#safe_box_pin_code').text('CODE');$("#safe_box_circle").removeClass();},500));}});}}});$('body').on('click','.withdraw_giveaway_item',function(e){var itemInfo=$(this).parent().attr('original-title').replace('<b>','').split("</b><br>");var itemImage=$(this).parent().find('img').attr('src');var itemName=itemInfo[0].replace("★","");var itemPrice=$(this).parent().find('.round_item_price span').text();var regExp=/\(([^)]+)\)$/;var matches=regExp.exec(itemName);var wear=matches[1];itemName=itemName.replace(matches[0],"").trim();$(".tipsy").remove();loadPage('admin.php');setTimeout(function()
  457. {loadAdmin('giveaways');$("#admin_menu li").each(function(){$(this).removeClass('active');});$("a[data-page='giveaways']").parent().addClass('active');var withdrawGiveawayInterval=setInterval(function()
  458. {$("#item_name").val(itemName);$("#item_exterior").val(wear);$("#item_image").val(itemImage);$("#item_price").val(itemPrice);if($("#admin_giveaway_create").length>0)
  459. {clearInterval(withdrawGiveawayInterval);}},500);},500);});$("body").on('change','#admin_ticket_status',function(){var status=$(this).val();var user_ticket_id=$(".support_replies").attr('data-id');$.ajax({type:"GET",url:"/admin_save.php",data:{changeTicketStatus:true,status:status,user_ticket_id:user_ticket_id}});});$("body").on('click','.perks_claim',function(){var that=$(this);var perk_id=that.attr('data-id');$("#chat_giveaway_ineligible").remove();$.ajax({type:"GET",url:"/perks_claim.php",data:{perk_id:perk_id},success:function(text){that.replaceWith(phraser("CLAIMED"));}});});$("body").on('click','.refund_offer',function(){var that=$(this);var offer_id=that.attr('data-id');var type=that.attr('data-type');$.ajax({type:"GET",url:"/admin_save.php",data:{refund_offer:true,offer_id:offer_id,type:type},success:function(text){that.replaceWith(phraser("Refunded"));}});});$("body").on('click','.mobile_offer',function(){var that=$(this);var offer_id=that.attr('data-id');var type=that.attr('data-type');$.ajax({type:"GET",url:"/admin_save.php",data:{mobile_offer:true,offer_id:offer_id,type:type},success:function(text){that.replaceWith(phraser("Confirmed"));}});});$("body").on('submit','#generate_settings',function(e){e.preventDefault();$.ajax({type:"GET",url:"/admin_save.php",data:{generate_settings:true,min:$("#withdraw_min").val(),max:$("#withdraw_max").val(),UseSeparateProcesses:$("#withdraw_bot").val(),AutoStartAllBots:$("#withdraw_start").val()},success:function(text){$("#admin_language_iframe").html(text);}});});$("body").on('click','.bet_edit',function(){var that=$(this);var id=that.attr('id');var input=$(that.attr('data-input'));var value=parseFloat(input.val());var max=that.attr('data-max');var newValue;if(isNaN(value)){value=0;}
  460. if(id=="bet_clear"){newValue='';}else if(id=="bet_one"){newValue=value+1;}else if(id=="bet_ten"){newValue=value+10;}else if(id=="bet_half"){newValue=value/2;}else if(id=="bet_double"){newValue=value*2;}else if(id=="bet_max"){newValue=parseFloat($("#credits").html());}
  461. if(newValue>max){newValue=max;}
  462. if(newValue>parseFloat($("#credits").html())){newValue=parseFloat($("#credits").html());}
  463. input.val(newValue);});$("body").on('click','.copy',function(){var text=$(this).attr('original-title');copyToClipboard(text);$(this).html(phraser('COPIED'));});$('body').on('keyup','#credits_amount',function(e){if(this.value.charAt(0)=="."||this.value.charAt(0)==","){this.value="0"+this.value;}
  464. this.value=this.value.replace(",",".");if($.isNumeric(this.value)===false){this.value=this.value.slice(0,-1);}
  465. var newValue=$(this).val();var maxValue=parseFloat($("#credits").html());if(newValue>maxValue){newValue=maxValue;}
  466. this.value=newValue;var newBitcoins=newValue*1/$("#bitcoins_rate").html()- 0.00060;if(newBitcoins<0){newBitcoins=0;}
  467. $("#bitcoins_amount").html(newBitcoins.toFixed(6));});$('body').on('submit','#withdraw',function(e){e.preventDefault();$("#withdraw button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');var credits=$("#credits_amount").val();$.ajax({type:"GET",url:"/withdraw_request.php",data:{address:$("#address").val(),credits:$("#credits_amount").val(),save_address:$("#save_address").prop('checked'),user_token:$("#user_token").val()},success:function(text){if(text=='errorCredits'){needCredits();}else if(text=='errorBlocked'){swal({title:phraser('ERROR'),html:phraser('WITHDRAW_ADDRESS_BLOCKED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBitcoin'){swal({title:phraser('ERROR'),html:phraser('BITCOIN_VALUE_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCreditsPlayed'){swal({title:phraser('ERROR'),html:phraser('PLAYED_FOR_EXCEEDED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_WITHDRAW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPerform'){swal({title:phraser('ERROR'),html:phraser('WITHDRAW_ACTION_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){updateCredits(-1*credits);$("#user_profile_links").show();$("#send_credits").hide();swal({title:phraser('SUCCESS'),html:phraser('CREDITS_SUCCESSFULLY_SENT'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){loadPage('withdraw.php');});}else{swal({title:phraser('ERROR'),html:text,type:'error',confirmButtonText:phraser('OKAY')});}
  468. $("#withdraw button").prop('disabled',false).html(phraser('WITHDRAW_TITLE'));}});});$('body').on('submit','#register_step_1',function(e){e.preventDefault();$("#register_step_1 button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/register_request.php",data:{steam_account_link:$("#sa").val()},success:function(text){$("#register_step_1 button").prop('disabled',false).html(phraser('CONTINUE'));if(text=='errorInput'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_INPUT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorExists'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_EXISTS'),type:'error',confirmButtonText:phraser('OKAY')});}else{$("#random_name").html(text);$("#register_step_1").fadeOut(100,function(){$("#register_step_2").fadeIn();});}}});});$('body').on('submit','#register_step_2',function(e){e.preventDefault();$("#register_step_2 button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/register_request.php",data:{steam_account_name:true},success:function(text){$("#register_step_2 button").prop('disabled',false).html(phraser('CONTINUE'));if(text=='success'){$("#random_name").html(text);$("#register_step_2").fadeOut(100,function(){$("#register_step_3").fadeIn();});}else{swal({title:phraser('ERROR'),html:phraser('WRONG_STEAM_NAME_YOUR_NAME_IS')+'<b>'+text+'</b>',type:'error',confirmButtonText:phraser('OKAY')});}}});});$('body').on('submit','#register_step_3',function(e){e.preventDefault();$("#register_step_3 button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/register_request.php",data:{email:$("#email").val(),password:$("#password").val(),password_again:$("#password_again").val()},success:function(text){$("#register_step_3 button").prop('disabled',false).html(phraser('SIGN_UP'));if(text=='errorSteps'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_STEPS'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorEmail'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_EMAIL'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorEmailTaken'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_EMAIL_TAKEN'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPasswordStrength'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPasswordAgain'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){$(".user_form_holder").fadeOut(100);window.location=site+"/home";}else{swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}}});});$('body').on('change','#accept_terms',function(){if($(this).is(':checked'))
  469. {$("#step_3_button").prop('disabled',false);}
  470. else
  471. {$("#step_3_button").prop('disabled',true);}});$('body').on('submit','#login_form',function(e){e.preventDefault();$("#login_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/login_request.php",data:{email:$("#email").val(),password:$("#password").val()},success:function(text){$("#login_form button").prop('disabled',false).html(phraser('LOG_IN'));if(text=='errorCredentials'){swal({title:phraser('ERROR'),html:phraser('LOGIN_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLoginSpam'){swal({title:phraser('ERROR'),html:phraser('LOGIN_ERROR_SPAM'),type:'error',confirmButtonText:phraser('OKAY')});}else{$(".user_form_holder").fadeOut(100);window.location=site+"/home";}}});});$('body').on('submit','#forgot_form',function(e){e.preventDefault();$("#forgot_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/forgot_request.php",data:{email:$("#email").val()},success:function(text){$("#forgot_form button").prop('disabled',false).html(phraser('LOG_IN'));if(text=='errorCredentials'){swal({title:phraser('ERROR'),html:phraser('FORGOT_ERROR_EMAIL'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorSending'){swal({title:phraser('ERROR'),html:phraser('FORGOT_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorTooSoon'){swal({title:phraser('ERROR'),html:phraser('FORGOT_ERROR_TOO_SOON'),type:'error',confirmButtonText:phraser('OKAY')});}else{swal({title:phraser('SUCCESS'),html:phraser('FORGOT_SUCCESS'),type:'success',confirmButtonText:phraser('OKAY')});}}});});$('body').on('submit','#reset_form',function(e){e.preventDefault();$("#reset_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/reset_request.php",data:{password:$("#password").val(),password_again:$("#password_again").val()},success:function(text){$("#reset_form button").prop('disabled',false).html(phraser('SAVE'));if(text=='errorPasswordStrength'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPasswordAgain'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){swal({title:phraser('SUCCESS'),html:phraser('RESET_SUCCESS'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){$(".user_form_holder").fadeOut(100);window.location=site+"/login";});}else{swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}}});});$('body').on('submit','#change_password_form',function(e){e.preventDefault();$("#change_password_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/settings_save.php",data:{password_old:$("#password_old").val(),password:$("#password").val(),password_again:$("#password_again").val()},success:function(text){$("#change_password_form button").prop('disabled',false).html(phraser('SAVE'));if(text=='errorPasswordOld'){swal({title:phraser('ERROR'),html:phraser('CHANGE_PASSWORD_ERROR'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPasswordStrength'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_STRENGTH'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPasswordAgain'){swal({title:phraser('ERROR'),html:phraser('REGISTER_ERROR_PASSWORD_AGAIN'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){swal({title:phraser('SUCCESS'),html:phraser('RESET_SUCCESS'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){window.location.reload();});}else{swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}}});});$('body').on('click','#crash_manual_bet',function(){$('#crash_manual_bet_holder').show();$('#crash_auto_bet_holder').hide();});$('body').on('click','#crash_auto_bet',function(){$('#crash_manual_bet_holder').hide();$('#crash_auto_bet_holder').show();});$('body').on('change','#crash_auto',function(){if($(this).is(':checked'))
  472. {$("#crash_form button").html(phraser('START_L'));}
  473. else
  474. {$("#crash_form button").html(phraser('PLACE_BET'));}});$('body').on('submit','#crash_form',function(e){e.preventDefault();var btnText=$("#crash_form button").html();var credits=parseFloat($('#crash_bet').val());var cashout=parseFloat($('#crash_cashout').val())
  475. var auto=$("#crash_auto").prop('checked');$("#crash_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');if(auto&&(isNaN(cashout)||cashout<1))
  476. {swal({title:phraser('ERROR'),html:phraser('AUTO_BET_NEEDS_AUTO_CASHOUT'),type:'error',confirmButtonText:phraser('OKAY')});$("#crash_form button").prop('disabled',false).html(btnText);return;}
  477. if(isNaN(cashout))
  478. {$(".crash_cashout_label").html(phraser('NO_AUTO_CASHOUT'));}
  479. else
  480. {$(".crash_cashout_label").html(phraser('AUTO_CASHOUT_LABEL')+cashout);}
  481. $.ajax({type:"POST",url:"/crash_bet.php",data:{credits:credits,cashout:cashout,user_token:$("#user_token").val()},success:function(text){$("#crash_form button").prop('disabled',false).html(btnText);if(text=='errorCredits'){needCredits();}else if(text=='errorValue'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('TOO_MANY_BETS_ONE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLastRound'){swal({title:phraser('ERROR'),html:phraser('ROUND_IN_PROGRESS'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCashout'){swal({title:phraser('ERROR'),html:phraser('CASHOUT_MIN_MAX'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){$(".crash_profit_label").attr('data-value',credits);$(".crash_profit_label b").html('0');$("#crash_form_cashout").fadeIn();updateCredits(-1*credits);if(auto&&!crashAutoBet)
  482. {$("#crash_form_auto_stop").fadeIn();}
  483. crashAutoBet=auto;}}});});$('body').on('submit','#crash_form_cashout',function(e){e.preventDefault();$("#crash_form_cashout button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"POST",url:"/crash_bet.php",data:{cashout_action:true,user_token:$("#user_token").val()},success:function(text){$("#crash_form_cashout button").prop('disabled',false).html(phraser('CASHOUT'));if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLate'){swal({title:phraser('ERROR'),html:phraser('YOU_WERE_TOO_LATE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('NO_BETS_IN_ROUND'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorEarly'){swal({title:phraser('ERROR'),html:phraser('TOO_EARLY_FOR_CASHOUT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){$("#crash_form_cashout").fadeOut();crashAutoBet=false;$("#crash_form_auto_stop").hide();$(".crash_profit_label").attr('data-value',0);$(".crash_profit_label b").html('0');}}});});$('body').on('submit','#crash_form_auto_stop',function(e){e.preventDefault();crashAutoBet=false;$("#crash_form_auto_stop").fadeOut();$(".crash_profit_label").attr('data-value',0);$(".crash_profit_label b").html('0');});$("body").on('click','.crash_edit_link',function(){var that=$(this);var id=that.attr('id');var value=parseFloat($('#crash_bet').val());var newValue;if(isNaN(value)){value=0;}
  484. if(id=="crash_clear"){newValue='';}else if(id=="crash_one"){newValue=value+1;}else if(id=="crash_five"){newValue=value+5;}else if(id=="crash_ten"){newValue=value+10;}else if(id=="crash_half"){newValue=value/2;}else if(id=="crash_double"){newValue=value*2;}else if(id=="crash_max"){newValue=parseFloat($("#credits").html());}
  485. if(newValue>300){newValue=100;}
  486. if(newValue>parseFloat($("#credits").html())){newValue=parseFloat($("#credits").html());}
  487. $('#crash_bet').val(newValue);});$('body').on('click','#buy_get_info',function(){$("#buy_get_info").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 6px auto;"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{buy_get_info:true,transaction_id:$(this).attr('data-id')},success:function(text){try{text=JSON.stringify(JSON.parse(text),null,2);}catch(e){}
  488. $("#buy_get_info").prop('disabled',false).html('<i class="fa fa-refresh"></i> GET RESPONSE');$("#resend_withdraw_response").html(text).show();}});});$('body').on('click','#resend_withdraw_button',function(){$("#resend_withdraw_button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{resend_withdraw:true,withdraw_id:$(this).attr('data-id'),manual:$("#resend_withdraw_manual").is(':checked')},success:function(text){try{text=JSON.stringify(JSON.parse(text),null,2);}catch(e){}
  489. $("#resend_withdraw_button").prop('disabled',false).html(phraser('SEND'));$("#resend_withdraw_response").html(text).show();}});});$('body').on('click','.resend_withdraw_user',function(){var that=$(this);that.text('...');$.ajax({type:"GET",url:"/withdraw_resend.php",data:{security_code:$(this).attr('data-code'),user_id:$(this).attr('data-user')},success:function(text){if(text!='success'){swal({title:phraser('ERROR'),html:text,type:'error',confirmButtonText:phraser('OKAY')});that.text(phraser('RESEND'));}else{swal({title:phraser('SUCCESS'),html:phraser(''),type:'success',confirmButtonText:phraser('OKAY')});that.text(phraser('DONE')).removeClass('resend_withdraw_user');}}});});$('body').on('submit','#send_credits_steam',function(e){e.preventDefault();$("#send_credits_steam button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');var credits=$("#send_steam_credits").val();var steam_id=$("#send_steam_id").val();$.ajax({type:"GET",url:"/send_credits.php",data:{steam_id:steam_id,credits:credits,user_token:$("#user_token").val()},success:function(text){$("#send_credits_steam button").prop('disabled',false).html(phraser('SEND'));if(text=='errorValue'){swal({title:phraser('ERROR'),html:phraser('DAILY_SEND_LIMIT_NEW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCredits'){needCredits();}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAmount'){swal({title:phraser('ERROR'),html:phraser('SEND_ERROR_AMOUNT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorUser'){swal({title:phraser('ERROR'),html:phraser('COULD_NOT_FIND_USER'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorDeposit'){swal({title:phraser('ERROR'),html:phraser('SEND_NEED_DEPOSIT'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*credits);$("#user_profile_links").show();$("#send_credits").hide();swal({title:phraser('SUCCESS'),html:phraser('CREDITS_SUCCESSFULLY_SENT'),type:'success',confirmButtonText:phraser('OKAY')});}}});});$('body').on('click','.withdraw_switch',function(){var type=$(this).attr('data-type');$(".withdraw_switch").removeClass('selected');$(this).addClass('selected');if(type=='withdraw')
  490. {$("#withdraw_form").show();$("#withdraw_form_deals").hide();botInventoryPage=1;loadBotInventory(false,false);}
  491. if(type=='deals')
  492. {$("#withdraw_form").hide();$("#withdraw_form_deals").show();$(".withdraw_deal").removeClass('selected');$(".withdraw_deal").first().addClass('selected');botDealsPage=1;loadBotDeals(false,50,0);}});$('body').on('click','.withdraw_deal',function(){var min=$(this).attr('data-min');var max=$(this).attr('data-max');$(".withdraw_deal").removeClass('selected');$(this).addClass('selected');botDealsPage=1;loadBotDeals(false,min,max);});$('body').on('click','.recruit_prize_pick',function(){var that=$(this);that.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');$.ajax({type:"GET",url:"/recruits_save.php",data:{pick_reward:true,prize_id:that.attr('data-prize')},success:function(text){if(text!='success'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')},function(){window.location.reload();});return;}
  493. swal({title:phraser('SUCCESS'),html:phraser('RECRUIT_REWARD_SAVED'),type:'success',confirmButtonText:phraser('OKAY'),allowOutsideClick:false,allowEscapeKey:false},function(){window.location.reload();});}});});$('body').on('click','.cases_list',function(){$("#case_list_holder").hide();$("#case_holder").html('<div class="loader_small" style="margin-top:30px;"></div>').show();$.ajax({type:"GET",url:"/cases_load.php",data:{case_id:$(this).attr('data-id')},success:function(text){$("#case_holder").html(text);}});});$('body').on('click','.cases_back',function(){$("#case_holder").hide();$("#case_list_holder").show();loadPage('cases.php');});$('body').on('click','#case_buy',function(){var testSpin=false;var button=$(this);var buttonHTML=button.html();var case_id=button.attr('data-id');var case_price=button.attr('data-price');button.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');casesOpen(case_id,case_price,testSpin,button,buttonHTML);});$('body').on('click','#case_test',function(){var testSpin=true;var button=$(this);var buttonHTML=button.html();var case_id=button.attr('data-id');var case_price=button.attr('data-price');button.prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 0 auto;"></div>');casesOpen(case_id,case_price,testSpin,button,buttonHTML);});$('body').on('click','.roulette_bet_choice',function(){$(".roulette_bet_choice").removeClass('roulette_choice_select');$(this).addClass('roulette_choice_select');});$('body').on('submit','.roulette_bet_form',function(e){e.preventDefault();var button=$('.roulette_bet_form button');var buttonHTML=$('.roulette_bet_form button').html();var choice=$(".roulette_choice_select").attr('data-color');var credits=parseFloat($('.roulette_form_value').val());button.prop('disabled',true).html('<div class="loader_small loader_small_dark" style="width: 18px;height: 18px;margin: 0 auto;display:block;"></div>');$.ajax({type:"GET",url:"/roulette_bet.php",data:{credits:credits,choice:choice,user_token:$("#user_token").val()},success:function(text){button.prop('disabled',false).html(buttonHTML);if(text=='errorCredits'){needCredits();}else if(text=='errorValue'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_MAXIMUM_BET'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('TOO_MANY_BETS'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorTimer'){swal({title:phraser('ERROR'),html:phraser('TIMER_IS_CLOSING'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorLastRound'){swal({title:phraser('ERROR'),html:phraser('LAST_ROUND_NOT_FINISHED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorChoiceMultiple'){swal({title:phraser('ERROR'),html:phraser('ERROR_CHOICE_MULTIPLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='success'){updateCredits(-1*credits);}}});});$('body').on('click','.case_contain_view',function(){$(this).hide();$(".case_contain_item").show();});$('body').on('click','.betting_table tr.betting_table_clickable td',function(){var table=$(".betting_table[data-type='"+$(this).parent().parent().parent().attr('data-type')+"']");var firstRow=table.find('tr').first();var thisRow=$(this).parent();var game_id=thisRow.attr('data-id');table.html('<tr>'+firstRow.html()+'</tr><tr>'+thisRow.html()+'</tr>');$("#betting_bets_title, .betting_info").remove();$("#betting_matches_title a").hide();$("#betting_matches_title a:first-of-type").show();$("#betting_matches_title a.selected").show();$.ajax({type:"GET",url:"/betting_load.php",data:{game_id:game_id},success:function(text){table.after(text);}});});$('body').on('click','.betting_switch',function(){var type=$(this).attr('data-type');$(".betting_switch").removeClass('selected');$(this).addClass('selected');if(type=="all"){loadPage("betting.php");return;}
  494. $(".betting_table").hide();$(".betting_table[data-type='"+type+"']").show();});$('body').on('click','.betting_stream_link',function(e){e.stopPropagation();var streamURL=$(this).attr('data-link');var streamWidth=$("#betting_stream_holder").width();var streamHeight=$(window).height()- 50;$("#betting_stream_holder").height(streamHeight).html('<div class="round_info_title" id="betting_bets_title"><a class="betting_hide_stream"><i class="fa fa-compress"></i> '+phraser('HIDE')+'</a><i class="fa fa-video-camera"></i> '+phraser('STREAM')+'</div><iframe src="'+streamURL+'" id="betting_stream_iframe" height="'+(streamHeight-35)+'" allowfullscreen></iframe>').show();});$('body').on('click','.betting_hide_stream',function(){$("#betting_stream_holder").html('').hide();});$('body').on('click','.buy_coins_item[data-id]',function(){var buy_item_id=$(this).attr('data-id');$.ajax({type:"GET",url:"/buy_process.php",data:{buy_item_id:buy_item_id},success:function(text){if(text=='errorItem'){swal({title:phraser('ERROR'),html:phraser('ITEM_WAS_NOT_FOUND'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorSteamLevel'){swal({title:phraser('ERROR'),html:phraser('STEAM_LEVEL_TOO_LOW_NEW'),type:'error',confirmButtonText:phraser('OKAY')});}else{var json=JSON.parse(text);if(json.success==true){window.location=json.url;}else{swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}}}});});$('body').on('click','.provably_fair_game',function(){$(".provably_fair_content").hide();$(this).next('.provably_fair_content').show();});$('body').on('submit',".betting_comment",function(e){e.preventDefault();var message=$("#betting_message_textarea").val();var game_id=$("#betting_game_id").val();$("#betting_message_textarea").val('');$("#betting_message_send").prop('disabled',true).css("background-color","#2d2d2d");$.ajax({type:"POST",url:"/betting_message.php",data:{message:message,game_id:game_id},success:function(text){if(text=="errorSpam"){swal({title:phraser('ERROR'),html:phraser('SPAMMING_CHAT'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else{$.ajax({type:"GET",url:"/betting_load.php",data:{game_id:game_id},success:function(text){$(".betting_table").next('.row').remove();$(".betting_table").after(text);}});}
  495. $("#betting_message_send").prop('disabled',false).css("background-color","#e69b23");}});});$('body').on('click','#admin_give_token_submit',function(e){var user_id=$(this).attr('data-id');var jukebox=$("#admin_give_token_jukebox").val();var safebox=$("#admin_give_token_safebox").val();var scratchy=$("#admin_give_token_scratchy").val();var case_id=$("#admin_give_token_case_id").val();$("#admin_response").html('<div class="loader_small"></div>');$.ajax({type:"GET",url:"/admin_save.php",data:{user_id:user_id,give_tokens:true,jukebox:jukebox,safebox:safebox,scratchy:scratchy,case_id:case_id},success:function(text){adminLoadUser(user_id);}});});$('body').on('click','#entry_join',function(e){$(this).html('<div class="loader_small" style="margin-top:8px;"></div>');var giveaway_id=$(this).attr('data-id');var page=$(this).attr('data-page');$.ajax({type:"GET",url:"/giveaway_bet.php",data:{enter:true,giveaway_id:giveaway_id,type:'join'},success:function(text){if(text=='errorFinished'){swal({title:phraser('ERROR'),html:phraser('NO_OPEN_GIVEAWAY_WAS_FOUND'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorPlaytime'){swal({title:phraser('ERROR'),html:phraser('RECRUIT_ERROR_PLAYTIME'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorSteamLevel'){swal({title:phraser('ERROR'),html:phraser('STEAM_LEVEL_TOO_LOW_NEW'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorEntry'){swal({title:phraser('ERROR'),html:phraser('YOU_HAVE_ALREADY_ENTERED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorName'){swal({title:phraser('ERROR'),html:phraser('GIVEAWAY_NEED_NAME'),type:'error',confirmButtonText:phraser('OKAY')});}
  496. loadPage(page+".php");}});});$('body').on('click','.entries',function(e){e.stopPropagation();$(this).html('<div class="loader_small" style="margin-top:8px;"></div>');var giveaway_id=$(this).attr('data-id');var type=$(this).attr('data-type');var url=$(this).attr('data-url');var page=$(this).attr('data-page');var popup=window.open(url,'_blank','height=500,width=500,toolbar=0,location=0,menubar=0');var closeCheck=setInterval(function(){if(popup==null||popup.closed){clearInterval(closeCheck);onWindowClosed();}},500);var onWindowClosed=function(){$.ajax({type:"GET",url:"/giveaway_entries.php",data:{enter:true,giveaway_id:giveaway_id,type:type},success:function(text){if(text=='errorFinished'){swal({title:phraser('ERROR'),html:phraser('NO_OPEN_GIVEAWAY_WAS_FOUND'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorEntry'){swal({title:phraser('ERROR'),html:phraser('YOU_HAVE_ALREADY_ENTERED'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorComplete'){swal({title:phraser('ERROR'),html:phraser('TASK_NOT_COMPLETE'),type:'error',confirmButtonText:phraser('OKAY')});}
  497. loadPage(page+".php");}});}});$('body').on('submit','#betting_edit_teams',function(e){e.preventDefault();var game_id=$(this).attr('data-id');var home=$("#betting_edit_teams_home").val();var away=$("#betting_edit_teams_away").val();$.ajax({type:"GET",url:"/admin_save.php",data:{betting_edit_teams:true,game_id:game_id,home:home,away:away},success:function(text){loadPage("betting.php");}});});$('body').on('submit','#revolver_form',function(e){e.preventDefault();$("#revolver_form button").prop('disabled',true).html('<div class="loader_small" style="width: 18px;height: 18px;margin: 2px auto;"></div>');var value=$("#revolver_value").val();$.ajax({type:"GET",url:"/revolver_bet.php",data:{credits:value,user_token:$("#user_token").val()},success:function(text){$("#revolver_form button").prop('disabled',false).html(phraser('BET'));if(text=='errorCredits'){needCredits();}else if(text=='errorMin'){swal({title:phraser('ERROR'),html:phraser('MINIMUM_BET_SMALL'),type:'error',confirmButtonText:phraser('ERROR')});}else if(text=='errorAction'){swal({title:phraser('ERROR'),html:phraser('ACTION_NOT_AVAILABLE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorBets'){swal({title:phraser('ERROR'),html:phraser('ALREADY_IN_QUEUE'),type:'error',confirmButtonText:phraser('OKAY')});}else if(text=='errorCooldown'){swal({title:phraser('ERROR'),html:phraser('REVOLVER_IS_COOLING_DOWN'),type:'error',confirmButtonText:phraser('OKAY')});}else{updateCredits(-1*value);}}});});});
Add Comment
Please, Sign In to add comment