diep_Shortcut

try to take over the world!

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

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