PC sheet field

Script for pc players

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         PC sheet field
// @namespace    http://tampermonkey.net/
// @version      0.5.1
// @description  Script for pc players
// @author       Hustandant#1917
// @match        *://multiplayerpiano.net/*
// @license      MIT
// @icon         https://github.com/Hustoroff/mpp/blob/main/icon.png?raw=true
// @grant        none
// @run-at       document-end
// ==/UserScript==
window.addEventListener('load', (event) => {
    $("#bottom .relative").append(`<div id="pc_btn" class="ugly-button">PC field</div>`);
    $("#pc_btn").css({position: "absolute", left: "1020px", top: "4px"}).on("click", () => {
        MPP.client.emit("notification", {
            title: "PC sheet field (script by Hustandant#1917)",
            id:"area_notification",
            duration:-1,
            target:"#piano",
            html:`<textarea id="pcArea"  placeholder="Your sheets..."></textarea><div><h4>More sheets <a href="https://controlc.com/6aa4340f" target="_blank">here</a></h4></div>`
        });
        let area = document.getElementById("pcArea");
        area.innerText = localStorage.getItem("sheets");
        area.parentNode.parentNode.style.width = "100%";
        area.addEventListener("input", () => {
            localStorage.setItem("sheets", area.value);
        });

        let div = document.getElementById("Notification-area_notification").getElementsByClassName("title")[0];
        let elem = document.getElementById("Notification-area_notification");
        div.addEventListener("mousedown", function(evt) {
            evt.preventDefault();
            let xStart = evt.clientX;
            let yStart = evt.clientY;
            var onMouseMove = function (evtMove){
                evtMove.preventDefault();
                var xNew = xStart - evtMove.clientX;
                var yNew = yStart - evtMove.clientY;
                xStart = evtMove.clientX;
                yStart = evtMove.clientY;
                elem.style.top = (elem.offsetTop - yNew) + 'px';
                elem.style.left = (elem.offsetLeft - xNew) + 'px';
            }
            var onMouseUp = function (evtUp){
                document.removeEventListener('mousemove', onMouseMove);
                document.removeEventListener('mouseup', onMouseUp);
            }
            document.addEventListener('mousemove', onMouseMove)
            document.addEventListener('mouseup', onMouseUp)
        });
    });
});