IdlePixel Websocket Messenger

Sends websocket messages

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         IdlePixel Websocket Messenger
// @namespace    lbtechnology.info
// @version      1.1.1
// @description  Sends websocket messages
// @author       Lux-Ferre
// @license      MIT
// @match        *://idle-pixel.com/login/play*
// @grant        none
// @require      https://greasyfork.org/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
// @require		 https://greasyfork.org/scripts/491983-idlepixel-plugin-paneller/code/IdlePixel%2B%20Plugin%20Paneller.js?anticache=20240410
// ==/UserScript==
 
(function() {
    'use strict';
  
    class WSMessengerPlugin extends IdlePixelPlusPlugin {
        constructor() {
            super("wsmessenger", {
                about: {
                    name: GM_info.script.name,
                    version: GM_info.script.version,
                    author: GM_info.script.author,
                    description: GM_info.script.description
                },
            });
            this.previous = "";
        }

        createPanel(){
            IdlePixelPlus.addPanel("wsmessenger", "Websocket Messenger", function() {
                const content = `
                    <div>
                        <form onsubmit='event.preventDefault(); IdlePixelPlus.plugins.wsmessenger.sendMessage()'>
                            <div class="d-flex flex-fill">
                                <div class="col-11">
                                    <input type="text" class="w-100" id="wsmessenger_input" placeholder="message">
                                </div>
                                <div class="col-1">
                                    <input type="submit" class="w-100" value="Send">
                                </div>
                            </div>
                        </form>
                    </div>
                `
                return content
            });
        }

        onLogin(){
			Paneller.registerPanel("wsmessenger", "Websocket Messenger")
            this.createPanel()
        }
    
        sendMessage(){
            const inputbox = $("#wsmessenger_input")
            const message = inputbox.val()
            inputbox.val("")
            IdlePixelPlus.sendMessage(message)
        }
    
    }
 
    const plugin = new WSMessengerPlugin();
    IdlePixelPlus.registerPlugin(plugin);
 
})();