Gartic Phone Draw Bot

Automatic Draw Bot for Gartic Phone

  1. // ==UserScript==
  2. // @name Gartic Phone Draw Bot
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Automatic Draw Bot for Gartic Phone
  6. // @author me
  7. // @match *://garticphone.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const drawBotButton = document.createElement('button');
  15. drawBotButton.innerText = 'DRAWBOT';
  16. drawBotButton.style.position = 'absolute';
  17. drawBotButton.style.top = '10px';
  18. drawBotButton.style.right = '10px';
  19. drawBotButton.style.zIndex = '1000';
  20. document.body.appendChild(drawBotButton);
  21.  
  22. const gui = document.createElement('div');
  23. gui.style.display = 'none';
  24. gui.style.position = 'absolute';
  25. gui.style.top = '50%';
  26. gui.style.left = '50%';
  27. gui.style.transform = 'translate(-50%, -50%)';
  28. gui.style.backgroundColor = 'white';
  29. gui.style.border = '1px solid black';
  30. gui.style.padding = '20px';
  31. gui.style.zIndex = '1001';
  32. document.body.appendChild(gui);
  33.  
  34. const uploadInput = document.createElement('input');
  35. uploadInput.type = 'file';
  36. uploadInput.accept = 'image/*';
  37. gui.appendChild(uploadInput);
  38.  
  39. const urlInput = document.createElement('input');
  40. urlInput.type = 'text';
  41. urlInput.placeholder = 'Image URL';
  42. gui.appendChild(urlInput);
  43.  
  44. const uploadButton = document.createElement('button');
  45. uploadButton.innerText = 'Upload Image';
  46. gui.appendChild(uploadButton);
  47.  
  48. drawBotButton.addEventListener('click', () => {
  49. gui.style.display = 'block';
  50. });
  51.  
  52. document.addEventListener('click', (event) => {
  53. if (!gui.contains(event.target) && event.target !== drawBotButton) {
  54. gui.style.display = 'none';
  55. }
  56. });
  57.  
  58. uploadButton.addEventListener('click', () => {
  59. const file = uploadInput.files[0];
  60. if (file) {
  61. const reader = new FileReader();
  62. reader.onload = function(e) {
  63. startDrawing(e.target.result);
  64. };
  65. reader.readAsDataURL(file);
  66. } else if (urlInput.value) {
  67. startDrawing(urlInput.value);
  68. }
  69. });
  70.  
  71. function startDrawing(imageSrc) {
  72. const canvas = document.querySelector('canvas'); // Adjust selector as needed
  73. const ctx = canvas.getContext('2d');
  74. const img = new Image();
  75. img.src = imageSrc;
  76. img.onload = function() {
  77. ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
  78. };
  79. }
  80.  
  81. document.addEventListener('dragover', (event) => {
  82. event.preventDefault();
  83. });
  84.  
  85. document.addEventListener('drop', (event) => {
  86. event.preventDefault();
  87. const files = event.dataTransfer.files;
  88. if (files.length > 0) {
  89. const file = files[0];
  90. const reader = new FileReader();
  91. reader.onload = function(e) {
  92. startDrawing(e.target.result);
  93. };
  94. reader.readAsDataURL(file);
  95. }
  96. });
  97. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址