斗鱼自动领鱼丸

实现斗鱼自动领鱼丸

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         斗鱼自动领鱼丸
// @version      1.2.1
// @description  实现斗鱼自动领鱼丸
// @author       消失的旅人
// @match        https://www.douyu.com/*
// @grant        none
// @namespace https://greasyfork.org/users/170855
// ==/UserScript==

window.setInterval(function() {
    var nodes = [
      ['yw-countdown', 'may-btn'],
      ['RewardModule-countdown', 'RewardM-text enable']
    ]
    
    for (i = 0; i < nodes.length; i++) {
      var node = nodes[i];
      var time = document.getElementsByClassName(node[0])[0];
      var isClickedRewardNode = document.getElementsByClassName('v3-sign-wrap').length > 0;
      if (!isClickedRewardNode && time && time.textContent.replace(/\s/g, '') === '领取') {
        time.click();
        var rewardNode = document.getElementsByClassName(node[1])[0];
        rewardNode && rewardNode.click();
      }
    }
}, 10000);