click_script.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. var script_1710385880 = {};
  2. script_1710385880.bet_hi = false;
  3. script_1710385880.working = false;
  4. script_1710385880.lose_series = 0;
  5. script_1710385880.last_number = '';
  6. script_1710385880.state = 0;
  7. script_1710385880.tick_state;
  8. script_1710385880.timer_time = 500; // 0.5 sec
  9. script_1710385880.timerId;
  10. function qi(name){ return document.getElementById(name); }
  11. function simulateMouseClick(el){
  12. //const MouseEvents = ['mousedown', 'focusin'];
  13. const MouseEvents = ['click'];
  14. MouseEvents.forEach(eventType =>
  15. el.dispatchEvent(
  16. new MouseEvent(eventType, { bubbles: true })
  17. )
  18. );
  19. }
  20. script_1710385880.randomInteger = function(min, max){
  21. let rand = min + Math.random() * (max + 1 - min);
  22. return Math.floor(rand);
  23. }
  24. script_1710385880.started = function(){
  25. script_1710385880.working = true;
  26. script_1710385880.state = 1;
  27. qi('script_1710385880_btn').classList.add('working');
  28. console.log('started');
  29. };
  30. script_1710385880.stopped = function(){
  31. clearTimeout(script_1710385880.timerId);
  32. qi('script_1710385880_btn').classList.remove('working');
  33. script_1710385880.working = false;
  34. script_1710385880.state = 0;
  35. script_1710385880.series = 0;
  36. script_1710385880.timer_time = 500; // set default
  37. console.log('stopped');
  38. };
  39. // check maybe result already exists
  40. script_1710385880.maybe_result = function(){
  41. var maybe_new_num = qi('multiplier_first_digit').value + qi('multiplier_second_digit').value +
  42. qi('multiplier_third_digit').value + qi('multiplier_fourth_digit').value + qi('multiplier_fifth_digit').value;
  43. if(maybe_new_num !== script_1710385880.last_number){
  44. // got result
  45. script_1710385880.last_number = maybe_new_num;
  46. var maybe_win = ( qi('double_your_btc_bet_win').style.display === 'block' );
  47. var maybe_loose = ( qi('double_your_btc_bet_lose').style.display === 'block' );
  48. if(maybe_win){
  49. script_1710385880.lose_series = 0;
  50. var was_min = ( qi('double_your_btc_stake').value !== '0.00000001' );
  51. if(was_min){ script_1710385880.state = 1; return } // click BET AMOUNT = MIN
  52. script_1710385880.state = 3; // go click bet
  53. }else if(maybe_loose){
  54. if(script_1710385880.lose_series > 6){ console.log('lose_series = ', script_1710385880.lose_series); }
  55. script_1710385880.lose_series = script_1710385880.lose_series + 1;
  56. script_1710385880.state = 2; // click BET AMOUNT = 2x // next go click bet
  57. }else{ script_1710385880.state = 3; } // 1st bet
  58. } // else do nothing -- waiting for result
  59. };
  60. script_1710385880.do_start_stop = function(){
  61. if(script_1710385880.working){ script_1710385880.stopped(); return }
  62. script_1710385880.started();
  63. script_1710385880.tick_state = function(){
  64. var bet_btn = (script_1710385880.bet_hi) ? qi('double_your_btc_bet_hi_button') : qi('double_your_btc_bet_lo_button');
  65. if(script_1710385880.state === 0){
  66. // just stopped
  67. // do nothing
  68. }else if(script_1710385880.state === 1){
  69. // set bet amount 1 satoshi = 0.00000001
  70. simulateMouseClick( qi('double_your_btc_min') );
  71. script_1710385880.state = 3;
  72. script_1710385880.timer_time = 300;
  73. }else if(script_1710385880.state === 2){
  74. // double bet amount
  75. simulateMouseClick( qi('double_your_btc_2x') );
  76. script_1710385880.state = 3;
  77. script_1710385880.timer_time = 300;
  78. }else if(script_1710385880.state === 3){
  79. // click bet lo
  80. simulateMouseClick(bet_btn);
  81. script_1710385880.state = 4;
  82. script_1710385880.timer_time = script_1710385880.randomInteger(1000, 3000); // wait 1-3 sec
  83. }else if(script_1710385880.state === 4){
  84. // wait for bet result - check is result exists and maybe wait more
  85. script_1710385880.timer_time = 300;
  86. script_1710385880.maybe_result();
  87. }
  88. if(script_1710385880.state !== 0){ script_1710385880.timerId = setTimeout(script_1710385880.tick_state, script_1710385880.timer_time); }
  89. };
  90. if(script_1710385880.state !== 0){ script_1710385880.timerId = setTimeout(script_1710385880.tick_state, script_1710385880.timer_time); }
  91. };
  92. script_1710385880.do_bind_scripts = function(){
  93. // add start/stop btn -- blue shadows = not working, green shadows = working
  94. document.head.insertAdjacentHTML('beforeend',`<style>div#script_1710385880_btn{display:block;position:fixed;width:55px;height:55px;top:130px;right:175px;cursor:pointer;z-index:777;border-radius:10px;border:1px solid gray;box-shadow: 5px 5px 5px #0559b3;background-color:#fff;background-repeat:no-repeat;background-position:50% center;background-size:35px 35px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M440.5 88.5l-52 52L415 167c9.4 9.4 9.4 24.6 0 33.9l-17.4 17.4c11.8 26.1 18.4 55.1 18.4 85.6 0 114.9-93.1 208-208 208S0 418.9 0 304 93.1 96 208 96c30.5 0 59.5 6.6 85.6 18.4L311 97c9.4-9.4 24.6-9.4 33.9 0l26.5 26.5 52-52 17.1 17zM500 60h-24c-6.6 0-12 5.4-12 12s5.4 12 12 12h24c6.6 0 12-5.4 12-12s-5.4-12-12-12zM440 0c-6.6 0-12 5.4-12 12v24c0 6.6 5.4 12 12 12s12-5.4 12-12V12c0-6.6-5.4-12-12-12zm33.9 55l17-17c4.7-4.7 4.7-12.3 0-17-4.7-4.7-12.3-4.7-17 0l-17 17c-4.7 4.7-4.7 12.3 0 17 4.8 4.7 12.4 4.7 17 0zm-67.8 0c4.7 4.7 12.3 4.7 17 0 4.7-4.7 4.7-12.3 0-17l-17-17c-4.7-4.7-12.3-4.7-17 0-4.7 4.7-4.7 12.3 0 17l17 17zm67.8 34c-4.7-4.7-12.3-4.7-17 0-4.7 4.7-4.7 12.3 0 17l17 17c4.7 4.7 12.3 4.7 17 0 4.7-4.7 4.7-12.3 0-17l-17-17zM112 272c0-35.3 28.7-64 64-64 8.8 0 16-7.2 16-16s-7.2-16-16-16c-52.9 0-96 43.1-96 96 0 8.8 7.2 16 16 16s16-7.2 16-16z'/%3E%3C/svg%3E");}div#script_1710385880_btn.working{box-shadow: 5px 5px 5px #2de03b}</style>`);
  95. var div = document.createElement('div');
  96. div.id = 'script_1710385880_btn';
  97. div.setAttribute('title', 'Start / Stop');
  98. document.body.appendChild(div);
  99. qi('disable_animation_checkbox').checked = true;
  100. qi('manual_enable_sounds').checked = true;
  101. qi('script_1710385880_btn').addEventListener('click', script_1710385880.do_start_stop);
  102. }