☰

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,才能安裝此樣式

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

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

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

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

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