Copy Message Gartic

Copy the message in Gartic

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name           Copy Message Gartic
// @description    Copy the message in Gartic
// @version        1.0
// @author         STRAGON
// @license        N/A
// @match          *://gartic.io/*
// @match          *://*/*?__cpo=aHR0cHM6Ly9nYXJ0aWMuaW8
// @icon           https://static.cdnlogo.com/logos/s/96/st.svg
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          GM_addValueChangeListener
// @grant          GM_addStyle
// @grant          GM_openInTab
// @namespace      https://greasyfork.org/en/users/1353946-stragon-x
// ==/UserScript==

(function() {
    let originalSend = WebSocket.prototype.send, setTrue = false;
    window.wsObj = {};

    WebSocket.prototype.send = function(data) {
        console.log("Gönderilen Veri: " + data);
        originalSend.apply(this, arguments);
        if (Object.keys(window.wsObj).length == 0) {
            window.wsObj = this;
            window.eventAdd();
        }
    };

    let massHistory = [];

    window.eventAdd = () => {
        if (!setTrue) {
            setTrue = 1;
            window.wsObj.addEventListener("message", (msg) => {
                let data = JSON.parse(msg.data.slice(2));
                console.log(data);
                if (data[0] == 11) {
                    window.wsObj.mass = data[2];
                    massHistory.push(window.wsObj.mass);
                    if (massHistory.length > 3) {
                        massHistory.shift();
                    }
                }
            });
        }
    };


    function setCSS() {
        var css = `
        .cards {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
        /* From Uiverse.io by alexruix */
        .card {
            --background: linear-gradient(to left, #ff0000 0%, #0008ff 100%);
            width: 190px;
            height: 254px;
            padding: 5px;
            border-radius: 1rem;
            overflow: visible;
            background: #f7ba2b;
            background: var(--background);
            position: relative;
            z-index: 1;
        }

        .card::after {
            position: absolute;
            content: "";
            top: 30px;
            left: 0;
            right: 0;
            z-index: -1;
            height: 100%;
            width: 100%;
            transform: scale(0.8);
            filter: blur(25px);
            background: #f7ba2b;
            background: var(--background);
            transition: opacity .5s;
        }

        .card-info {
            --color: #000000;
            background: var(--color);
            color: var(--color);
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
            overflow: visible;
            border-radius: .7rem;
        }

        .card .title {
            font-weight: bold;
            letter-spacing: .1em;
        }

        /*Hover*/
        .card:hover::after {
            opacity: 0;
        }

        .card:hover .card-info {
            color: #f7ba2b;
            transition: color 1s;
        }


        .cards {
            display: flex;
            flex-direction: column;
            gap: 10px;
    .input-field {
  background-color: transparent;
  height: 60px;
  width: 155px;
  text-align: center;
  border: 2px solid;
  border-image: linear-gradient(to right, #ff0000, #0000ff) 1;
  color: #ffffff; /* added this line to set the text color to white */
    border-radius: 15px; /* added this line to set the border radius to 15px */
}
    `;
        GM_addStyle(css);
    }

    setCSS();

    let panel = document.createElement("div");
    panel.style.position = "fixed";
    panel.style.top = "50%";
    panel.style.right = "25px";
    panel.style.transform = "translateY(-50%)";
    panel.style.zIndex = 999999;
    document.body.appendChild(panel);

    function createHTML() {
let html = `

  <div class="card">
    <div class="card-info">
      <p class="title"></p>
      <div class="cards">
        <input type="text" value="${massHistory[2]}" id="input-0" class="input-field">
        <input type="text" value="${massHistory[2]}" id="input-1" class="input-field">
        <input type="text" value="${massHistory[2]}" id="input-2" class="input-field">
      </div>
    </div>
  </div>

`;
  panel.innerHTML = html;
}

    createHTML();

    function copyValue(value) {
        navigator.clipboard.writeText(value);
    }

   setInterval(() => {
    for (let i = 0; i < 3; i++) {
        document.getElementById(`input-${i}`).value = massHistory[i];
    }
}, 10);
})();