Old Image Script NOT WOKRING

Bad, Old, Ugly Skript very stupid got worse not working

  1. // ==UserScript==
  2. // @name Old Image Script NOT WOKRING
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.3
  5. // @description Bad, Old, Ugly Skript very stupid got worse not working
  6. // @author YouTubeDrawaria
  7. // @match https://drawaria.online/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=drawaria.online
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. 'use strict';
  14.  
  15. // Crear el menú desplegable
  16. var menu = createElement("div", "");
  17. menu.style.position = "fixed";
  18. menu.style.top = "100px";
  19. menu.style.right = "10px";
  20. menu.style.background = "rgb(134,58,180)";
  21. menu.style.background = "linear-gradient(90deg, rgba(134,58,180,1) 0%, rgba(253,29,244,1) 50%, rgba(252,69,69,1) 100%)";
  22. menu.style.borderRadius = "25px";
  23. menu.style.padding = "10px";
  24. menu.style.width = "220px";
  25. menu.style.boxShadow = "0 4px 8px rgba(0,0,0,0.2)";
  26. menu.style.zIndex = "99999999";
  27. menu.style.display = "none"; // Ocultar el menú inicialmente
  28.  
  29. // Contenedor de imagen
  30. var imageContainerLabel = createElement("label", "Insert/Upload Picture");
  31. imageContainerLabel.style.display = "block";
  32. imageContainerLabel.style.marginBottom = "5px";
  33. imageContainerLabel.style.color = "#fff";
  34. imageContainerLabel.style.fontWeight = "bold";
  35.  
  36. var imageContainer = createElement("div", "");
  37. imageContainer.style.backgroundImage = "url('https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Antu_insert-image.svg/512px-Antu_insert-image.svg.png?20160706115716')";
  38. imageContainer.style.backgroundSize = "cover";
  39. imageContainer.style.backgroundPosition = "center";
  40. imageContainer.style.width = "150px";
  41. imageContainer.style.height = "150px";
  42. imageContainer.style.borderRadius = "10px";
  43. imageContainer.style.border = "2px dashed #fff";
  44. imageContainer.style.cursor = "pointer";
  45. imageContainer.style.marginBottom = "10px";
  46.  
  47. imageContainer.addEventListener("click", function() {
  48. var input = document.createElement("input");
  49. input.type = "file";
  50. input.accept = "image/*";
  51. input.style.display = "none";
  52. input.addEventListener("change", function(event) {
  53. var file = event.target.files[0];
  54. if (file) {
  55. var reader = new FileReader();
  56. reader.onload = function(e) {
  57. imageContainer.style.backgroundImage = "url('" + e.target.result + "')";
  58. var canvas = document.getElementById("canvas");
  59. if (canvas) {
  60. var img = new Image();
  61. img.src = e.target.result;
  62. img.onload = function() {
  63. var ctx = canvas.getContext("2d");
  64. ctx.clearRect(0, 0, canvas.width, canvas.height);
  65. ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
  66. };
  67. }
  68. };
  69. reader.readAsDataURL(file);
  70. }
  71. });
  72. input.click();
  73. });
  74.  
  75. imageContainer.addEventListener("dragover", function(event) {
  76. event.preventDefault();
  77. imageContainer.style.border = "2px dashed #00f";
  78. });
  79.  
  80. imageContainer.addEventListener("dragleave", function(event) {
  81. imageContainer.style.border = "2px dashed #fff";
  82. });
  83.  
  84. imageContainer.addEventListener("drop", function(event) {
  85. event.preventDefault();
  86. imageContainer.style.border = "2px dashed #fff";
  87. var file = event.dataTransfer.files[0];
  88. if (file) {
  89. var reader = new FileReader();
  90. reader.onload = function(e) {
  91. imageContainer.style.backgroundImage = "url('" + e.target.result + "')";
  92. var canvas = document.getElementById("canvas");
  93. if (canvas) {
  94. var img = new Image();
  95. img.src = e.target.result;
  96. img.onload = function() {
  97. var ctx = canvas.getContext("2d");
  98. ctx.clearRect(0, 0, canvas.width, canvas.height);
  99. ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
  100. };
  101. }
  102. };
  103. reader.readAsDataURL(file);
  104. }
  105. });
  106.  
  107. menu.appendChild(imageContainerLabel);
  108. menu.appendChild(imageContainer);
  109.  
  110. // Campo de entrada para el prompt de la imagen
  111. var ImagePrompt = createElement("input", "");
  112. ImagePrompt.id = "ImagePrompt";
  113. ImagePrompt.placeholder = "Describe the image";
  114. ImagePrompt.style.width = "calc(100% - 20px)";
  115. ImagePrompt.style.margin = "10px";
  116. ImagePrompt.style.padding = "10px";
  117. ImagePrompt.style.borderRadius = "10px";
  118. ImagePrompt.style.border = "1px solid #ccc";
  119. ImagePrompt.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)";
  120.  
  121. menu.appendChild(ImagePrompt);
  122.  
  123. // Campo de los detalles de la imagen
  124. var IntervalInput = createElement("input", "");
  125. IntervalInput.id = "IntervalInput";
  126. IntervalInput.placeholder = "Prompts";
  127. IntervalInput.style.width = "calc(51% - 20px)";
  128. IntervalInput.style.margin = "9px";
  129. IntervalInput.style.padding = "9px";
  130. IntervalInput.style.borderRadius = "10px";
  131. IntervalInput.style.border = "1px solid #ccc";
  132. IntervalInput.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)";
  133.  
  134. menu.appendChild(IntervalInput);
  135.  
  136. // Selector de estilo
  137. var styleSelectorLabel = createElement("label", "Choose Style");
  138. styleSelectorLabel.style.display = "block";
  139. styleSelectorLabel.style.marginBottom = "5px";
  140. styleSelectorLabel.style.color = "#fff";
  141. styleSelectorLabel.style.fontWeight = "bold";
  142.  
  143. var styleSelector = createElement("select", "");
  144. styleSelector.style.width = "calc(100% - 20px)";
  145. styleSelector.style.margin = "10px";
  146. styleSelector.style.padding = "10px";
  147. styleSelector.style.borderRadius = "10px";
  148. styleSelector.style.border = "1px solid #ccc";
  149. styleSelector.style.boxShadow = "0 2px 4px rgba(0,0,0,0.1)";
  150. styleSelector.style.backgroundColor = "#fff";
  151. styleSelector.style.color = "#333";
  152.  
  153. var styles = ["Choose Style", "Anime", "Realistic", "Modern", "Futuristic", "Detailed"];
  154. styles.forEach(function(style) {
  155. var option = createElement("option", style);
  156. option.value = style;
  157. if (style === "Choose Style") {
  158. option.disabled = true;
  159. option.selected = true;
  160. }
  161. styleSelector.appendChild(option);
  162. });
  163.  
  164. styleSelector.addEventListener("change", function() {
  165. var selectedStyle = styleSelector.value;
  166. console.log("Selected style: ", selectedStyle);
  167. // Aquí puedes agregar la lógica para manejar el estilo seleccionado
  168. });
  169.  
  170. menu.appendChild(styleSelectorLabel);
  171. menu.appendChild(styleSelector);
  172.  
  173. var ImageCreator;
  174. function ImageGeneration(ImageSelected) {
  175. var imagePrompter = document.getElementsByClassName("form-control");
  176. for (var i = 0; i < imagePrompter.length; i++) {
  177. imagePrompter[i].value = ImageSelected;
  178. }
  179.  
  180. var CanvasUploader = document.getElementsByClassName("chatattop-button");
  181. for (var j = 0; j < CanvasUploader.length; j++) {
  182. CanvasUploader[j].click();
  183. }
  184. }
  185.  
  186. // Botón para comenzar a dibujar
  187. var CreateImage = createElement("button", "Begin Drawing");
  188. CreateImage.addEventListener("click", function() {
  189. var ImageSelected = document.getElementById("ImagePrompt").value;
  190. var interval = Number(document.getElementById("IntervalInput").value);
  191.  
  192. if (ImageCreator) {
  193. clearInterval(ImageCreator);
  194. }
  195.  
  196. ImageCreator = setInterval(function() {
  197. ImageGeneration(ImageSelected);
  198. }, interval);
  199. });
  200.  
  201. CreateImage.style.width = "calc(50% - 20px)";
  202. CreateImage.style.margin = "10px";
  203. CreateImage.style.padding = "10px";
  204. CreateImage.style.borderRadius = "10px";
  205. CreateImage.style.border = "none";
  206. CreateImage.style.background = "rgb(255,171,0)";
  207. CreateImage.style.background = "linear-gradient(0deg, rgba(255,171,0,1) 0%, rgba(238,253,45,1) 100%)";
  208. CreateImage.style.color = "#fff";
  209. CreateImage.style.cursor = "pointer";
  210. CreateImage.style.transition = "transform 0.2s";
  211.  
  212. CreateImage.addEventListener("mousedown", function() {
  213. CreateImage.style.transform = "scale(0.95)";
  214. });
  215.  
  216. CreateImage.addEventListener("mouseup", function() {
  217. CreateImage.style.transform = "scale(1)";
  218. });
  219.  
  220. menu.appendChild(CreateImage);
  221.  
  222. function createElement(type, content, onClick) {
  223. var element = document.createElement(type);
  224. element.innerHTML = content;
  225. if (onClick) {
  226. element.onclick = onClick;
  227. }
  228. return element;
  229. }
  230.  
  231. // Botón para detener
  232. var WaitFinish = createElement("button", "Wait");
  233. WaitFinish.addEventListener("click", function() {
  234. clearInterval(ImageCreator);
  235. ImageCreator = null;
  236. });
  237.  
  238. WaitFinish.style.width = "calc(126% - 70px)";
  239. WaitFinish.style.margin = "10px";
  240. WaitFinish.style.padding = "10px";
  241. WaitFinish.style.borderRadius = "10px";
  242. WaitFinish.style.border = "none";
  243. WaitFinish.style.background = "rgb(255,171,0)";
  244. WaitFinish.style.background = "linear-gradient(0deg, rgba(255,171,0,1) 0%, rgba(238,253,45,1) 100%)";
  245. WaitFinish.style.color = "#fff";
  246. WaitFinish.style.cursor = "pointer";
  247. WaitFinish.style.transition = "transform 0.2s";
  248.  
  249. WaitFinish.addEventListener("mousedown", function() {
  250. WaitFinish.style.transform = "scale(0.95)";
  251. });
  252.  
  253. WaitFinish.addEventListener("mouseup", function() {
  254. WaitFinish.style.transform = "scale(1)";
  255. });
  256.  
  257. menu.appendChild(WaitFinish);
  258.  
  259. // Botón para abrir/cerrar el menú
  260. var menuButton = createElement("button", "Old Image Script NOT WOKRING");
  261. menuButton.style.position = "fixed";
  262. menuButton.style.top = "715px";
  263. menuButton.style.right = "10px";
  264. menuButton.style.background = "rgb(134,58,180)";
  265. menuButton.style.background = "linear-gradient(90deg, rgba(134,58,180,1) 0%, rgba(253,29,244,1) 50%, rgba(252,69,69,1) 100%)";
  266. menuButton.style.borderRadius = "25px";
  267. menuButton.style.padding = "10px 20px";
  268. menuButton.style.border = "none";
  269. menuButton.style.color = "#fff";
  270. menuButton.style.cursor = "pointer";
  271. menuButton.style.boxShadow = "0 4px 8px rgba(0,0,0,0.2)";
  272. menuButton.style.zIndex = "99999999";
  273.  
  274. menuButton.addEventListener("click", function() {
  275. if (menu.style.display === "none") {
  276. menu.style.display = "block";
  277. } else {
  278. menu.style.display = "none";
  279. }
  280. });
  281.  
  282. document.body.appendChild(menuButton);
  283. document.body.appendChild(menu);