Greasy Fork

来自缓存

Greasy Fork is available in English.

自動描画 配布用(ベータ版)

画像を自動で描画します

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         自動描画 配布用(ベータ版)
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  画像を自動で描画します
// @author       あるぱか
// @match        https://pictsense.com/*
// @icon         https://img.icons8.com/?size=100&id=NP2HKyKwWrzn&format=png&color=000000
// @grant        none
// @license      MIT
// ==/UserScript==


const alpacaAutoDraw="ほぼAIに作ってもらったぜ!!!!‮";!function(){"use strict";let e=document.createElement("div");e.id="SettingMenus",e.style.background="#e0e0e080",e.style.height="660px",e.style.width="0",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.userSelect="none",e.style.paddingTop="50px",e.style.transition=".05s",e.style.filter="drop-shadow(2px 0px 3px #ccc)",document.getElementById("base").appendChild(e),e.innerHTML='<span><button id="outoDrawMenuButton" style="width: 0; border-radius: 0 10px 10px 0; transition: .05s">▶︎</button></span><div style="display: none";><div id ="menuE"></div></div><style>#outoDrawMenuButton div {margin: 0 auto;text-align: left;width: 250px;font-size: 17px;padding: 20px 20px 0;margin-top: 20px;border-radius: 10px;background-color: #eee;}#menuE {margin-top: 20px;}#menuE > input,#menuE > button{margin-top: 20px;padding: 0;}#menuE > input[type="file"]{color: #fff;width: 300px;height: auto;margin-bottom: 10px;background-color: #009CFF;border-radius: 1em;padding: 5px;}::file-selector-button {display: block;}</style>';let t=document.getElementById("outoDrawMenuButton"),n=document.querySelector("#SettingMenus div");t.addEventListener("click",function(){(l=!l)?(e.style.width="300px",t.style.width="300px",t.innerText="◀︎",n.style.display=null):(e.style.width="0",t.style.width="0",t.innerText="▶︎",n.style.display="none")});let l=!1,i=document.querySelector("#menuE"),o=document.createElement("input");o.type="file",o.accept="image/*",o.style.zIndex="1000",i.appendChild(o);let d=document.createElement("div");d.style.zIndex="1000",d.style.color="white",d.style.backgroundColor="rgba(0, 0, 0, 0.5)",i.appendChild(d);let $=document.createElement("input");$.type="range",$.min="1",$.max="100",$.value="100",$.style.zIndex="1000",$.style.backgroundColor="rgba(0, 0, 0, 0.5)",i.appendChild($),$.addEventListener("input",function(){d.textContent=`現在のスケール: ${$.value}%`}),d.textContent=`現在のスケール: ${$.value}%`;let a=document.createElement("div");a.style.zIndex="1000",a.style.color="white",a.style.backgroundColor="rgba(0, 0, 0, 0.5)",i.appendChild(a);let r=document.createElement("input");r.type="range",r.min="1",r.max="30",r.value="10",r.style.zIndex="1000",r.style.backgroundColor="rgba(0, 0, 0, 0.5)",i.appendChild(r),r.addEventListener("input",function(){a.textContent=`現在のペンサイズ: ${r.value}`}),a.textContent=`現在のペンサイズ: ${r.value}`;let s=document.createElement("div");s.style.zIndex="1000",s.style.color="white",s.style.backgroundColor="rgba(0, 0, 0, 0.5)",s.textContent="ステータス: 待機中",i.appendChild(s);let u=document.createElement("button");u.textContent="実行",u.disabled=!0,u.style.zIndex="1000",u.style.padding="5px 10px",i.appendChild(u);let p=!1,c;o.addEventListener("change",function(){o.files.length>0?u.disabled=!1:u.disabled=!0});let y=document.createElement("canvas"),h=y.getContext("2d"),x;u.addEventListener("click",function(){if(p)clearTimeout(c),s.textContent="ステータス: 中止",u.textContent="実行",p=!1;else{let e=o.files[0],t=new FileReader;t.onload=function(e){let t=new Image;t.onload=function(){let e=Math.min(320/t.width,320/t.height)*($.value/100);y.width=t.width*e,y.height=t.height*e,h.drawImage(t,0,0,y.width,y.height),function e(t){let n=parseInt(r.value,10),l=[],i=t.width,o=t.height,d=t.data,$=n/2,a=null,h=null,g=null;for(let f=0;f<o;f+=$){for(let m=0;m<i;m+=$){let _=(Math.floor(f)*i+Math.floor(m))*4,b=d[_],C=d[_+1],w=d[_+2],v=d[_+3];if(0===v){a=null;continue}let E=(b<<16)+(C<<8)+w;E!==a&&(null!==a&&l.push([[h,g],[m-$,f]]),h=m,g=f,a=E)}null!==a&&(l.push([[h,g],[i-$,f]]),a=null)}(function e(t,n){let l=io.connect(Object.keys(io.sockets)[0]),i=0;s.textContent="ステータス: 描画中",u.textContent="中止",p=!0,!function e(){if(i>=n.length){s.textContent="ステータス: 完了",u.textContent="実行",p=!1;return}let[o,d]=n[i],$=function e(t,n){let l=(Math.floor(n)*y.width+Math.floor(t))*4,i=x.data[l],o=x.data[l+1],d=x.data[l+2];return(i<<16)+(o<<8)+d}(o[0],o[1]);l.emit("stroke send",t,$,1,[o,d]),i++,c=setTimeout(e,190)}()})(n,l)}(x=h.getImageData(0,0,y.width,y.height))},t.src=e.target.result},t.readAsDataURL(e)}})}();