您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
upload images to sillypost from your clipboard!
// ==UserScript== // @name Upload from clipboard // @namespace http://tampermonkey.net/ // @version 2025-05-13-2 // @description upload images to sillypost from your clipboard! // @author niko.earth // @match https://sillypost.net/ // @icon https://www.google.com/s2/favicons?sz=64&domain=sillypost.net // @grant none // @license GNU GPLv3 // ==/UserScript== (function() { 'use strict'; async function onbuttonclicked() { const clipboardItems = await navigator.clipboard.read(); if (clipboardItems.length == 0) { alert("clipboard was empty! did you try to paste a file instead of image data?"); } clipboardItems.forEach(async element => { element.types.forEach(async type => { if (!["image/png", "image/gif", "image/jpeg"].includes(type)) { return } if (element.types.includes(type)) { const blob = await element.getType(type) let file = new File([blob], `clipboard-${new Date().toISOString().split(".")[0]}.${type.split("/")[1]}`,{type:type, lastModified:new Date().getTime()}); let container = new DataTransfer(); container.items.add(file); document.getElementById("sketch").files = container.files; } }) }); } const sketchButton = document.getElementById("sketch"); const clipboardButton = document.createElement("button"); clipboardButton.innerText = "image from clipboard..." clipboardButton.onclick = onbuttonclicked; clipboardButton.setAttribute("type", "button"); sketchButton.after(clipboardButton) })();