diep_Shortcut

try to take over the world!

当前为 2022-12-20 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/456843/1130045/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 canvas = document.getElementById('canvas');
  13. const _window = 'undefined' == typeof unsafeWindow ? window : unsafeWindow;
  14. if (_window.diep_Shortcut) return;
  15.  
  16. //diepAPI start
  17. var diep_Shortcut;
  18. /******/ (() => {
  19. // webpackBootstrap
  20. /******/ 'use strict';
  21. /******/ // The require scope
  22. /******/ var __webpack_require__ = {};
  23. /******/
  24. /************************************************************************/
  25. /******/ /* webpack/runtime/define property getters */
  26. /******/ (() => {
  27. /******/ // define getter functions for harmony exports
  28. /******/ __webpack_require__.d = (exports, definition) => {
  29. /******/ for (var key in definition) {
  30. /******/ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  31. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  32. /******/
  33. }
  34. /******/
  35. }
  36. /******/
  37. };
  38. /******/
  39. })();
  40. /******/
  41. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  42. /******/ (() => {
  43. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
  44. /******/
  45. })();
  46. /******/
  47. /******/ /* webpack/runtime/make namespace object */
  48. /******/ (() => {
  49. /******/ // define __esModule on exports
  50. /******/ __webpack_require__.r = (exports) => {
  51. /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  52. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  53. /******/
  54. }
  55. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  56. /******/
  57. };
  58. /******/
  59. })();
  60. /******/
  61. /************************************************************************/
  62. var __webpack_exports__ = {};
  63. // ESM COMPAT FLAG
  64. __webpack_require__.r(__webpack_exports__);
  65.  
  66. // EXPORTS
  67. __webpack_require__.d(__webpack_exports__, {
  68. core: () => /* reexport */ core_namespaceObject,
  69. });
  70.  
  71. // NAMESPACE OBJECT: ./src/core/index.ts
  72. var core_namespaceObject = {};
  73. __webpack_require__.r(core_namespaceObject);
  74. __webpack_require__.d(core_namespaceObject, {
  75. Canvas: () => Canvas,
  76. });
  77. 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'
  78. class CANVAS {
  79. createGUI(id, Class, text, x, y,width, height, color, callback) {
  80. // Créer l'élément de l'interface graphique
  81. const guiElement = document.createElement('button');
  82. guiElement.id = id;
  83. guiElement.classList.add(Class);
  84. guiElement.innerHTML = text;
  85. guiElement.style.top = x;
  86. guiElement.style.left = y;
  87. guiElement.style.backgroundColor = color;
  88. guiElement.style.textShadow = textShadow;
  89. guiElement.style.position = 'absolute';
  90. guiElement.style.width = width+"vw";
  91. guiElement.style.height = height+"vh";
  92. // Appliquer les styles supplémentaires
  93. guiElement.style.borderRadius = '0.5vw';
  94. guiElement.style.fontFamily = 'Ubuntu';
  95. guiElement.style.opacity = '60%';
  96. guiElement.style.color = '#FFFFFF';
  97. guiElement.style.fontStyle = 'normal';
  98. guiElement.style.fontSize = '0.9vw';
  99.  
  100. guiElement.addEventListener('mouseover', function() {
  101. guiElement.style.opacity = '100%'
  102. });
  103. guiElement.addEventListener('mouseout', function() {
  104. guiElement.style.opacity = '60%'
  105. });
  106.  
  107. guiElement.addEventListener('click', callback);
  108. // Append the GUI element to the body of the document
  109. document.body.appendChild(guiElement);
  110. }
  111. hide_or_showID(id, truefalse) {
  112. const element = document.getElementById(id);
  113. if (truefalse == 'truefalse') {
  114. if (element.style.display === 'none') {
  115. element.style.display = 'block';
  116. } else {
  117. element.style.display = 'none';
  118. }
  119. } else if (truefalse == 'true') {
  120. element.style.display = 'block';
  121. } else if (truefalse == 'false') {
  122. element.style.display = 'none';
  123. }
  124. }
  125. hide_or_showClass(Class, truefalse) {
  126. const elements = document.querySelectorAll(Class);
  127. for (const element of elements) {
  128. if (truefalse == 'truefalse') {
  129. if (element.style.display === 'none') {
  130. element.style.display = 'block';
  131. } else {
  132. element.style.display = 'none';
  133. }
  134. } else if (truefalse == 'true') {
  135. element.style.display = 'block';
  136. } else if (truefalse == 'false') {
  137. element.style.display = 'none';
  138. }
  139. }
  140. }
  141. deleteGUI(id) {
  142. const element = document.getElementById(id);
  143. if (element) {
  144. element.parentNode.removeChild(element);
  145. }
  146. }
  147. drawText(canvasType , x, y, text1, text2, color, size, visibility, StrokeStyle, strokeStyleColor) {
  148. canvasType.save();
  149. canvasType.textAlign = "center"
  150. canvasType.font = `${size}px Ubuntu`;
  151. canvasType.fillStyle = color;
  152. canvasType.globalAlpha = visibility;
  153. canvasType.fillText(`${text1} ${text2}`, x, y)
  154. if (StrokeStyle) {
  155. canvasType.strokeStyle = strokeStyleColor;
  156. canvasType.strokeText(`${text1} ${text2}`, x, y);
  157. }
  158. canvasType.restore();
  159. }
  160. drawLine(canvasType, xy, XY, color, visibility) {
  161. canvasType.save();
  162. canvasType.fillStyle = color;
  163. canvasType.globalAlpha = visibility;
  164. canvasType.beginPath();
  165. canvasType.moveTo(xy.x, xy.y);
  166. canvasType.lineTo(XY.x, XY.y);
  167. canvasType.stroke();
  168. canvasType.restore();
  169. }
  170.  
  171. drawPoint(canvasType, xy, radius, color, visibility, StrokeStyle, strokeStyleColor, strokeStyleSize) {
  172. canvasType.save();
  173. canvasType.fillStyle = color;
  174. canvasType.globalAlpha = visibility;
  175. canvasType.beginPath();
  176. canvasType.arc(xy.x, xy.y, radius, 0, 2 * Math.PI);
  177. canvasType.fill();
  178. if (StrokeStyle) {
  179. canvasType.lineWidth = strokeStyleSize;
  180. canvasType.strokeStyle = strokeStyleColor;
  181. canvasType.stroke();
  182. }
  183. canvasType.restore();
  184. }
  185. }
  186. const Canvas = new CANVAS(); // CONCATENATED MODULE: ./src/tools/index.ts // CONCATENATED MODULE: ./src/types/index.ts // CONCATENATED MODULE: ./src/index.ts
  187.  
  188. // const shortcut = new Shortcut();
  189. diep_Shortcut = __webpack_exports__;
  190. /******/
  191. })();
  192. //diepAPI end
  193.  
  194. _window.diep_Shortcut = diep_Shortcut;
  195. })();