diep_Shortcut

try to take over the world!

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

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