diep_Shortcut

try to take over the world!

当前为 2023-01-22 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1141197/diep_Shortcut.js

  1. // ==UserScript==
  2. // @name diep_Shortcut
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author tariteur
  7. // @match https://diep.io/
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=diep.io
  9. // @grant none
  10. // ==/UserScript==
  11. (() => {
  12. const _window = 'undefined' == typeof unsafeWindow ? window : unsafeWindow;
  13. if (_window.diep_Shortcut) return;
  14.  
  15. //diepAPI start
  16. var diep_Shortcut;
  17. /******/ (() => {
  18. // webpackBootstrap
  19. /******/ 'use strict';
  20. /******/ // The require scope
  21. /******/ var __webpack_require__ = {};
  22. /******/
  23. /************************************************************************/
  24. /******/ /* webpack/runtime/define property getters */
  25. /******/ (() => {
  26. /******/ // define getter functions for harmony exports
  27. /******/ __webpack_require__.d = (exports, definition) => {
  28. /******/ for (var key in definition) {
  29. /******/ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  30. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  31. /******/
  32. }
  33. /******/
  34. }
  35. /******/
  36. };
  37. /******/
  38. })();
  39. /******/
  40. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  41. /******/ (() => {
  42. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  43. /******/
  44. })();
  45. /******/
  46. /******/ /* webpack/runtime/make namespace object */
  47. /******/ (() => {
  48. /******/ // define __esModule on exports
  49. /******/ __webpack_require__.r = (exports) => {
  50. /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  51. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  52. /******/
  53. }
  54. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  55. /******/
  56. };
  57. /******/
  58. })();
  59. /******/
  60. /************************************************************************/
  61. var __webpack_exports__ = {};
  62. // ESM COMPAT FLAG
  63. __webpack_require__.r(__webpack_exports__);
  64.  
  65. // EXPORTS
  66. __webpack_require__.d(__webpack_exports__, {
  67. core: () => /* reexport */ core_namespaceObject,
  68. });
  69.  
  70. // NAMESPACE OBJECT: ./src/core/index.ts
  71. var core_namespaceObject = {};
  72. __webpack_require__.r(core_namespaceObject);
  73. __webpack_require__.d(core_namespaceObject, {
  74. Canvas: () => Canvas,
  75. });
  76.  
  77. class CANVAS {
  78. GUI_create(id, Class, text, x, y,width, height, color, border, fontSize, callback, ONOFF) {
  79. // Créer l'élément de l'interface graphique
  80. const guiElement = document.createElement('d-button');
  81. guiElement.id = id;
  82. guiElement.classList.add(Class);
  83. guiElement.innerHTML = text;
  84. guiElement.style.bottom = x;
  85. guiElement.style.left = y;
  86. guiElement.border = border;
  87. guiElement.style.fontSize = fontSize+"vw";
  88. guiElement.bg = color;
  89. guiElement.textBorder = fontSize;
  90. guiElement.textalign = 'center';
  91. guiElement.style.position = 'fixed';
  92. guiElement.style.width = width+"vw";
  93. guiElement.style.height = height+"vh";
  94.  
  95. guiElement.addEventListener('click', callback);
  96. // Append the GUI element to the body of the document
  97. document.body.appendChild(guiElement);
  98. }
  99. GUI_input_bar(id, className, placeholder, x, y, width, height, color, border, fontSize, callback) {
  100. // Créer l'élément de l'interface graphique
  101. const guiElement = document.createElement("input");
  102. guiElement.id = id;
  103. guiElement.classList.add(className);
  104. guiElement.placeholder = placeholder;
  105. guiElement.style.top = x;
  106. guiElement.style.left = y;
  107. guiElement.style.border = border;
  108. guiElement.style.fontSize = fontSize + "vw";
  109. guiElement.style.background = color;
  110. guiElement.style.textAlign = "center";
  111. guiElement.style.position = "fixed";
  112. guiElement.style.width = width + "vw";
  113. guiElement.style.height = height + "vh";
  114.  
  115. guiElement.addEventListener("input", callback);
  116. // Append the GUI element to the body of the document
  117. document.body.appendChild(guiElement);
  118. }
  119. GUI_create_Modal(id, Class, x, y, width, height, color, borderColor) {
  120. // Créer l'élément de l'interface graphique
  121. const guiElement = document.createElement('div');
  122. guiElement.id = id;
  123. guiElement.classList.add(Class);
  124. guiElement.style.width = width+"vw";
  125. guiElement.style.height = height+"vh";
  126. guiElement.style.backgroundColor = color;
  127. guiElement.style.position = 'absolute';
  128. guiElement.style.left = x;
  129. guiElement.style.top = y;
  130. guiElement.style.padding = '12px';
  131. guiElement.style.borderRadius = '10px';
  132. guiElement.style.border = `2px solid ${borderColor}`;
  133. guiElement.style.zIndex = 20;
  134. guiElement.style.animation = '0.2s cubic-bezier(0.25, 1, 0.5, 1) 0s 1 normal none running modal-intro';
  135. // Append the GUI element to the body of the document
  136. document.body.appendChild(guiElement);
  137. }
  138. GUI_create_slider(id, Class, min, max, step, value, x, y, width, height, callback) {
  139. // Créer l'élément de l'interface graphique
  140. const guiElement = document.createElement('input');
  141. guiElement.id = id;
  142. guiElement.classList.add(Class);
  143. guiElement.type = "range";
  144. guiElement.min = min;
  145. guiElement.max = max;
  146. guiElement.step = step;
  147. guiElement.value = value;
  148.  
  149. guiElement.style.top = x;
  150. guiElement.style.left = y;
  151. guiElement.style.width = width+"vw";
  152. guiElement.style.height = height+"vh";
  153. guiElement.style.position = 'absolute';
  154.  
  155. guiElement.addEventListener('input', callback);
  156. // Append the GUI element to the body of the document
  157. document.body.appendChild(guiElement);
  158. }
  159. Text_create = (id, Class, x, y, text) => {
  160. // Créer un élément de texte en HTML
  161. let textNode = document.createElement('div');
  162. textNode.innerHTML = text;
  163. textNode.id = id;
  164. textNode.classList.add(Class);
  165. // Appliquer les styles pour positionner le texte sur le canvas
  166. textNode.style.position = 'absolute';
  167. textNode.style.left = x + '%';
  168. textNode.style.top = y + '%';
  169.  
  170. // Appliquer l'effet de text-shadow en CSS
  171. textNode.style.textShadow = 'black 0.18vh 0, black -0.18vh 0, black 0 -0.18vh, black 0 0.18vh, black 0.18vh 0.18vh, black -0.18vh 0.18vh, black 0.18vh -0.18vh, black -0.18vh -0.18vh, black 0.09vh 0.18vh, black -0.09vh 0.18vh, black 0.09vh -0.18vh, black -0.09vh -0.18vh, black 0.18vh 0.09vh, black -0.18vh 0.09vh, black 0.18vh -0.09vh, black -0.18vh -0.09vh';
  172.  
  173. // Ajouter l'élément de texte à la page
  174. document.body.appendChild(textNode);
  175. }
  176. GUI_changeName(id, text) {
  177. const element = document.getElementById(id);
  178. element.innerHTML = text;
  179. }
  180. GUI_hide_or_showID(id, truefalse) {
  181. const element = document.getElementById(id);
  182. if (truefalse == undefined) {
  183. if (element.style.display === 'none') {
  184. element.style.display = 'block';
  185. } else {
  186. element.style.display = 'none';
  187. }
  188. } else if (truefalse == true) {
  189. element.style.display = 'block';
  190. } else if (truefalse == false) {
  191. element.style.display = 'none';
  192. }
  193. }
  194. GUI_hide_or_showClass(Class, truefalse) {
  195. const elements = document.querySelectorAll(Class);
  196. for (const element of elements) {
  197. if (truefalse == undefined) {
  198. if (element.style.display === 'none') {
  199. element.style.display = 'block';
  200. } else {
  201. element.style.display = 'none';
  202. }
  203. } else if (truefalse == true) {
  204. element.style.display = 'block';
  205. } else if (truefalse == false) {
  206. element.style.display = 'none';
  207. }
  208. }
  209. }
  210. GUI_delete(type, id_class) {
  211. let elements;
  212. if (type === "id") {
  213. const element = document.getElementById(id_class);
  214. if (element) {
  215. element.parentNode.removeChild(element);
  216. }
  217. } else if (type === "class") {
  218. elements = document.getElementsByClassName(id_class);
  219. while (elements.length > 0) {
  220. elements[0].parentNode.removeChild(elements[0]);
  221. }
  222. }
  223. }
  224. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  225. canvasType.save();
  226. canvasType.textAlign = "center"
  227. canvasType.font = `${size}px Ubuntu`;
  228. canvasType.fillStyle = color;
  229. canvasType.globalAlpha = visibility;
  230. canvasType.fillText(text1, x, y)
  231. if (StrokeStyle) {
  232. canvasType.strokeStyle = strokeStyleColor;
  233. canvasType.strokeText(text1, x, y);
  234. }
  235. canvasType.restore();
  236. }
  237. drawLine(canvasType, xy, XY, color, visibility) {
  238. canvasType.save();
  239. canvasType.fillStyle = color;
  240. canvasType.globalAlpha = visibility;
  241. canvasType.beginPath();
  242. canvasType.moveTo(xy.x, xy.y);
  243. canvasType.lineTo(XY.x, XY.y);
  244. canvasType.stroke();
  245. canvasType.restore();
  246. }
  247.  
  248. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  249. canvasType.save();
  250. canvasType.fillStyle = color;
  251. canvasType.globalAlpha = visibility;
  252. canvasType.beginPath();
  253. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  254. canvasType.fill();
  255. if (StrokeStyle) {
  256. canvasType.lineWidth = strokeStyleSize;
  257. canvasType.strokeStyle = strokeStyleColor;
  258. canvasType.stroke();
  259. }
  260. canvasType.restore();
  261. }
  262.  
  263. drawSquar(canvasType, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  264. canvasType.save();
  265. canvasType.fillStyle = color;
  266. canvasType.globalAlpha = visibility;
  267. canvasType.fillRect(x1, y1, x2 - x1, y2 - y1);
  268. if (StrokeStyle) {
  269. canvasType.lineWidth = strokeStyleSize;
  270. canvasType.strokeStyle = strokeStyleColor;
  271. canvasType.stroke();
  272. }
  273. canvasType.restore();
  274. }
  275. }
  276. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  277.  
  278. // const shortcut = new Shortcut();
  279. diep_Shortcut = __webpack_exports__;
  280. /******/
  281. })();
  282. //diepAPI end
  283.  
  284. _window.diep_Shortcut = diep_Shortcut;
  285. })();