🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Moomoo.io New cyan color

Adds a new cyan color to the color selection panel

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name Moomoo.io New cyan color
// @author Murka
// @description Adds a new cyan color to the color selection panel
// @icon https://moomoo.io/img/favicon.png?v=1
// @version 0.3
// @match *://moomoo.io/*
// @match *://*.moomoo.io/*
// @run-at document-start
// @grant none
// @license MIT
// @namespace https://greasyfork.org/users/919633
// ==/UserScript==
/* jshint esversion:6 */

/*
    Author: Murka
    Github: https://github.com/Murka007
    Discord: https://discord.gg/cPRFdcZkeD
    Greasyfork: https://greasyfork.org/en/users/919633
    MooMooForge: https://github.com/MooMooForge
*/

(function() {
    "use strict";

    const log = console.log;
    const storage = {
        get(key) {
            const value = localStorage.getItem(key);
            return value === null ? null : value;
        },
        set(key, value) {
            localStorage.setItem(key, typeof value !== "string" ? JSON.stringify(value) : value);
        }
    };

    // Unlock 100 resource bonus
    storage.set("moofoll", 1);

    function createHook(target, prop, setter) {
        const symbol = Symbol(prop);
        Object.defineProperty(target, prop, {
            get() {
                return this[symbol];
            },
            set(value) {
                setter(this, symbol, value);
            },
            configurable: true
        })
    }

    // Add cyan color to the skinColor array
    createHook(Object.prototype, "skinColors", function(that, symbol, value) {
        delete Object.prototype.skinColors;
        that.skinColors = [...value, "#91B2DB"];
    })

    // When choosing a color, replace index with "toString", so server will cause some error that will make your color cyan
    createHook(window, "selectSkinColor", function(that, symbol, value) {
        delete window.selectSkinColor;
        window.selectSkinColor = new Proxy(value, {
            apply(target, _this, args) {
                const [ skin ] = args;
                target.call(_this, skin === 10 ? "toString" : skin);

                storage.set("skinColor", skin);
                if (skin === 10) {
                    const skins = document.querySelectorAll("#skinColorHolder > *");
                    const last = skins[skins.length-1];
                    last.classList.add("activeSkin");
                }
            }
        })
    })

    // Select saved color on the load
    window.addEventListener("load", function() {
        const observer = new MutationObserver(mutations => {
            observer.disconnect();
            for (const mutation of mutations) {
                const index = storage.get("skinColor") || 0;
                mutation.addedNodes[index].click();
            }
        })
        observer.observe(document.querySelector("#skinColorHolder"), { childList: true, subtree: true });
    })

})();