diep_Shortcut

try to take over the world!

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

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