Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Here You can type your custom JavaScript...
- $( document ).ready(function() {
- var minutes = 30;
- var seconds = 0;
- 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;'> </div></div>";
- $("#sidebar").html("");
- $("#sidebar").append(panelstring);
- var betplaced = false;
- var bettoplace = "red";
- var lastbetstring = "";
- var rolled = false;
- var round = 1;
- var lastround = 1;
- var betamount = 10;
- var currmoney = 0;
- var lastmoney = 0;
- var lastbet = 0;
- var lastres = "none";
- var betdiv;
- setInterval(countdown,1000);
- setInterval(check,2000);
- function check() {
- var status = $(".message").first().text();
- if (status.indexOf("Rolling in") != -1) {
- if (betplaced == false) {
- var betnumber = Math.floor(Math.random()*3+1);
- switch(betnumber) {
- case 1:
- bettoplace = "red";
- betdiv = $(".btn-bet.red").first();
- break;
- case 2:
- bettoplace = "black";
- betdiv = $(".btn-bet.black").first();
- break;
- case 3:
- if (lastbetstring != "green") {
- bettoplace = "green";
- betdiv = $(".btn-bet.green").first();
- }
- break;
- default:
- bettoplace = "red";
- betdiv = $(".btn-bet.red").first();
- }
- console.log("BetNumber:" + betnumber + " - " + bettoplace);
- var betamountinput = $("input[name='amount']");
- lastmoney = currmoney;
- console.log("Betting for " + betamount);
- $("#status").html("Betting " + bettoplace + " for " + betamount);
- var c = ".";
- c = c.concat(bettoplace);
- if (betplaced == false) {
- betamountinput.val(betamount);
- betdiv.click();
- betplaced = true;
- lastbetstring = bettoplace;
- }
- } else {
- $("#status").html("Bet placed");
- currmoney = $(".balance .symbol").first().text().replace(/,/g, '');
- $("#currentmoney").html(currmoney);
- }
- } else if (status.indexOf("Drawing") != -1) {
- $("#status").html("Rolling");
- $("#lastmoneyspan").html(lastmoney);
- rolled = true;
- lastmoney = currmoney;
- } else if ((status.indexOf("Winner:") != -1) && (rolled == true)) {
- rolled = true;
- currmoney = $(".balance .symbol").first().text().replace(/,/g, '');
- $("currentmoney").html(currmoney);
- $("#lastbet").html(betamount);
- lastbet = betamount;
- if ((currmoney > lastmoney) && (lastmoney > 0)) {
- betamount = 10;
- lastres = "won";
- } else {
- betamount = Math.round(betamount * 2.25);
- lastres = "lost";
- }
- $("#status").html("Rolled - " + lastres);
- $("#lastres").html(lastres);
- var resstring = "";
- if (lastres == "won") {
- resstring = "<span style='color: green;'>Won</span>";
- } else {
- resstring = "<span style='color: red;'>Lost</span>";
- }
- $("#history").prepend("<p>Bet: <span style='display: inline-block; width: 20px; height: 20px; line-height: 20px; background: " + bettoplace + ";'>" + lastbet + "</span> - " + resstring + "</p>");
- betplaced = false;
- rolled = false;
- round++;
- }
- }
- function countdown() {
- if (seconds < 1) {
- if ((minutes == 0) && (seconds < 1)) {
- location.reload();
- }
- seconds = 60;
- minutes--;
- $("#refreshm").html(minutes);
- }
- seconds--;
- $("#refreshs").html(seconds);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement