diep_Shortcut

try to take over the world!

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

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