// ==UserScript== // @name AI tag 绘画管理器 Stable Diffusion 注入版 // @namespace http://tampermonkey.net/ // @version 0.2 // @description AI tag 绘画管理器 Stable Diffusion 注入版 ,目前只支持正向词条注入,本人菜鸡一只,随缘更新,欢迎 pull // @author izumikineno // @license MIT // @match http://*/* // @icon https://izumkineno.github.io/ai-tag-model-manage/dist/favicon.ico // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; const js1 = 'https://izumkineno.github.io/ai-tag-model-manage/distMonkey/js1.js' const js2 = 'https://izumkineno.github.io/ai-tag-model-manage/distMonkey/js2.js' const css1 = 'https://izumkineno.github.io/ai-tag-model-manage/distMonkey/css1.css' const css2 = 'https://izumkineno.github.io/ai-tag-model-manage/distMonkey/css2.css' const shadowRoot = document.querySelector("body > gradio-app").shadowRoot function jsLoad(url) { let script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.src = url; document.documentElement.appendChild(script); } function cssLoad(url) { let script = document.createElement('link'); script.setAttribute('rel', 'stylesheet'); script.setAttribute('type', 'text/css'); script.href = url; document.documentElement.appendChild(script); } function cssLoad2(url) { const sre = document.querySelector("body > gradio-app").shadowRoot.querySelector("link:nth-child(4)") let script = document.createElement('link'); script.setAttribute('rel', 'stylesheet'); script.setAttribute('type', 'text/css'); script.href = url; sre.appendChild(script); } window.addEventListener('load', (event) => { console.log('loading') setTimeout(()=> { const target = shadowRoot.querySelector("#toprow") const container = document.createElement('div') function insertAfter(newNode, curNode) { if (curNode.parentNode) curNode.parentNode.insertBefore(newNode, curNode.nextElementSibling) } container.id = 'app' insertAfter(container, target) jsLoad(js1) jsLoad(js2) cssLoad(css1) cssLoad(css2) cssLoad2(css1) cssLoad2(css2) },1000) }); })();