diep_Shortcut

try to take over the world!

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

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1137836/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, Color) {
  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.style.color = Color;
  91.  
  92. guiElement.addEventListener('click', callback);
  93. // Append the GUI element to the body of the document
  94. document.body.appendChild(guiElement);
  95. }
  96. GUI_create_Modal(id, Class, x, y, width, height, color, borderColor) {
  97. // Créer l'élément de l'interface graphique
  98. const guiElement = document.createElement('div');
  99. guiElement.id = id;
  100. guiElement.classList.add(Class);
  101. guiElement.style.width = width;
  102. guiElement.style.height = height;
  103. guiElement.style.backgroundColor = color;
  104. guiElement.style.position = 'absolute';
  105. guiElement.style.left = x;
  106. guiElement.style.top = y;
  107. guiElement.style.padding = '12px';
  108. guiElement.style.borderRadius = '10px';
  109. guiElement.style.border = `2px solid ${borderColor}`;
  110. guiElement.style.zIndex = 20;
  111. guiElement.style.animation = '0.2s cubic-bezier(0.25, 1, 0.5, 1) 0s 1 normal none running modal-intro';
  112. // Append the GUI element to the body of the document
  113. document.body.appendChild(guiElement);
  114. }
  115. GUI_create_slider(id, Class, min, max, step, value, x, y, width, height, callback) {
  116. // Créer l'élément de l'interface graphique
  117. const guiElement = document.createElement('input');
  118. guiElement.id = id;
  119. guiElement.classList.add(Class);
  120. guiElement.type = "range";
  121. guiElement.min = min;
  122. guiElement.max = max;
  123. guiElement.step = step;
  124. guiElement.value = value;
  125. guiElement.style.top = x;
  126. guiElement.style.left = y;
  127. guiElement.style.width = width+"vw";
  128. guiElement.style.height = height+"vh";
  129. guiElement.style.position = 'absolute';
  130. guiElement.addEventListener('input', callback);
  131. // Append the GUI element to the body of the document
  132. document.body.appendChild(guiElement);
  133. }
  134. Text_create = (id, Class, x, y, text, color) => {
  135. // Créer un élément de texte en HTML
  136. let textNode = document.createElement('div');
  137. textNode.innerHTML = text;
  138. textNode.id = id;
  139. textNode.classList.add(Class);
  140. // Appliquer les styles pour positionner le texte sur le canvas
  141. textNode.style.position = 'absolute';
  142. textNode.style.left = x + '%';
  143. textNode.style.top = y + '%';
  144. textNode.style.zIndex = 30;
  145. textNode.style.color = color;
  146.  
  147. // Appliquer l'effet de text-shadow en CSS
  148. 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';
  149. // Ajouter l'élément de texte à la page
  150. document.body.appendChild(textNode);
  151. }
  152. GUI_changeName(id, text) {
  153. const element = document.getElementById(id);
  154. element.innerHTML = text;
  155. }
  156. GUI_hide_or_showID(id, truefalse) {
  157. const element = document.getElementById(id);
  158. if (truefalse == undefined) {
  159. if (element.style.display === 'none') {
  160. element.style.display = 'block';
  161. } else {
  162. element.style.display = 'none';
  163. }
  164. } else if (truefalse == true) {
  165. element.style.display = 'block';
  166. } else if (truefalse == false) {
  167. element.style.display = 'none';
  168. }
  169. }
  170. GUI_hide_or_showClass(Class, truefalse) {
  171. const elements = document.querySelectorAll(Class);
  172. for (const element of elements) {
  173. if (truefalse == undefined) {
  174. if (element.style.display === 'none') {
  175. element.style.display = 'block';
  176. } else {
  177. element.style.display = 'none';
  178. }
  179. } else if (truefalse == true) {
  180. element.style.display = 'block';
  181. } else if (truefalse == false) {
  182. element.style.display = 'none';
  183. }
  184. }
  185. }
  186. GUI_delete(type, id_class) {
  187. let elements;
  188. if (type === "id") {
  189. const element = document.getElementById(id_class);
  190. if (element) {
  191. element.parentNode.removeChild(element);
  192. }
  193. } else if (type === "class") {
  194. elements = document.getElementsByClassName(id_class);
  195. while (elements.length > 0) {
  196. elements[0].parentNode.removeChild(elements[0]);
  197. }
  198. }
  199. }
  200. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  201. canvasType.save();
  202. canvasType.textAlign = "center"
  203. canvasType.font = `${size}px Ubuntu`;
  204. canvasType.fillStyle = color;
  205. canvasType.globalAlpha = visibility;
  206. canvasType.fillText(text1, x, y)
  207. if (StrokeStyle) {
  208. canvasType.strokeStyle = strokeStyleColor;
  209. canvasType.strokeText(text1, x, y);
  210. }
  211. canvasType.restore();
  212. }
  213. drawLine(canvasType, xy, XY, color, visibility) {
  214. canvasType.save();
  215. canvasType.fillStyle = color;
  216. canvasType.globalAlpha = visibility;
  217. canvasType.beginPath();
  218. canvasType.moveTo(xy.x, xy.y);
  219. canvasType.lineTo(XY.x, XY.y);
  220. canvasType.stroke();
  221. canvasType.restore();
  222. }
  223. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  224. canvasType.save();
  225. canvasType.fillStyle = color;
  226. canvasType.globalAlpha = visibility;
  227. canvasType.beginPath();
  228. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  229. canvasType.fill();
  230. if (StrokeStyle) {
  231. canvasType.lineWidth = strokeStyleSize;
  232. canvasType.strokeStyle = strokeStyleColor;
  233. canvasType.stroke();
  234. }
  235. canvasType.restore();
  236. }
  237. drawSquar(canvasType, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  238. canvasType.save();
  239. canvasType.fillStyle = color;
  240. canvasType.globalAlpha = visibility;
  241. canvasType.fillRect(x1, y1, x2 - x1, y2 - y1);
  242. if (StrokeStyle) {
  243. canvasType.lineWidth = strokeStyleSize;
  244. canvasType.strokeStyle = strokeStyleColor;
  245. canvasType.stroke();
  246. }
  247. canvasType.restore();
  248. }
  249. }
  250. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  251. // const shortcut = new Shortcut();
  252. diep_Shortcut = __webpack_exports__;
  253. /******/
  254. })();
  255. //diepAPI end
  256. _window.diep_Shortcut = diep_Shortcut;
  257. })();