Knolix Auto Tree Clicker

Click on BTCTREE and reload page

当前为 2025-07-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         Knolix Auto Tree Clicker
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Click on BTCTREE and reload page
// @author       Rubystance
// @license      MIT
// @match        https://knolix.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function findClickableBitcoin() {
        const bitcoinImages = document.querySelectorAll('#btctree img');
        return Array.from(bitcoinImages).find(img => {
            const rect = img.getBoundingClientRect();
            return rect.width >= 59 && rect.height >= 59;
        });
    }

    function clickBitcoinAndGoHome() {
        const bitcoin = findClickableBitcoin();
        if (bitcoin) {
            console.log('[Knolix] BTCTREE found. Clicking...');
            bitcoin.click();

            setTimeout(() => {
                const homeButton = document.querySelector('a.navlink.w-nav-link');
                if (homeButton) {
                    console.log('[Knolix] Clicking on home...');
                    homeButton.click();
                } else {
                    console.warn('[Knolix] Home button not found.');
                }
            }, 3000);
        } else {
            console.log('[Knolix] No BTCTREE found. Reloading in 60 seconds...');
            setTimeout(() => {
                console.log('[Knolix] Reloading page...');
                location.reload();
            }, 60000);
        }
    }

    window.addEventListener('load', () => {
        setTimeout(clickBitcoinAndGoHome, 3000);
    });
})();