diep_Shortcut

try to take over the world!

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

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