auto wof

自动大转盘

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        auto wof
// @namespace   Violentmonkey Scripts
// @match       https://cf.hdkylin.com/wof.php
// @match       https://www.hdkyl.in/wof.php
// @grant       none
// @version     0.0.2
// @author      Exception
// @description 自动大转盘
// @license MIT
// ==/UserScript==

(function () {

    var host = window.location.host;

    if (sessionStorage.getItem('confirm') != 'ok') {
        if (confirm("确定要执行操作吗?")) {
            sessionStorage.setItem('confirm', 'ok');
        } else {
            window.location.assign('https://' + host)
        }
    }

    var wait = ms => new Promise(resolve => setTimeout(resolve, ms))

    if (window.location.href.indexOf('https://' + host + '/wof.php') == 0) {
        wait(5000).then(() => {
          var newWindow = window.open('https://' + host + '/wof/ajax_chs.php?app=lottery_json', '_blank'); // 替换为你想要打开的网址

          // 等待1秒后尝试关闭窗口
          if (newWindow) {
              setTimeout(function() {
                  try {
                      // 尝试关闭窗口
                      newWindow.close();
                  } catch (e) {
                      // 浏览器可能会阻止关闭,所以这里什么都不会发生
                      console.error('无法关闭窗口:', e);
                  }
                location.reload();
              }, 1000); // 1秒后尝试关闭
          }

        });
    }

    var timer1 = setInterval(function () {
        // 查找具有 class="layui-layer-btn0" 的元素
        var element = document.querySelector('.layui-layer-btn0');
        if (element) {
            // 如果找到了元素
            clearInterval(timer1);
            $(element).click();
        }
    }, 2000);
})();