☰

MineFun.io Fake Infinite Items Toggle

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
})();