IdlePixelMobile

A plugin to add mobile styling to idle-pixel.com

目前為 2023-01-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name IdlePixelMobile
// @namespace com.evolsoulx.idlepixel.mobile
// @version 1.0.3
// @description A plugin to add mobile styling to idle-pixel.com
// @author evolsoulx
// @license MIT
// @match *://idle-pixel.com/login/play*
// @grant GM_addStyle
// @require https://greasyfork.org/scripts/441206-idlepixel/code/IdlePixel+.js
// ==/UserScript==
(function() {
        'use strict';

    function GM_addStyle(css) {
  const style = document.getElementById("GM_addStyleBy8626") || (function() {
    const style = document.createElement('style');
    style.type = 'text/css';
    style.id = "mobilestyles";
    document.head.appendChild(style);
    return style;
  })();
  const sheet = style.sheet;
  sheet.insertRule(css, (sheet.rules || sheet.cssRules || []).length);
}


    GM_addStyle(`

#panels{background-color:green !important;}


`);
        class MobilePlugin extends IdlePixelPlusPlugin {
            constructor() {
                super("mobile", {
                    about: {
                        name: GM_info.script.name,
                        version: GM_info.script.version,
                        author: GM_info.script.author,
                        description: GM_info.script.description,
                        grant: GM_info.script.grant
                    },
                    config: [{
                        type: "label",
                        label: "Is this a mobile script?"
                    },
                             {
                                 id: "MyCheckbox",
                                 label: "Yes / No",
                                 type: "boolean",
                                 default: true
                             }
                            ]
                });
            }

            onConfigsChanged() {
            }

            onLogin() {
                console.log("MobilePlugin.onLogin");
            }

            onMessageReceived(data) {
                // Will spam the console, uncomment if you want to see it
                //console.log("SamplePlugin.onMessageReceived: ", data);
            }

            onVariableSet(key, valueBefore, valueAfter) {
                // Will spam the console, uncomment if you want to see it
                //console.log("SamplePlugin.onVariableSet", key, valueBefore, valueAfter);
            }

            onChat(data) {
                // Could spam the console, uncomment if you want to see it
                //console.log("SamplePlugin.onChat", data);
            }

            onPanelChanged(panelBefore, panelAfter) {
                console.log("MobilePlugin.onPanelChanged", panelBefore, panelAfter);
            }

            onCombatStart() {
                console.log("MobilePlugin.onCombatStart");
            }

            onCombatEnd() {
                console.log("MobilePlugin.onCombatEnd");
            }

        }

        const plugin = new MobilePlugin();
        IdlePixelPlus.registerPlugin(plugin);

    })();