Greasy Fork

Greasy Fork is available in English.

虎牙TV领取宝箱

虎牙TV自动领取宝箱,带桌面提示(请先设置允许通知)

当前为 2020-02-15 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         虎牙TV领取宝箱
// @namespace    https://1silencer.github.io/
// @version      1.2.4
// @description  虎牙TV自动领取宝箱,带桌面提示(请先设置允许通知)
// @author       Silencer
// @match        *://www.huya.com/*
// @icon         https://www.huya.com/favicon.ico
// ==/UserScript==

// 每5秒检测一次,可调整,过快会影响浏览器性能
let time = 5;
// 领取完宝箱是否自动关闭页面,1是自动关闭,默认为0,不关闭
let autoClose = 0;
Notification.requestPermission()
setInterval(() => {
    let btns = document.querySelectorAll('.player-box-stat3');
    for (let i = 0; i < btns.length; i++) {
        if (btns[i].style.visibility == "visible") {
            btns[i].click();
            document.querySelector("#player-box").style.display = "none";
            new Notification('虎牙TV', {
                body: `已领取第${i+1}个宝箱`,
                icon: 'https://www.huya.com/favicon.ico'
            });
            if (i == 5 && autoClose) {
                close()
            }
        }
    }
}, time * 1000);