diep_Shortcut

if you need help go to https://discord.gg/4Rk3yGSQDp

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