// ==UserScript== // @name Huggingface Image Downloader // @description Add buttons to quickly download images from Stable Diffusion models // @author Isaiah Odhner // @namespace https://isaiahodhner.io // @version 1.3 // @license MIT // @match https://*.hf.space/* // @match https://*.huggingface.co/* // @icon https://www.google.com/s2/favicons?sz=64&domain=huggingface.co // @grant none // @downloadURL none // ==/UserScript== // v1.1 adds support for Stable Diffusion 2. It expands the domain scope to match other applications on HuggingFace, and includes negative prompts in the filename, with format: "'' (anti '')". // v1.2 handles updated DOM structure of the site // v1.3 adds support for more Huggingface spaces, including https://huggingface.co/nerijs/pixel-art-xl and https://huggingface.co/spaces/songweig/rich-text-to-image and https://huggingface.co/spaces/Yntec/ToyWorldXL // These changes may result in false positives, i.e. unnecessary download buttons showing up. Let me know if this happens. // Show-on-hover code is simplified (at some negligible performance cost), and this may fix some interaction issues. setInterval(() => { // assuming prompt comes before negative prompt in DOM for some of these fallbacks // TODO: look for "prompt"/"negative" in surrounding text (often not in a