auto wof

自动大转盘

  1. // ==UserScript==
  2. // @name auto wof
  3. // @namespace Violentmonkey Scripts
  4. // @match https://cf.hdkylin.com/wof.php
  5. // @match https://www.hdkyl.in/wof.php
  6. // @grant none
  7. // @version 0.0.2
  8. // @author Exception
  9. // @description 自动大转盘
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14.  
  15. var host = window.location.host;
  16.  
  17. if (sessionStorage.getItem('confirm') != 'ok') {
  18. if (confirm("确定要执行操作吗?")) {
  19. sessionStorage.setItem('confirm', 'ok');
  20. } else {
  21. window.location.assign('https://' + host)
  22. }
  23. }
  24.  
  25. var wait = ms => new Promise(resolve => setTimeout(resolve, ms))
  26.  
  27. if (window.location.href.indexOf('https://' + host + '/wof.php') == 0) {
  28. wait(5000).then(() => {
  29. var newWindow = window.open('https://' + host + '/wof/ajax_chs.php?app=lottery_json', '_blank'); // 替换为你想要打开的网址
  30.  
  31. // 等待1秒后尝试关闭窗口
  32. if (newWindow) {
  33. setTimeout(function() {
  34. try {
  35. // 尝试关闭窗口
  36. newWindow.close();
  37. } catch (e) {
  38. // 浏览器可能会阻止关闭,所以这里什么都不会发生
  39. console.error('无法关闭窗口:', e);
  40. }
  41. location.reload();
  42. }, 1000); // 1秒后尝试关闭
  43. }
  44.  
  45. });
  46. }
  47.  
  48. var timer1 = setInterval(function () {
  49. // 查找具有 class="layui-layer-btn0" 的元素
  50. var element = document.querySelector('.layui-layer-btn0');
  51. if (element) {
  52. // 如果找到了元素
  53. clearInterval(timer1);
  54. $(element).click();
  55. }
  56. }, 2000);
  57. })();