tieba.time_gift.click

自动点击在线时间奖励

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        tieba.time_gift.click
// @namespace   clumsyman
// @description 自动点击在线时间奖励
// @include     http://tieba.baidu.com/p/*
// @include     http://tieba.baidu.com/p?*
// @include     http://tieba.baidu.com/f/*
// @include     http://tieba.baidu.com/f?*
// @version     1
// ==/UserScript==

var name = "在线时间奖励";
var unit = "条";
var selector = "a.time_gift.unopen_gift";

function detect() {
    var nodes = document.querySelectorAll(selector);
    if (nodes) {
        switch(nodes.length) {
            case 0:
                console.log("未能在页面上找到"+name);
                break;
            case 1:
                console.log("自动点击找到的1"+unit+name+"……");
                nodes[0].click();
                break;
            default:
				var error = "在页面上找到"+nodes.length+unit+name+"。";
                console.error(error);
                alert(error);
                break;
        }
    }
}

detect();
var container = document.querySelector('.time_keeper');
var observer = new MutationObserver(detect);
observer.observe(container, { childList: true, subtree: true });