auto wof

自动大转盘

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
})();