diep_Shortcut

try to take over the world!

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

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1137428/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, Class, 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.classList.add(Class);
  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, Class, 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. textNode.classList.add(Class);
  138. // Appliquer les styles pour positionner le texte sur le canvas
  139. textNode.style.position = 'absolute';
  140. textNode.style.left = x + '%';
  141. textNode.style.top = y + '%';
  142. // Appliquer l'effet de text-shadow en CSS
  143. 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';
  144. // Ajouter l'élément de texte à la page
  145. document.body.appendChild(textNode);
  146. }
  147. GUI_changeName(id, text) {
  148. const element = document.getElementById(id);
  149. element.innerHTML = text;
  150. }
  151. GUI_hide_or_showID(id, truefalse) {
  152. const element = document.getElementById(id);
  153. if (truefalse == undefined) {
  154. if (element.style.display === 'none') {
  155. element.style.display = 'block';
  156. } else {
  157. element.style.display = 'none';
  158. }
  159. } else if (truefalse == true) {
  160. element.style.display = 'block';
  161. } else if (truefalse == false) {
  162. element.style.display = 'none';
  163. }
  164. }
  165. GUI_hide_or_showClass(Class, truefalse) {
  166. const elements = document.querySelectorAll(Class);
  167. for (const element of elements) {
  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. }
  181. GUI_delete(id) {
  182. const element = document.getElementById(id);
  183. if (element) {
  184. element.parentNode.removeChild(element);
  185. }
  186. }
  187. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  188. canvasType.save();
  189. canvasType.textAlign = "center"
  190. canvasType.font = `${size}px Ubuntu`;
  191. canvasType.fillStyle = color;
  192. canvasType.globalAlpha = visibility;
  193. canvasType.fillText(text1, x, y)
  194. if (StrokeStyle) {
  195. canvasType.strokeStyle = strokeStyleColor;
  196. canvasType.strokeText(text1, x, y);
  197. }
  198. canvasType.restore();
  199. }
  200. drawLine(canvasType, xy, XY, color, visibility) {
  201. canvasType.save();
  202. canvasType.fillStyle = color;
  203. canvasType.globalAlpha = visibility;
  204. canvasType.beginPath();
  205. canvasType.moveTo(xy.x, xy.y);
  206. canvasType.lineTo(XY.x, XY.y);
  207. canvasType.stroke();
  208. canvasType.restore();
  209. }
  210. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  211. canvasType.save();
  212. canvasType.fillStyle = color;
  213. canvasType.globalAlpha = visibility;
  214. canvasType.beginPath();
  215. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  216. canvasType.fill();
  217. if (StrokeStyle) {
  218. canvasType.lineWidth = strokeStyleSize;
  219. canvasType.strokeStyle = strokeStyleColor;
  220. canvasType.stroke();
  221. }
  222. canvasType.restore();
  223. }
  224. drawSquar(canvasType, x1, y1, x2, y2, size, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  225. canvasType.save();
  226. canvasType.fillStyle = color;
  227. canvasType.globalAlpha = visibility;
  228. canvasType.fillRect(x1, y1, x2 - x1, y2 - y1);
  229. if (StrokeStyle) {
  230. canvasType.lineWidth = strokeStyleSize;
  231. canvasType.strokeStyle = strokeStyleColor;
  232. canvasType.stroke();
  233. }
  234. canvasType.restore();
  235. }
  236. }
  237. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  238. // const shortcut = new Shortcut();
  239. diep_Shortcut = __webpack_exports__;
  240. /******/
  241. })();
  242. //diepAPI end
  243. _window.diep_Shortcut = diep_Shortcut;
  244. })();