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 running = false;
- var status = "idle";
- var round = 1;
- var lastround = 0;
- var roundfinished = false;
- var statusbox = "<div style='width:100%; height:500px; background:gray;text-align: center; padding:15px;'>Status: <span class='bhstatus'>Running</span> <br />Last results: <br /><div><ul style='list-decoration: none;' id='lresults'> </ul></div></div>";
- var blankpage = "<IFRAME style='display:none' id='hidden-form'></IFRAME>";
- var settings = "<div style='height: 300px; background: gray; padding: 15px; text-align:center'><h4>Settings</h4><p class='mainstatus'>Status - <span class='bhstatus'>Stopped</span></p><button style='display: block; width: 100px; height: 50px; margin: 10px auto; background: #666;' id='startbtn'>Start</button><p class='wallet'>Wallet: <span id='walletamount'>-</span></p></div>";
- $("#sidebar").html(statusbox);
- //$(statusbox).insertBefore("#roulette");
- $(blankpage).insertBefore("#roulette");
- $(settings).insertBefore("#roulette")
- var timer;
- function checkStatus() {
- var statustxt = $(".roulette-text .message").text();
- if (statustxt.indexOf("Drawing!") != -1) {
- roundfinished = false;
- $(".bhstatus").text("Drawing..");
- } else if (statustxt.indexOf("Rolling in") != -1) {
- $(".bhstatus").text("Waiting..");
- roundfinished = false;
- } else if ((statustxt.indexOf("Winner:") != -1) && (!roundfinished) && (round > lastround)) {
- setTimeout(function() {
- var lastres = $(".history .list").children().last().text();
- var color;
- lastround = round;
- round++;
- roundfinished = true;
- if (lastres <= 7 && lastres > 0) {
- color = "red";
- } else if (lastres > 7) {
- color = "black";
- } else if (lastres < 1) {
- color = "green";
- }
- var date = new Date();
- var datestr = date.getDay() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
- $("#lresults").prepend("<li><p style='display: inline-block;margin: 0;background: darkgray;padding: 10px;float: left;width: 80%;border-bottom: 1px solid #666;'>" + datestr + "</p><p style='display: inline-block;margin: 0 ;float: right;padding: 15px;width: 20%;height: 35px;font-size: 20px;line-height: 5px;background: " + color + ";'>" + lastres + "</p></li>");
- $(".bhstatus").text("Round " + round + " result: " + lastres);
- $("#hidden-form").load("https://prech.info/resultsave.php?result=" + lastres);
- }, 500);
- }
- }
- function togglebtn() {
- var btn = $("#startbtn");
- if (btn.html() == "Start") {
- console.log("Starting");
- $(".bhstatus").text("Starting..");
- timer = setInterval(checkStatus, 1000);
- btn.html("Stop");
- } else {
- console.log("Stopping");
- btn.html("Start");
- clearInterval(timer);
- $(".bhstatus").text("Stopped..");
- }
- }
- $("#startbtn").click(function() {
- togglebtn();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement