ꃳ꒤ꃳꃳ꒒ꏂꃳꋬ꓄ꁝꇙꋬꋊ꒯ꍌꏂ꓄ꂵꌦ40

A script executor with a draggable GUI and copy/paste functionality that only works after injection

  1. // ==UserScript==
  2. // @name ꃳ꒤ꃳꃳ꒒ꏂꃳꋬ꓄ꁝꇙꋬꋊ꒯ꍌꏂ꓄ꂵꌦ40
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4
  5. // @description A script executor with a draggable GUI and copy/paste functionality that only works after injection
  6. // @author Your Name
  7. // @match *://*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Create the GUI container
  15. const guiContainer = document.createElement('div');
  16. guiContainer.style.position = 'fixed';
  17. guiContainer.style.top = '100px';
  18. guiContainer.style.left = '100px';
  19. guiContainer.style.width = '420px'; // Width adjusted for proper alignment
  20. guiContainer.style.backgroundColor = '#c7c7c7';
  21. guiContainer.style.borderRadius = '15px';
  22. guiContainer.style.padding = '20px';
  23. guiContainer.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.1)';
  24. guiContainer.style.zIndex = '9999';
  25. guiContainer.style.cursor = 'move';
  26. document.body.appendChild(guiContainer);
  27.  
  28. // Create the text area for code input
  29. const codeBox = document.createElement('textarea');
  30. codeBox.style.width = '95%';
  31. codeBox.style.height = '150px';
  32. codeBox.style.borderRadius = '10px';
  33. codeBox.style.border = 'none';
  34. codeBox.style.padding = '10px';
  35. codeBox.style.fontSize = '14px';
  36. codeBox.style.resize = 'none';
  37. codeBox.style.backgroundColor = '#f0f0f0';
  38. codeBox.style.outline = 'none';
  39. codeBox.style.overflowY = 'auto'; // Enable vertical scrolling
  40. codeBox.style.whiteSpace = 'pre-wrap'; // Preserve line breaks and wrap long lines
  41. guiContainer.appendChild(codeBox);
  42.  
  43. // Create the button container
  44. const buttonContainer = document.createElement('div');
  45. buttonContainer.style.display = 'flex';
  46. buttonContainer.style.flexWrap = 'wrap'; // Allow buttons to wrap on small screens
  47. buttonContainer.style.marginTop = '15px';
  48. guiContainer.appendChild(buttonContainer);
  49.  
  50. // Create a common button style
  51. const buttonStyle = {
  52. border: 'none',
  53. borderRadius: '10px',
  54. padding: '10px 20px',
  55. backgroundColor: '#ffffff',
  56. fontSize: '14px',
  57. fontWeight: 'bold', // Make text bold
  58. cursor: 'pointer',
  59. boxShadow: '0 0 5px rgba(0, 0, 0, 0.1)',
  60. flex: '1',
  61. margin: '0 5px'
  62. };
  63.  
  64. // Create the Inject button
  65. const injectBtn = document.createElement('button');
  66. injectBtn.innerText = 'Inject';
  67. Object.assign(injectBtn.style, buttonStyle);
  68. buttonContainer.appendChild(injectBtn);
  69.  
  70. // Create the Execute button
  71. const executeBtn = document.createElement('button');
  72. executeBtn.innerText = 'Execute';
  73. Object.assign(executeBtn.style, buttonStyle);
  74. executeBtn.disabled = true;
  75. buttonContainer.appendChild(executeBtn);
  76.  
  77. // Create the Clear button
  78. const clearBtn = document.createElement('button');
  79. clearBtn.innerText = 'Clear';
  80. Object.assign(clearBtn.style, buttonStyle);
  81. clearBtn.disabled = true;
  82. buttonContainer.appendChild(clearBtn);
  83.  
  84. // Create the Copy button
  85. const copyBtn = document.createElement('button');
  86. copyBtn.innerText = 'Copy';
  87. Object.assign(copyBtn.style, buttonStyle);
  88. copyBtn.disabled = true; // Initially disabled
  89. buttonContainer.appendChild(copyBtn);
  90.  
  91. // Create the Paste button
  92. const pasteBtn = document.createElement('button');
  93. pasteBtn.innerText = 'Paste';
  94. Object.assign(pasteBtn.style, buttonStyle);
  95. pasteBtn.disabled = true; // Initially disabled
  96. buttonContainer.appendChild(pasteBtn);
  97.  
  98. let isInjected = false;
  99.  
  100. // Inject Button Logic
  101. injectBtn.addEventListener('click', () => {
  102. isInjected = true;
  103. executeBtn.disabled = false;
  104. clearBtn.disabled = false;
  105. copyBtn.disabled = false; // Enable Copy button
  106. pasteBtn.disabled = false; // Enable Paste button
  107. alert('Injected successfully!');
  108. });
  109.  
  110. // Execute Button Logic
  111. executeBtn.addEventListener('click', () => {
  112. if (isInjected) {
  113. try {
  114. eval(codeBox.value);
  115. alert('Script executed successfully!');
  116. } catch (error) {
  117. alert('Error executing script: ' + error.message);
  118. }
  119. } else {
  120. alert('Please inject first!');
  121. }
  122. });
  123.  
  124. // Clear Button Logic
  125. clearBtn.addEventListener('click', () => {
  126. if (isInjected) {
  127. codeBox.value = '';
  128. } else {
  129. alert('Please inject first!');
  130. }
  131. });
  132.  
  133. // Copy Button Logic
  134. copyBtn.addEventListener('click', () => {
  135. if (isInjected) {
  136. codeBox.select();
  137. document.execCommand('copy');
  138. alert('Copied to clipboard!');
  139. } else {
  140. alert('Please inject first!');
  141. }
  142. });
  143.  
  144. // Paste Button Logic
  145. pasteBtn.addEventListener('click', async () => {
  146. if (isInjected) {
  147. try {
  148. const clipboardText = await navigator.clipboard.readText();
  149. codeBox.value = clipboardText;
  150. alert('Pasted from clipboard!');
  151. } catch (error) {
  152. alert('Failed to paste from clipboard: ' + error.message);
  153. }
  154. } else {
  155. alert('Please inject first!');
  156. }
  157. });
  158.  
  159. // Dragging functionality for the GUI
  160. let isDragging = false;
  161. let offsetX, offsetY;
  162.  
  163. guiContainer.addEventListener('mousedown', function(e) {
  164. isDragging = true;
  165. offsetX = e.clientX - parseInt(window.getComputedStyle(guiContainer).left);
  166. offsetY = e.clientY - parseInt(window.getComputedStyle(guiContainer).top);
  167. guiContainer.style.cursor = 'grabbing';
  168. });
  169.  
  170. document.addEventListener('mousemove', function(e) {
  171. if (isDragging) {
  172. guiContainer.style.left = e.clientX - offsetX + 'px';
  173. guiContainer.style.top = e.clientY - offsetY + 'px';
  174. }
  175. });
  176.  
  177. document.addEventListener('mouseup', function() {
  178. isDragging = false;
  179. guiContainer.style.cursor = 'move';
  180. });
  181.  
  182. // Make the GUI draggable on touch devices as well
  183. guiContainer.addEventListener('touchstart', function(e) {
  184. isDragging = true;
  185. const touch = e.touches[0];
  186. offsetX = touch.clientX - parseInt(window.getComputedStyle(guiContainer).left);
  187. offsetY = touch.clientY - parseInt(window.getComputedStyle(guiContainer).top);
  188. guiContainer.style.cursor = 'grabbing';
  189. });
  190.  
  191. document.addEventListener('touchmove', function(e) {
  192. if (isDragging) {
  193. const touch = e.touches[0];
  194. guiContainer.style.left = touch.clientX - offsetX + 'px';
  195. guiContainer.style.top = touch.clientY - offsetY + 'px';
  196. }
  197. });
  198.  
  199. document.addEventListener('touchend', function() {
  200. isDragging = false;
  201. guiContainer.style.cursor = 'move';
  202. });
  203.  
  204. })();

QingJ © 2025

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