Gartic Phone Auto Draw + Music Player + Random Fruit

Adds a small GUI for auto-drawing in Gartic Phone, including image upload, drag & drop, sound effects, a music player, and a random fruit drawer.

目前為 2025-03-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Gartic Phone Auto Draw + Music Player + Random Fruit
// @namespace    https://greasyfork.org/en/users/fdslalkad
// @version      2.0
// @description  Adds a small GUI for auto-drawing in Gartic Phone, including image upload, drag & drop, sound effects, a music player, and a random fruit drawer.
// @author       fdslalkad
// @match        *://garticphone.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let selectedImage = null;
    let hackzSequence = '';
    const hackzCode = 'HACKZ';

    const songs = [
        { name: "Monkeys Spinning Monkeys", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Monkeys%20Spinning%20Monkeys.mp3" },
        { name: "Sneaky Snitch", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Sneaky%20Snitch.mp3" },
        { name: "Scheming Weasel", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Scheming%20Weasel.mp3" },
        { name: "Fluffing a Duck", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Fluffing%20a%20Duck.mp3" },
        { name: "Investigations", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Investigations.mp3" },
        { name: "Local Forecast", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Local%20Forecast.mp3" },
        { name: "The Builder", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/The%20Builder.mp3" },
        { name: "Quirky Dog", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Quirky%20Dog.mp3" },
        { name: "Pixel Peeker", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Pixel%20Peeker.mp3" },
        { name: "Cipher", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Cipher.mp3" },
        { name: "Dark Fog", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Dark%20Fog.mp3" },
        { name: "Hidden Agenda", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Hidden%20Agenda.mp3" },
        { name: "Marty Gots a Plan", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Marty%20Gots%20a%20Plan.mp3" },
        { name: "Ghost Dance", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Ghost%20Dance.mp3" },
        { name: "New Friendly", author: "Kevin MacLeod", url: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/New%20Friendly.mp3" }
    ];

    const fruitImages = [
        "https://upload.wikimedia.org/wikipedia/commons/2/2f/Culinary_fruits_front_view.jpg", // Assorted fruits
        "https://upload.wikimedia.org/wikipedia/commons/1/15/Red_Apple.jpg", // Apple
        "https://upload.wikimedia.org/wikipedia/commons/8/8a/Banana-Single.jpg", // Banana
        "https://upload.wikimedia.org/wikipedia/commons/c/c4/Orange-Fruit-Pieces.jpg", // Orange
        "https://upload.wikimedia.org/wikipedia/commons/3/36/Kiwifruit-Whole-%26-Split.jpg" // Kiwi
    ];

    let currentSongIndex = 0;
    let audio = new Audio();

    let gui = document.createElement('div');
    gui.style.position = 'fixed';
    gui.style.top = '10px';
    gui.style.right = '10px';
    gui.style.background = 'rgba(0,0,0,0.8)';
    gui.style.color = 'white';
    gui.style.padding = '10px';
    gui.style.borderRadius = '5px';
    gui.style.zIndex = '10000';
    gui.innerHTML = `
        <button id="autoDrawBtn">Auto Draw</button><br>
        <input type="file" id="uploadImage" accept="image/*"><br>
        <input type="text" id="imageUrl" placeholder="Image URL">
        <button id="loadImageBtn">Load Image</button><br>
        <button id="playMusicBtn">Play Random Music</button>
        <button id="pauseMusicBtn">Pause</button>
        <button id="resumeMusicBtn">Play</button>
        <button id="nextMusicBtn">Next</button>
        <button id="prevMusicBtn">Previous</button>
        <button id="stopMusicBtn">Stop</button>
        <button id="changeSongBtn">Change Song</button>
        <button id="randomFruitBtn">Random Fruit</button>
        <p id="statusMessage" style="color: lime; font-family: Sans-Serif; display: none;"></p>
    `;
    document.body.appendChild(gui);
})();