☰

MineFun.io Fake Infinite Items Toggle

Fake ∞ items + toggle on/off bằng hover chuột (chỉ visual, không hack thật)

スクリプトをインストールするには、Tampermonkey, Greasemonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、 Tampermonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、Tampermonkey や Violentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、Tampermonkey や Userscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら、通報はこちらへお寄せください
// ==UserScript==
// @name         MineFun.io Fake Infinite Items Toggle
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Fake ∞ items + toggle on/off bằng hover chuột (chỉ visual, không hack thật)
// @author       You
// @match        https://minefun.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let isInfinite = false;
    let toggleButton = null;
    let interval = null;

    function createToggleButton() {
        if (toggleButton) return;

        toggleButton = document.createElement('div');
        toggleButton.innerHTML = '∞ ITEMS: OFF';
        toggleButton.style.position = 'fixed';
        toggleButton.style.top = '10px';
        toggleButton.style.right = '10px';
        toggleButton.style.background = '#222';
        toggleButton.style.color = 'white';
        toggleButton.style.padding = '10px 15px';
        toggleButton.style.borderRadius = '8px';
        toggleButton.style.cursor = 'pointer';
        toggleButton.style.zIndex = '99999';
        toggleButton.style.fontFamily = 'Arial, sans-serif';
        toggleButton.style.userSelect = 'none';
        toggleButton.style.border = '2px solid #444';

        document.body.appendChild(toggleButton);

        // Toggle khi click
        toggleButton.addEventListener('click', () => {
            isInfinite = !isInfinite;
            updateButton();
            if (isInfinite) {
                startFakeInfinite();
            } else {
                stopFakeInfinite();
            }
        });

        // Hoặc hover để bật/tắt nhanh (như yêu cầu)
        let hoverTimeout;
        toggleButton.addEventListener('mouseenter', () => {
            hoverTimeout = setTimeout(() => {
                isInfinite = true;
                updateButton();
                startFakeInfinite();
            }, 400); // hover 0.4 giây thì bật
        });

        toggleButton.addEventListener('mouseleave', () => {
            clearTimeout(hoverTimeout);
            // Nếu muốn tắt khi rời chuột thì uncomment dòng dưới
            // isInfinite = false;
            // updateButton();
            // stopFakeInfinite();
        });
    }

    function updateButton() {
        if (!toggleButton) return;
        toggleButton.innerHTML = `∞ ITEMS: ${isInfinite ? 'ON' : 'OFF'}`;
        toggleButton.style.background = isInfinite ? '#d32f2f' : '#222';
        toggleButton.style.borderColor = isInfinite ? '#f44336' : '#444';
    }

    function startFakeInfinite() {
        if (interval) return;

        interval = setInterval(() => {
            // Tìm các số lượng item trong inventory (thay đổi tùy phiên bản game)
            document.querySelectorAll('div[class*="amount"], span[class*="count"], div[class*="quantity"]')
                .forEach(el => {
                    if (el.textContent.match(/^\d+$/)) {
                        el.textContent = '∞';
                        el.style.color = '#ffeb3b';
                        el.style.fontWeight = 'bold';
                    }
                });

            // Thử đổi số coin / tiền nếu có
            document.querySelectorAll('div[class*="coin"], span[class*="money"], div[class*="balance"]')
                .forEach(el => {
                    if (el.textContent.match(/\d+/)) {
                        el.textContent = '∞';
                        el.style.color = '#4caf50';
                    }
                });
        }, 800);
    }

    function stopFakeInfinite() {
        if (interval) {
            clearInterval(interval);
            interval = null;
        }
        // Có thể reset lại số về giá trị thật nếu muốn, nhưng khó vì không biết giá trị gốc
    }

    // Chờ game load
    const observer = new MutationObserver(() => {
        if (document.body) {
            createToggleButton();
        }
    });

    observer.observe(document.documentElement || document.body, { childList: true, subtree: true });

    // Thử chạy ngay
    setTimeout(createToggleButton, 3000);
})();