Starblast iOS Drop Gems Button

Adds a button to drop gems (like pressing V)

Detta skript bör inte installeras direkt. Det är ett bibliotek för andra skript att inkludera med meta-direktivet // @require https://update.greasyfork.org/scripts/572397/1789757/Starblast%20iOS%20Drop%20Gems%20Button.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Starblast iOS Drop Gems Button
// @namespace    starblast-ios
// @version      1.0
// @description  Adds a button to drop gems (like pressing V)
// @match        https://starblast.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Create button
    const btn = document.createElement("div");
    btn.innerText = "💎 DROP";
    btn.style.position = "fixed";
    btn.style.left = "10px";
    btn.style.top = "50%";
    btn.style.transform = "translateY(-50%)";
    btn.style.background = "rgba(0,0,0,0.7)";
    btn.style.color = "white";
    btn.style.padding = "10px 15px";
    btn.style.borderRadius = "10px";
    btn.style.fontSize = "14px";
    btn.style.zIndex = "9999";
    btn.style.userSelect = "none";
    btn.style.touchAction = "manipulation";

    document.body.appendChild(btn);

    // Function to simulate "V" key press
    function dropGems() {
        const down = new KeyboardEvent("keydown", {
            key: "v",
            code: "KeyV",
            keyCode: 86,
            which: 86
        });

        const up = new KeyboardEvent("keyup", {
            key: "v",
            code: "KeyV",
            keyCode: 86,
            which: 86
        });

        document.dispatchEvent(down);
        document.dispatchEvent(up);
    }

    // Tap event (mobile)
    btn.addEventListener("touchstart", (e) => {
        e.preventDefault();
        dropGems();
    });

    // Click event (backup)
    btn.addEventListener("click", dropGems);

})();