白兔大转盘

点击开始按钮后每3秒访问网址以进行抽奖

  1. // ==UserScript==
  2. // @name 白兔大转盘
  3. // @version 1.0
  4. // @author P
  5. // @icon https://club.hares.top/favicon.ico
  6. // @description 点击开始按钮后每3秒访问网址以进行抽奖
  7. // @match https://club.hares.top/lucky-wheel.php
  8. // @license MIT
  9. // @grant GM_xmlhttpRequest
  10. // @namespace http://tampermonkey.net/
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 初始化奖项计数器
  17. let prizeCounts = {
  18. '参与奖': 0,
  19. '六等奖': 0,
  20. '五等奖': 0,
  21. '四等奖': 0,
  22. '三等奖': 0,
  23. '二等奖': 0,
  24. '一等奖': 0
  25. };
  26. let isDrawing = false; // 是否正在抽奖的标志
  27.  
  28. // 创建显示计数的提示框
  29. const counterBox = document.createElement('div');
  30. counterBox.style.position = 'fixed';
  31. counterBox.style.top = '10px';
  32. counterBox.style.right = '10px';
  33. counterBox.style.padding = '10px';
  34. counterBox.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
  35. counterBox.style.color = 'white';
  36. counterBox.style.borderRadius = '5px';
  37. counterBox.style.zIndex = '9999';
  38. counterBox.style.fontSize = '14px';
  39. document.body.appendChild(counterBox);
  40.  
  41. // 更新提示框内容
  42. function updateCounterBox() {
  43. counterBox.innerHTML = '奖项计数:<br>';
  44. for (const [prize, count] of Object.entries(prizeCounts)) {
  45. counterBox.innerHTML += `${prize}: ${count}<br>`;
  46. }
  47. }
  48.  
  49. // 请求抽奖接口并更新奖项计数
  50. function fetchPrizeData() {
  51. if (!isDrawing) return;
  52.  
  53. const apiUrl = 'https://club.hares.top/api/general?action=wheel';
  54.  
  55. fetch(apiUrl, {
  56. method: 'GET',
  57. headers: {
  58. 'Authorization': 'Bearer undefined',
  59. 'x-requested-with': 'XMLHttpRequest'
  60. }
  61. })
  62. .then(response => response.json())
  63. .then(data => {
  64. const rid = data.rid;
  65.  
  66. // 根据rid更新奖项计数
  67. switch (rid) {
  68. case 0:
  69. prizeCounts['参与奖']++;
  70. break;
  71. case 6:
  72. prizeCounts['六等奖']++;
  73. break;
  74. case 5:
  75. prizeCounts['五等奖']++;
  76. break;
  77. case 4:
  78. prizeCounts['四等奖']++;
  79. break;
  80. case 3:
  81. prizeCounts['三等奖']++;
  82. break;
  83. case 2:
  84. prizeCounts['二等奖']++;
  85. break;
  86. case 1:
  87. prizeCounts['一等奖']++;
  88. break;
  89. default:
  90. console.error('未知的奖项ID:', rid);
  91. }
  92.  
  93. // 更新提示框
  94. updateCounterBox();
  95. })
  96. .catch(error => {
  97. console.error('请求抽奖接口失败:', error);
  98. });
  99. }
  100.  
  101. // 创建控制按钮
  102. const startButton = document.createElement('button');
  103. startButton.innerHTML = '开始抽奖';
  104. startButton.style.position = 'fixed';
  105. startButton.style.top = '350px';
  106. startButton.style.right = '10px';
  107. startButton.style.padding = '10px';
  108. startButton.style.zIndex = '9999';
  109. startButton.onclick = function() {
  110. if (!isDrawing) {
  111. isDrawing = true;
  112. startButton.innerHTML = '抽奖中...';
  113. }
  114. };
  115. document.body.appendChild(startButton);
  116.  
  117. const stopButton = document.createElement('button');
  118. stopButton.innerHTML = '停止抽奖';
  119. stopButton.style.position = 'fixed';
  120. stopButton.style.top = '400px';
  121. stopButton.style.right = '10px';
  122. stopButton.style.padding = '10px';
  123. stopButton.style.zIndex = '9999';
  124. stopButton.onclick = function() {
  125. isDrawing = false;
  126. startButton.innerHTML = '开始抽奖';
  127. };
  128. document.body.appendChild(stopButton);
  129.  
  130. // 每3秒请求一次抽奖接口
  131. setInterval(fetchPrizeData, 3000);
  132.  
  133. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址