Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. // Here You can type your custom JavaScript...
  2.  
  3. $( document ).ready(function() {
  4.  
  5. var minutes = 30;
  6. var seconds = 0;
  7.  
  8. var panelstring = "<div class='online-info' style='position: initial; display: block; margin: 0 auto; width: 225px;'><p id='refresh'>Refresh in: <span style='color: #fff;'><span id='refreshm'>0</span> minutes <span id='refreshs'>0</span> seconds</span></p><p>Status: <span id='status' style='color:#fff;'>idle</span></p><p>Last bet: <span id='lastbet' style='color: #fff;'>0</span></p><p id='lastresult'>Last round: <span id='lastres' style='color: #fff;'>none</span></p><p id='currmoney'>Current money: <span id='currentmoney' style='color: #fff;'>0</span></p><p id='lastmoney'>Last money: <span id='lastmoneyspan' style='color: #fff;'>0</span></p><div id='history' style='background: #2e2e2e; padding: 15px; max-height: 550px; overflow-y: hidden;'>&nbsp;</div></div>";
  9. $("#sidebar").html("");
  10. $("#sidebar").append(panelstring);
  11.  
  12. var betplaced = false;
  13. var bettoplace = "red";
  14. var lastbetstring = "";
  15. var rolled = false;
  16. var round = 1;
  17. var lastround = 1;
  18. var betamount = 10;
  19. var currmoney = 0;
  20. var lastmoney = 0;
  21. var lastbet = 0;
  22. var lastres = "none";
  23. var betdiv;
  24. setInterval(countdown,1000);
  25. setInterval(check,2000);
  26.  
  27. function check() {
  28. var status = $(".message").first().text();
  29. if (status.indexOf("Rolling in") != -1) {
  30.  
  31. if (betplaced == false) {
  32. var betnumber = Math.floor(Math.random()*3+1);
  33. switch(betnumber) {
  34. case 1:
  35. bettoplace = "red";
  36. betdiv = $(".btn-bet.red").first();
  37. break;
  38. case 2:
  39. bettoplace = "black";
  40. betdiv = $(".btn-bet.black").first();
  41. break;
  42. case 3:
  43. if (lastbetstring != "green") {
  44. bettoplace = "green";
  45. betdiv = $(".btn-bet.green").first();
  46. }
  47. break;
  48. default:
  49. bettoplace = "red";
  50. betdiv = $(".btn-bet.red").first();
  51. }
  52. console.log("BetNumber:" + betnumber + " - " + bettoplace);
  53. var betamountinput = $("input[name='amount']");
  54.  
  55.  
  56. lastmoney = currmoney;
  57.  
  58. console.log("Betting for " + betamount);
  59. $("#status").html("Betting " + bettoplace + " for " + betamount);
  60. var c = ".";
  61. c = c.concat(bettoplace);
  62. if (betplaced == false) {
  63. betamountinput.val(betamount);
  64. betdiv.click();
  65. betplaced = true;
  66. lastbetstring = bettoplace;
  67. }
  68. } else {
  69. $("#status").html("Bet placed");
  70. currmoney = $(".balance .symbol").first().text().replace(/,/g, '');
  71. $("#currentmoney").html(currmoney);
  72. }
  73.  
  74. } else if (status.indexOf("Drawing") != -1) {
  75. $("#status").html("Rolling");
  76. $("#lastmoneyspan").html(lastmoney);
  77. rolled = true;
  78. lastmoney = currmoney;
  79. } else if ((status.indexOf("Winner:") != -1) && (rolled == true)) {
  80. rolled = true;
  81. currmoney = $(".balance .symbol").first().text().replace(/,/g, '');
  82. $("currentmoney").html(currmoney);
  83. $("#lastbet").html(betamount);
  84. lastbet = betamount;
  85. if ((currmoney > lastmoney) && (lastmoney > 0)) {
  86. betamount = 10;
  87. lastres = "won";
  88. } else {
  89. betamount = Math.round(betamount * 2.25);
  90. lastres = "lost";
  91. }
  92. $("#status").html("Rolled - " + lastres);
  93. $("#lastres").html(lastres);
  94. var resstring = "";
  95. if (lastres == "won") {
  96. resstring = "<span style='color: green;'>Won</span>";
  97. } else {
  98. resstring = "<span style='color: red;'>Lost</span>";
  99. }
  100. $("#history").prepend("<p>Bet: <span style='display: inline-block; width: 20px; height: 20px; line-height: 20px; background: " + bettoplace + ";'>" + lastbet + "</span> - " + resstring + "</p>");
  101. betplaced = false;
  102. rolled = false;
  103. round++;
  104. }
  105. }
  106.  
  107. function countdown() {
  108.  
  109. if (seconds < 1) {
  110. if ((minutes == 0) && (seconds < 1)) {
  111. location.reload();
  112. }
  113. seconds = 60;
  114. minutes--;
  115. $("#refreshm").html(minutes);
  116.  
  117. }
  118. seconds--;
  119. $("#refreshs").html(seconds);
  120.  
  121. }
  122.  
  123. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement