/line

just type /line in the chat to activate the script!!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         /line
// @namespace    http://tampermonkey.net/
// @version      2024-10-27
// @description  just type /line in the chat to activate the script!!
// @author       Gamer Luka YT - @gamerluka1451 YouTube.com/@gamerluka1451
// @match        https://cellcraft.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=cellcraft.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let linesActive = false;

// Function to toggle lines
function toggleLines() {
    if (linesActive) {
        // Remove the lines
        console.log("Removing lines...");
        document.querySelectorAll('.line').forEach(line => line.remove());
        linesActive = false;
    } else {
        // Create style and lines
        console.log("Adding lines...");
        const style = document.createElement('style');
        style.textContent = `
            .line {
                position: fixed;
                background: black;
                z-index: 9999;
            }
            .horizontal {
                top: 50%;
                left: 0;
                right: 0;
                height: 2px;
            }
            .vertical {
                top: 0;
                bottom: 0;
                left: 50%;
                width: 2px;
            }
        `;
        document.head.appendChild(style);

        const horizontalLine = document.createElement('div');
        horizontalLine.className = 'line horizontal';
        document.body.appendChild(horizontalLine);

        const verticalLine = document.createElement('div');
        verticalLine.className = 'line vertical';
        document.body.appendChild(verticalLine);

        linesActive = true;
    }
}

// Add event listener to the chat input
const chatInput = document.getElementById('chtbox');
chatInput.addEventListener('keydown', function(event) {
    if (event.key === 'Enter') {
        const message = chatInput.value.trim();
        if (message === '/line') {
            toggleLines();
            chatInput.value = ''; // Clear input after command
            event.preventDefault(); // Prevent default action (sending the text)
        }
    }
});

})();