diep_Shortcut

try to take over the world!

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

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