Starblast Gem Drop

Draggable button, hold to drop gems automatically

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         Starblast Gem Drop
// @namespace    starblast-ios
// @version      2.0
// @description  Draggable button, hold to drop gems automatically
// @match        https://starblast.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const btn = document.createElement("div");
    btn.innerText = "💎 DROP";
    btn.style.position = "fixed";
    btn.style.left = "20px";
    btn.style.top = "50%";
    btn.style.transform = "translateY(-50%)";
    btn.style.background = "linear-gradient(145deg, #ffcc33, #ff9900)";
    btn.style.color = "white";
    btn.style.padding = "15px 20px";
    btn.style.borderRadius = "15px";
    btn.style.fontSize = "16px";
    btn.style.fontWeight = "bold";
    btn.style.zIndex = "9999";
    btn.style.userSelect = "none";
    btn.style.touchAction = "none";
    btn.style.boxShadow = "0 4px 15px rgba(0,0,0,0.4)";
    btn.style.textAlign = "center";
    btn.style.cursor = "grab";

    document.body.appendChild(btn);

    let dropping = false;

    function dropGem() {
        const down = new KeyboardEvent("keydown", {
            key: "v",
            code: "KeyV",
            keyCode: 86,
            which: 86,
            bubbles: true
        });
        const up = new KeyboardEvent("keyup", {
            key: "v",
            code: "KeyV",
            keyCode: 86,
            which: 86,
            bubbles: true
        });
        document.dispatchEvent(down);
        setTimeout(() => document.dispatchEvent(up), 750);
    }

    // Hold to keep dropping
    let dropInterval;
    btn.addEventListener("touchstart", (e) => {
        e.preventDefault();
        dropping = true;
        dropGem();
        dropInterval = setInterval(() => {
            if(dropping) dropGem();
        }, 800);
    });

    btn.addEventListener("touchend", () => {
        dropping = false;
        clearInterval(dropInterval);
    });

    // Draggable
    let offsetX = 0, offsetY = 0, isDragging = false;

    btn.addEventListener("touchmove", (e) => {
        e.preventDefault();
        const touch = e.touches[0];
        if(isDragging){
            btn.style.left = (touch.clientX - offsetX) + "px";
            btn.style.top = (touch.clientY - offsetY) + "px";
        }
    });

    btn.addEventListener("touchstart", (e) => {
        if(e.target === btn && !dropping){
            isDragging = true;
            const touch = e.touches[0];
            offsetX = touch.clientX - btn.getBoundingClientRect().left;
            offsetY = touch.clientY - btn.getBoundingClientRect().top;
        }
    });

    btn.addEventListener("touchend", () => {
        isDragging = false;
    });

})();