您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Drawaria.online adds file upload
当前为
// ==UserScript== // @name Drawaria.online Image Upload // @version 1.0 // @description Drawaria.online adds file upload // @author Mr Robot // @author Discord: Sinasinb#3578 // @match https://drawaria.online/* // @grant none // @namespace http://tampermonkey.net/ // ==/UserScript== (function() { 'use strict'; // Resize canvas let canvas = document.getElementById('canvas'); canvas.height = 650; canvas.width = 780; // Add file upload button let target = document.getElementById('downloadcanvas'); // Create button for toggling sounds with Material Icon and text let togglebtn = document.createElement('button'); togglebtn.id = 'imagebot'; togglebtn.type = 'button'; togglebtn.classList.add('btn', 'btn-light', 'btn-sm', 'btn-block'); togglebtn.innerHTML = '<i class="material-icons" style="font-size: 16px;"></i><span>Upload Image</span>'; // Add styles for Material Icons font family let linkElm = document.createElement("link"); linkElm.href = "https://fonts.googleapis.com/icon?family=Material+Icons"; linkElm.rel="stylesheet"; document.head.appendChild(linkElm); let styleElem=document.createElement("style"); styleElem.textContent=` .material-icons { font-family: 'Material Icons'; font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; } `; document.head.appendChild(styleElem); togglebtn.addEventListener('click', function() { let input = document.createElement('input'); input.type = 'file'; input.accept = 'image/*'; input.onchange = function() { let file = input.files[0]; let reader = new FileReader(); reader.onload = function() { let img = new Image(); img.onload = function() { let ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0, canvas.width, canvas.height); }; img.src = reader.result; }; reader.readAsDataURL(file); }; input.click(); }); target.parentNode.insertBefore(togglebtn, target.nextSibling); })();