Drawaria.Online Image-Upload

image bot

Versión del día 27/05/2023. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         Drawaria.Online Image-Upload
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  image bot
// @author       Mr Robot
// @author       Discord: Sinasinb#3578
// @match        https://drawaria.online/
// @match        https://drawaria.online/room*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a dropdown
    var dropdown = document.createElement("select");
    dropdown.id = "image-dropdown";
    document.body.appendChild(dropdown);

    // Add options to the dropdown
    var options = ["Select an image", "Image 1", "Image 2", "Image 3"];
    for (var i = 0; i < options.length; i++) {
        var option = document.createElement("option");
        option.value = options[i];
        option.text = options[i];
        dropdown.appendChild(option);
    }

    // Create a file upload button
    var input = document.createElement("input");
    input.type = "file";
    input.id = "image-upload";
    document.body.appendChild(input);

    // Add an event listener to the file upload button
    input.addEventListener("change", function(event) {
        // Get the canvas element
        var canvas = document.getElementById("canvas");

        // Get the context of the canvas element
        var ctx = canvas.getContext("2d");

        // Get the uploaded file
        var file = event.target.files[0];

        // Create a new image element
        var image = new Image();

        // Set the source of the image element to the uploaded file
        image.src = URL.createObjectURL(file);

        // Add an event listener to the image element
        image.addEventListener("load", function() {
            // Draw the image onto the canvas
            ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
        });
    });
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。