diep_Shortcut

try to take over the world!

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

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1134304/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. ////////////////////pink////////violet/////bleu///////jaune//////rouge//////vert///////bleu clair//gris////
  78. const textShadow = 'text-shadow: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'
  79. class CANVAS {
  80. GUI_create(id, Class, text, x, y,width, height, color, border, fontSize, callback) {
  81. // Créer l'élément de l'interface graphique
  82. const guiElement = document.createElement('d-button');
  83. guiElement.id = id;
  84. guiElement.classList.add(Class);
  85. guiElement.innerHTML = text;
  86. guiElement.style.bottom = x;
  87. guiElement.style.right = y;
  88. guiElement.border = border;
  89. guiElement.style.fontSize = fontSize+"vw";
  90. guiElement.bg = color;
  91. guiElement.textBorder = fontSize;
  92. guiElement.textalign = 'center';
  93. guiElement.style.position = 'fixed';
  94. guiElement.style.width = width+"vw";
  95. guiElement.style.height = height+"vh";
  96.  
  97. guiElement.addEventListener('click', callback);
  98. // Append the GUI element to the body of the document
  99. document.body.appendChild(guiElement);
  100. }
  101. GUI_create_slider(id, min, max, step, value, x, y, width, height, callback) {
  102. // Créer l'élément de l'interface graphique
  103. const guiElement = document.createElement('input');
  104. guiElement.id = id;
  105. guiElement.type = "range";
  106. guiElement.min = min;
  107. guiElement.max = max;
  108. guiElement.step = step;
  109. guiElement.value = value;
  110.  
  111. guiElement.style.top = x;
  112. guiElement.style.left = y;
  113. guiElement.style.width = width+"vw";
  114. guiElement.style.height = height+"vh";
  115. guiElement.style.position = 'absolute';
  116.  
  117. guiElement.addEventListener('input', callback);
  118. // Append the GUI element to the body of the document
  119. document.body.appendChild(guiElement);
  120. }
  121. GUI_changeName(id, text) {
  122. const element = document.getElementById(id);
  123. element.innerHTML = text;
  124. }
  125. GUI_hide_or_showID(id, truefalse) {
  126. const element = document.getElementById(id);
  127. if (truefalse == undefined) {
  128. if (element.style.display === 'none') {
  129. element.style.display = 'block';
  130. } else {
  131. element.style.display = 'none';
  132. }
  133. } else if (truefalse == true) {
  134. element.style.display = 'block';
  135. } else if (truefalse == false) {
  136. element.style.display = 'none';
  137. }
  138. }
  139. GUI_hide_or_showClass(Class, truefalse) {
  140. const elements = document.querySelectorAll(Class);
  141. for (const element of elements) {
  142. if (truefalse == undefined) {
  143. if (element.style.display === 'none') {
  144. element.style.display = 'block';
  145. } else {
  146. element.style.display = 'none';
  147. }
  148. } else if (truefalse == true) {
  149. element.style.display = 'block';
  150. } else if (truefalse == false) {
  151. element.style.display = 'none';
  152. }
  153. }
  154. }
  155. GUI_delete(id) {
  156. const element = document.getElementById(id);
  157. if (element) {
  158. element.parentNode.removeChild(element);
  159. }
  160. }
  161. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  162. canvasType.save();
  163. canvasType.textAlign = "center"
  164. canvasType.font = `${size}px Ubuntu`;
  165. canvasType.fillStyle = color;
  166. canvasType.globalAlpha = visibility;
  167. canvasType.fillText(text1, x, y)
  168. if (StrokeStyle) {
  169. canvasType.strokeStyle = strokeStyleColor;
  170. canvasType.strokeText(text1, x, y);
  171. }
  172. canvasType.restore();
  173. }
  174. drawLine(canvasType, xy, XY, color, visibility) {
  175. canvasType.save();
  176. canvasType.fillStyle = color;
  177. canvasType.globalAlpha = visibility;
  178. canvasType.beginPath();
  179. canvasType.moveTo(xy.x, xy.y);
  180. canvasType.lineTo(XY.x, XY.y);
  181. canvasType.stroke();
  182. canvasType.restore();
  183. }
  184.  
  185. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  186. canvasType.save();
  187. canvasType.fillStyle = color;
  188. canvasType.globalAlpha = visibility;
  189. canvasType.beginPath();
  190. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  191. canvasType.fill();
  192. if (StrokeStyle) {
  193. canvasType.lineWidth = strokeStyleSize;
  194. canvasType.strokeStyle = strokeStyleColor;
  195. canvasType.stroke();
  196. }
  197. canvasType.restore();
  198. }
  199.  
  200. drawSquar(canvasType, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  201. canvasType.save();
  202. canvasType.fillStyle = color;
  203. canvasType.globalAlpha = visibility;
  204. canvasType.fillRect(x1, y1, x2 - x1, y2 - y1);
  205. if (StrokeStyle) {
  206. canvasType.lineWidth = strokeStyleSize;
  207. canvasType.strokeStyle = strokeStyleColor;
  208. canvasType.stroke();
  209. }
  210. canvasType.restore();
  211. }
  212. }
  213. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  214.  
  215. // const shortcut = new Shortcut();
  216. diep_Shortcut = __webpack_exports__;
  217. /******/
  218. })();
  219. //diepAPI end
  220.  
  221. _window.diep_Shortcut = diep_Shortcut;
  222. })();