Advertisement
MagneticaMusic

Roulette JS Front End

Feb 29th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. if(data.type=="countdown") {
  2. $(window).unbind("beforeunload");
  3. currentCountdown = (data.countdown-1);
  4.  
  5. $("#status").html('Countdown to Roll: <span id="countdown"></span> seconds');
  6. $(".betbtn").prop('disabled', false);
  7. $("#betamt").prop('disabled', false);
  8. $(".determinate").removeClass("red green grey darken-3").addClass("grey");
  9. $(".progress").removeClass("red green grey lighten-1 lighten-4").addClass("grey lighten-4");
  10.  
  11. $("#countdown").text(currentCountdown.toFixed(2));
  12.  
  13. clearInterval(cdInterval);
  14. clearInterval(barInterval);
  15. if(originalCountdown < (data.countdown-1)) {
  16. originalCountdown = (data.countdown-1);
  17. }
  18. cdInterval = setInterval(function() {
  19. currentCountdown-=0.025;
  20. $("#countdown").text(currentCountdown.toFixed(2));
  21. if(currentCountdown <= 0) {
  22. clearInterval(cdInterval);
  23. clearInterval(barInterval);
  24. $("#status").html('Confirming Bets');
  25. if(!$("#mute").is(":checked")){
  26. notify.play();
  27. }
  28. $(".determinate").css("width","0%");
  29. }
  30. },25);
  31. barInterval = setInterval(function() {
  32. $(".determinate").css("width",(currentCountdown/originalCountdown)*100+"%");
  33. }, 10);
  34. }
  35.  
  36. if(data.type=="balance"){
  37. balance = data.balance;
  38. $("#balance").text(numberWithCommas(balance));
  39. }
  40. if(data.type=="updateBalance"){
  41. balance += data.balUpdate;
  42. $("#balance").text(numberWithCommas(balance));
  43. }
  44.  
  45. if(data.type=="betConfirm"){
  46. $(window).bind("beforeunload", confirmLeave);
  47. var color = data.color;
  48. var amount = data.amount;
  49. $("#my-"+data.color+"-bet").text(numberWithCommas(data.amount));
  50. $(".determinate").removeClass("red green grey darken-3").addClass(data.color == "black" ? "grey darken-3" : data.color);
  51. $(".progress").removeClass("red green grey lighten-1 lighten-4").addClass(data.color == "black" ? "grey lighten-1" : data.color + " lighten-4");
  52. $(".betbtn").prop('disabled', false);
  53. $("#betamt").prop('disabled', false);
  54. }
  55.  
  56. if(data.type=="betTotals" && updateTotals) {
  57. for(color in data.bets) {
  58. $("#"+color+"-total").stop().animate({val:data.bets[color]}, {duration:1000, easing:'swing',
  59. step: function(now) {
  60. $(this).text(numberWithCommas(Math.floor(Number(now)+0.5)));
  61. }
  62. });
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement