Diep.io Custom Points Upgrader. Beta

NEW! custom upgrade builds update! Your upgrade builds will save now! This is still in beta!

当前为 2025-02-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Diep.io Custom Points Upgrader. Beta
  3. // @namespace http://tampermonkey.net/
  4. // @version 10
  5. // @homepage https://greasyfork.org/scripts/416440
  6. // @description NEW! custom upgrade builds update! Your upgrade builds will save now! This is still in beta!
  7. // @author -{Abyss⌬}-ora
  8. // @match https://diep.io/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. const hoverMenu = document.createElement("div");
  17. hoverMenu.id = "myhover";
  18. hoverMenu.className = "hover";
  19.  
  20. const modMenu = document.createElement("a");
  21. modMenu.id = "modtab";
  22.  
  23. const menuHeader = document.createElement("h1");
  24. menuHeader.textContent = "-{Abyss⌬}-ora's Mod Menu beta";
  25. modMenu.appendChild(menuHeader);
  26.  
  27. const topRightButton = document.createElement("button");
  28. topRightButton.id = "topRightButton";
  29. topRightButton.textContent = "↻";
  30.  
  31. const style = document.createElement("style");
  32. style.type = "text/css";
  33. style.textContent = `
  34. #myhover a {
  35. z-index: 999;
  36. position: absolute;
  37. top: 300px;
  38. right: -260px;
  39. transition: 0.3s;
  40. width: 250px;
  41. padding: 15px;
  42. background-image: url("https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif");
  43. background-color: #555;
  44. text-decoration: none;
  45. font-size: 10px;
  46. font-family: 'Monoton', cursive;
  47. text-shadow: 1px 1px #000, 2px 2px #555;
  48. color: white;
  49. border: double thick white;
  50. border-radius: 20px;
  51. }
  52. #myhover a:hover {
  53. right: 0;
  54. }
  55. .button {
  56. display: block;
  57. margin: 5px auto;
  58. width: 90%;
  59. text-align: center;
  60. font-size: 18px;
  61. font-family: 'Jersey 10', sans-serif;
  62. color: black;
  63. background-color: white;
  64. border-radius: 5px;
  65. transition: 0.4s;
  66. cursor: pointer;
  67. }
  68. .button:hover {
  69. transform: translateX(-10px);
  70. }
  71. #userInput {
  72. margin: 5px auto;
  73. width: 90%;
  74. padding: 8px;
  75. font-family: 'Monoton', cursive;
  76. text-align: center;
  77. }
  78. #specialButton {
  79. display: block;
  80. margin: 5px auto;
  81. width: 90%;
  82. text-align: center;
  83. font-size: 18px;
  84. font-family: 'Jersey 10', sans-serif;
  85. color: white;
  86. background-color: black;
  87. border-radius: 5px;
  88. border-color: white;
  89. transition: 0.4s;
  90. cursor: pointer;
  91. opacity: 0.8;
  92. }
  93. #specialButton:hover {
  94. color: black;
  95. background-color: darkgray;
  96. transform: translateX(-10px);
  97. }
  98. .popup {
  99. position: fixed;
  100. top: 50%;
  101. left: 50%;
  102. transform: translate(-50%, -50%);
  103. width: 300px;
  104. background-image: url("https://media.tenor.com/images/f3f5354b7c304bc61882dbb1183885e7/tenor.gif");
  105. background-color: white;
  106. border: double thick white;
  107. border-radius: 10px;
  108. padding: 20px;
  109. z-index: 1000;
  110. text-shadow: 1px 1px #000, 2px 2px #555;
  111. }
  112. .attribute {
  113. display: flex;
  114. align-items: center;
  115. margin-bottom: 10px;
  116. }
  117. .attribute div {
  118. width: 30px;
  119. height: 30px;
  120. border: 1px solid #000;
  121. margin: 0;
  122. }
  123. .attribute button {
  124. background-color: gray;
  125. border: none;
  126. color: black;
  127. font-size: 20px;
  128. cursor: pointer;
  129. width: 30px;
  130. height: 30px;
  131. margin: 0;
  132. }
  133. #pointsCounter {
  134. text-align: center;
  135. font-size: 16px;
  136. margin-bottom: 10px;
  137. }
  138. #createBuildButton {
  139. display: block;
  140. margin: 20px auto 0 auto;
  141. width: 80%;
  142. text-align: center;
  143. font-size: 18px;
  144. font-family: 'Jersey 10', sans-serif;
  145. color: black;
  146. background-color: white;
  147. border-radius: 5px;
  148. border: 2px solid black;
  149. cursor: pointer;
  150. padding: 10px;
  151. }
  152. #createBuildButton:hover {
  153. background-color: gray;
  154. color: white;
  155. }
  156. #codeString {
  157. text-align: center;
  158. font-size: 18px;
  159. margin: 10px 0;
  160. }
  161. .remove-button {
  162. background-color: gray;
  163. border: none;
  164. color: white;
  165. font-size: 18px;
  166. cursor: pointer;
  167. width: 30px;
  168. height: 30px;
  169. margin-right: 5px;
  170. transition: background-color 0.3s;
  171. }
  172. .remove-button:hover {
  173. background-color: red;
  174. }
  175. .close-btn {
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. position: absolute;
  180. top: 1px;
  181. z-index: 10;
  182. right: 0px;
  183. width: 40px;
  184. height: 35px;
  185. color: white;
  186. cursor: pointer;
  187. font-size: 18px;
  188. line-height: 30px;
  189. text-align: center;
  190. transition: background-color 0.3s;
  191. text-shadow: 1px 1px #000, 2px 2px #555;
  192. border-radius: 10px;
  193. background-color: rgba(0, 0, 0, 0.8);
  194. }
  195. .close-btn:hover {
  196. background-color: red;
  197. }
  198. #topRightButton {
  199. position: absolute;
  200. top: 10px;
  201. right: 10px;
  202. width: 30px;
  203. height: 30px;
  204. background-color: black;
  205. color: white;
  206. border: none;
  207. border-radius: 10%;
  208. cursor: pointer;
  209. font-size: 18px;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. transition: background-color 0.3s;
  214. z-index: 1001;
  215. opacity: 0.8;
  216. }
  217. #topRightButton:hover {
  218. color: red;
  219. }
  220. #buildButtonsContainer {
  221. max-height: 400px;
  222. overflow-y: scroll;
  223. margin-left: 5px;
  224. }
  225. #buildButtonsContainer {
  226. -ms-overflow-style: none;
  227. scrollbar-width: none;
  228. }
  229. ::-webkit-scrollbar {
  230. width: 10px;
  231. }
  232. ::-webkit-scrollbar-track {
  233. background: #f1f1f1;
  234. border-radius: 10px;
  235. }
  236. ::-webkit-scrollbar-thumb {
  237. background: #888;
  238. border-radius: 10px;
  239. }
  240. ::-webkit-scrollbar-thumb:hover {
  241. background: #555;
  242. }
  243. .popup {
  244. position: fixed;
  245. z-index: 9;
  246. background-color: #f1f1f1;
  247. border: 1px solid #d3d3d3;
  248. text-align: center;
  249. padding-top: 40px;
  250. }
  251. .popup-header {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. position: absolute;
  256. top: 1px;
  257. left: 0px;
  258. right: 35px;
  259. height: 30px;
  260. cursor: grabbing;
  261. z-index: 10;
  262. background-color: rgba(5, 5,5, 0.8);
  263. color: #fff;
  264. font-size: 10px;
  265. font-family: 'Monoton', cursive;
  266. text-shadow: 1px 1px #000, 2px 2px #555;
  267. border-color: white;
  268. border-radius: 10px;
  269. }
  270. `;
  271. document.head.appendChild(style);
  272.  
  273. const userInput = document.createElement("input");
  274. userInput.id = "userInput";
  275. userInput.type = "text";
  276. userInput.placeholder = "Enter Username For Quick Spawn";
  277. userInput.value = localStorage.getItem("quickSpawnUsername") || "";
  278. modMenu.appendChild(userInput);
  279.  
  280. userInput.addEventListener("input", (event) => {
  281. localStorage.setItem("quickSpawnUsername", event.target.value);
  282. });
  283.  
  284. const buttons = [];
  285.  
  286. buttons.forEach((buttonData) => {
  287. const buttonContainer = document.createElement("div");
  288. buttonContainer.style.display = "flex";
  289. buttonContainer.style.alignItems = "center";
  290. buttonContainer.style.justifyContent = "center";
  291.  
  292. const removeButton = document.createElement("button");
  293. removeButton.className = "remove-button";
  294. removeButton.textContent = "[-]";
  295. removeButton.onclick = () => {
  296. buttonContainer.remove();
  297.  
  298. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  299. savedButtons = savedButtons.filter(b => b.name !== buttonData.name);
  300. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  301.  
  302. let removedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  303. removedDefaults = removedDefaults.filter(name => name !== buttonData.name);
  304. localStorage.setItem("removedDefaults", JSON.stringify(removedDefaults));
  305. };
  306.  
  307. buttonContainer.appendChild(removeButton);
  308.  
  309. const button = document.createElement("button");
  310. button.className = "button";
  311. button.textContent = buttonData.name;
  312. button.style.backgroundColor = buttonData.color;
  313. button.onclick = () => {
  314. const spawnName = userInput.value.trim();
  315. window.input.execute(`game_spawn ${spawnName}`);
  316. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  317. const hoverMenu = document.getElementById("myhover");
  318. if (hoverMenu) {
  319. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  320. }
  321. };
  322. buttonContainer.appendChild(button);
  323.  
  324. modMenu.appendChild(buttonContainer);
  325. });
  326.  
  327. const specialButton = document.createElement("button");
  328. specialButton.id = "specialButton";
  329. specialButton.textContent = "[+]";
  330.  
  331. specialButton.onclick = () => {
  332. const popup = document.createElement("div");
  333. popup.className = "popup";
  334. popup.id = "resetPopup";
  335. popup.innerHTML = `<div class="popup-header" id="resetPopupHeader">Drag me</div> `;
  336. document.body.appendChild(popup);
  337.  
  338. const closeButton = document.createElement("button");
  339. closeButton.className = "close-btn";
  340. closeButton.textContent = "X";
  341. closeButton.onclick = () => {
  342. document.body.removeChild(popup);
  343. };
  344. popup.appendChild(closeButton);
  345.  
  346. const buildNameInput = document.createElement("input");
  347. buildNameInput.type = "text";
  348. buildNameInput.placeholder = "Build Name";
  349. buildNameInput.style.display = "block";
  350. buildNameInput.style.width = "80%";
  351. buildNameInput.style.margin = "0 auto 10px auto";
  352. popup.appendChild(buildNameInput);
  353.  
  354. const pointsCounter = document.createElement("div");
  355. pointsCounter.id = "pointsCounter";
  356. pointsCounter.textContent = "Points: 33";
  357. popup.appendChild(pointsCounter);
  358.  
  359. const codeString = document.createElement("div");
  360. codeString.id = "codeString";
  361. codeString.textContent = "Code: 0";
  362. popup.appendChild(codeString);
  363.  
  364. let totalPoints = 33;
  365. let code = "";
  366.  
  367. const attributes = [
  368. { name: "Health Regen", color: "rgb(232, 188, 157)" },
  369. { name: "Max Health", color: "rgb(230, 128, 234)" },
  370. { name: "Body Damage", color: "rgb(165, 128, 234)" },
  371. { name: "Bullet Speed", color: "rgb(128, 162, 234)" },
  372. { name: "Bullet Penetration", color: "rgb(234, 215, 128)" },
  373. { name: "Bullet Damage", color: "rgb(234, 128, 128)" },
  374. { name: "Reload", color: "rgb(164, 234, 128)" },
  375. { name: "Movement Speed", color: "rgb(128, 234, 230)" },
  376. ];
  377.  
  378. attributes.forEach((attribute, index) => {
  379. const attributeRow = document.createElement("div");
  380. attributeRow.className = "attribute";
  381. attributeRow.style.position = "relative";
  382.  
  383. const minusButton = document.createElement("button");
  384. minusButton.style.padding = "0 5px";
  385. minusButton.style.border = "1px solid black";
  386. minusButton.style.borderTopLeftRadius = "50px";
  387. minusButton.style.borderBottomLeftRadius = "50px";
  388. minusButton.style.borderTopRightRadius = "0";
  389. minusButton.style.borderBottomRightRadius = "0";
  390. minusButton.style.width = "32px";
  391. minusButton.style.height = "32px";
  392. minusButton.textContent = "-";
  393. minusButton.onclick = () => {
  394. const coloredSquares = Array.from(attributeRow.children).filter(child => child !== plusButton && child.style.backgroundColor === attribute.color);
  395. if (coloredSquares.length > 0 && totalPoints < 33) {
  396. const square = coloredSquares[coloredSquares.length - 1];
  397. square.style.backgroundColor = "gray";
  398. square.style.border = "0";
  399. totalPoints++;
  400. pointsCounter.textContent = `Points: ${totalPoints}`;
  401. code = code.slice(0, -1);
  402. codeString.textContent = `Code: ${code}`;
  403. }
  404. };
  405. attributeRow.appendChild(minusButton);
  406.  
  407. for (let i = 0; i < 7; i++) {
  408. const colorDiv = document.createElement("div");
  409. colorDiv.style.border = "0";
  410. colorDiv.style.backgroundColor = "gray";
  411. colorDiv.style.width = "30px";
  412. colorDiv.style.height = "30px";
  413. colorDiv.style.display = "inline-block";
  414. colorDiv.style.position = "relative";
  415. colorDiv.style.padding = "0 5px";
  416.  
  417. if (i === 3) {
  418. const textSpan = document.createElement("span");
  419. textSpan.textContent = attribute.name;
  420. textSpan.style.position = "absolute";
  421. textSpan.style.top = "50%";
  422. textSpan.style.left = "50%";
  423. textSpan.style.transform = "translate(-50%, -50%)";
  424. textSpan.style.color = "white";
  425. textSpan.style.pointerEvents = "none";
  426. textSpan.style.whiteSpace = "nowrap";
  427. textSpan.style.zIndex = "1";
  428. textSpan.style.display = "inline-block";
  429. textSpan.style.textShadow =
  430. "1px 1px 1px black, -1px -1px 1px black, -1px 1px 1px black, 1px -1px 1px black";
  431.  
  432. colorDiv.appendChild(textSpan);
  433. }
  434.  
  435. attributeRow.appendChild(colorDiv);
  436. }
  437.  
  438. const plusButton = document.createElement("button");
  439. plusButton.style.padding = "0 5px";
  440. plusButton.style.border = "1px solid black";
  441. plusButton.style.borderTopLeftRadius = "0";
  442. plusButton.style.borderBottomLeftRadius = "0";
  443. plusButton.style.borderTopRightRadius = "50px";
  444. plusButton.style.borderBottomRightRadius = "50px";
  445. plusButton.style.width = "32px";
  446. plusButton.style.height = "32px";
  447. plusButton.style.color = "Black";
  448. plusButton.style.fontWeight = "bold";
  449. plusButton.textContent = "+";
  450. plusButton.style.backgroundColor = attribute.color;
  451.  
  452. plusButton.onclick = () => {
  453. const graySquares = Array.from(attributeRow.children).filter(child => child.style.backgroundColor === "gray" && child !== plusButton);
  454. if (graySquares.length > 0 && totalPoints > 0) {
  455. const square = graySquares[0];
  456. square.style.backgroundColor = attribute.color;
  457. square.style.border = "1px solid black";
  458. totalPoints--;
  459. pointsCounter.textContent = `Points: ${totalPoints}`;
  460. code += (index + 1).toString();
  461. codeString.textContent = `Code: ${code}`;
  462. }
  463. };
  464. attributeRow.appendChild(plusButton);
  465.  
  466. popup.appendChild(attributeRow);
  467. });
  468.  
  469. const createBuildButton = document.createElement("button");
  470. createBuildButton.id = "createBuildButton";
  471. createBuildButton.textContent = "Create Build";
  472. createBuildButton.onclick = () => {
  473. const buildName = buildNameInput.value.trim();
  474. if (buildName === "") {
  475. alert("Please enter a build name.");
  476. return;
  477. }
  478.  
  479. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  480. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  481. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  482.  
  483. const buttonContainer = document.createElement("div");
  484. buttonContainer.style.display = "flex";
  485. buttonContainer.style.alignItems = "center";
  486. buttonContainer.style.justifyContent = "center";
  487.  
  488. const removeButton = document.createElement("button");
  489. removeButton.className = "remove-button";
  490. removeButton.textContent = "[-]";
  491. removeButton.onclick = () => {
  492. buttonContainer.remove();
  493. const updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  494. let newSavedButtons = updatedButtons.filter(b => b.name !== buildName);
  495. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  496.  
  497. let updatedRemovedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  498. updatedRemovedDefaults = updatedRemovedDefaults.filter(b => b !== buildName);
  499. localStorage.setItem("removedDefaults", JSON.stringify(updatedRemovedDefaults));
  500. };
  501. buttonContainer.appendChild(removeButton);
  502.  
  503. const newButton = document.createElement("button");
  504. newButton.className = "button";
  505. newButton.textContent = buildName;
  506. newButton.style.backgroundColor = "#C0C0C0";
  507. newButton.onclick = () => {
  508. const spawnName = userInput.value.trim();
  509. window.input.execute(`game_spawn ${spawnName}`);
  510. window.input.execute(`game_stats_build ${code}`);
  511. const hoverMenu = document.getElementById("myhover");
  512. if (hoverMenu) {
  513. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  514. }
  515. };
  516. buttonContainer.appendChild(newButton);
  517.  
  518. buildButtonsContainer.appendChild(buttonContainer);
  519.  
  520. document.body.removeChild(popup);
  521. };
  522. popup.appendChild(createBuildButton);
  523.  
  524. document.body.appendChild(popup);
  525. dragElement(document.getElementById("resetPopup"));
  526. };
  527.  
  528. modMenu.appendChild(specialButton);
  529. modMenu.appendChild(topRightButton);
  530. hoverMenu.appendChild(modMenu);
  531. document.body.appendChild(hoverMenu);
  532.  
  533. document.addEventListener("keydown", (event) => {
  534. if (event.key === "r" || event.key === "R") {
  535. const hoverMenu = document.getElementById("myhover");
  536. if (hoverMenu) {
  537. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  538. }
  539. }
  540. });
  541.  
  542. window.onload = () => {
  543. const userInput = document.getElementById("userInput");
  544. const specialButton = document.getElementById("specialButton");
  545. const modMenu = document.getElementById("modtab");
  546. const topRightButton = document.getElementById("topRightButton");
  547.  
  548. const savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  549. const removedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  550.  
  551. const defaultButtons = [
  552. { "name": "L3mon឵", "color": "#FFFFFF", "cmd": "656565656565654848748487484874877" },
  553. { "name": "Factory឵", "color": "#FFFFFF", "cmd": "567456745678567456745678567488888" },
  554. { "name": "OverLord2.0឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456788888" },
  555. { "name": "OverLord឵", "color": "#FFFFFF", "cmd": "555666555566664444444888888822111" },
  556. { "name": "Juggernaut឵", "color": "#FFFFFF", "cmd": "213121312138238238883288327777777" },
  557. { "name": "SmasherPacifist឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654128128128312812812812831281281283" },
  558. { "name": "SmasherAttacker឵", "color": "#FFFFFF", "cmd": "7654765476547654765476547654111823823823823823823823823823823" },
  559. { "name": "SturdyDestroyer឵", "color": "#FFFFFF", "cmd": "456456456456456456456123123123123" },
  560. { "name": "Aggressor឵", "color": "#FFFFFF", "cmd": "456745674567456745674567456722111" },
  561. { "name": "SturdyAggressor឵", "color": "#FFFFFF", "cmd": "567856785678567856785678567822111" },
  562. { "name": "SturdyTriangle឵", "color": "#FFFFFF", "cmd": "567567567567567567567123123123123" },
  563. { "name": "Sniper឵", "color": "#FFFFFF", "cmd": "564456445644564815681568156818188" },
  564. { "name": "Trapper឵", "color": "#FFFFFF", "cmd": "567567485675674856756748567484848" },
  565. { "name": "Semi/Ram/Booster឵", "color": "#FFFFFF", "cmd": "567823567823148148567823567882314" },
  566. { "name": "anti-ram", "color឵": "#FFFFFF", "cmd": "234234562345623456234562345623456" },
  567. { "name": "pentrat/anti-ram឵", "color": "#FFFFFF", "cmd": "345345263452634526345263452634526" },
  568. { "name": "Anni/hybrid឵", "color": "#FFFFFF", "cmd": "456845684568456845678456782345678" },
  569. { "name": "OL/overseer឵", "color": "#FFFFFF", "cmd": "456845684568456845683456782345678" }
  570. ];
  571.  
  572. const allButtons = [...defaultButtons, ...savedButtons.filter(saved => !defaultButtons.some(defaultButton => defaultButton.name === saved.name))];
  573. const finalButtons = allButtons.filter(buttonData => !removedDefaults.includes(buttonData.name));
  574.  
  575. const buildButtonsContainer = document.createElement("div");
  576. buildButtonsContainer.id = "buildButtonsContainer";
  577. buildButtonsContainer.style.maxHeight = "400px";
  578. buildButtonsContainer.style.overflowY = "scroll";
  579. buildButtonsContainer.style.color = "black";
  580. modMenu.insertBefore(buildButtonsContainer, specialButton);
  581.  
  582. function createButton(buttonData) {
  583. const buttonContainer = document.createElement("div");
  584. buttonContainer.style.display = "flex";
  585. buttonContainer.style.alignItems = "center";
  586. buttonContainer.style.justifyContent = "center";
  587.  
  588. const removeButton = document.createElement("button");
  589. removeButton.className = "remove-button";
  590. removeButton.textContent = "[-]";
  591. removeButton.onclick = () => {
  592. buttonContainer.remove();
  593.  
  594. let updatedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  595. let newSavedButtons = updatedButtons.filter(b => b.name !== buttonData.name);
  596. localStorage.setItem("savedButtons", JSON.stringify(newSavedButtons));
  597.  
  598. if (defaultButtons.some(defaultButton => defaultButton.name === buttonData.name)) {
  599. let updatedRemovedDefaults = JSON.parse(localStorage.getItem("removedDefaults")) || [];
  600. if (!updatedRemovedDefaults.includes(buttonData.name)) {
  601. updatedRemovedDefaults.push(buttonData.name);
  602. localStorage.setItem("removedDefaults", JSON.stringify(updatedRemovedDefaults));
  603. }
  604. }
  605. };
  606. buttonContainer.appendChild(removeButton);
  607.  
  608. const button = document.createElement("button");
  609. button.className = "button";
  610. button.textContent = buttonData.name;
  611. button.style.backgroundColor = buttonData.color;
  612. button.onclick = () => {
  613. const spawnName = userInput.value.trim();
  614. window.input.execute(`game_spawn ${spawnName}`);
  615. window.input.execute(`game_stats_build ${buttonData.cmd}`);
  616. const hoverMenu = document.getElementById("myhover");
  617. if (hoverMenu) {
  618. hoverMenu.style.display = hoverMenu.style.display === "none" ? "block" : "none";
  619. }
  620. };
  621. buttonContainer.appendChild(button);
  622.  
  623. buildButtonsContainer.appendChild(buttonContainer);
  624. }
  625.  
  626. finalButtons.forEach(buttonData => createButton(buttonData));
  627.  
  628. const createBuildButton = document.getElementById("createBuildButton");
  629. createBuildButton.onclick = () => {
  630. const buildNameInput = document.getElementById("buildNameInput");
  631. const buildName = buildNameInput.value.trim();
  632. if (buildName === "") {
  633. alert("Please enter a build name.");
  634. return;
  635. }
  636.  
  637. const code = "some_code_here";
  638.  
  639. let savedButtons = JSON.parse(localStorage.getItem("savedButtons")) || [];
  640. savedButtons.push({ name: buildName, color: "#C0C0C0", cmd: code });
  641. localStorage.setItem("savedButtons", JSON.stringify(savedButtons));
  642.  
  643. createButton({ name: buildName, color: "#C0C0C0", cmd: code });
  644.  
  645. const popup = document.getElementById("popup");
  646. document.body.removeChild(popup);
  647. };
  648. };
  649.  
  650. document.getElementById("userInput").addEventListener("input", (event) => {
  651. localStorage.setItem("quickSpawnUsername", event.target.value);
  652. });
  653.  
  654. topRightButton.addEventListener("click", () => {
  655. const resetPopup = document.createElement("div");
  656. resetPopup.className = "popup";
  657.  
  658. const closeButton = document.createElement("button");
  659. closeButton.className = "close-btn";
  660. closeButton.textContent = "X";
  661. closeButton.onclick = () => {
  662. document.body.removeChild(resetPopup);
  663. };
  664. resetPopup.appendChild(closeButton);
  665.  
  666. const confirmationMessage = document.createElement("div");
  667. confirmationMessage.textContent = "Do you really want to reset to default builds?";
  668. confirmationMessage.style.textAlign = "center";
  669. confirmationMessage.style.marginBottom = "20px";
  670. resetPopup.appendChild(confirmationMessage);
  671.  
  672. const buttonsContainer = document.createElement("div");
  673. buttonsContainer.style.display = "flex";
  674. buttonsContainer.style.justifyContent = "space-between";
  675.  
  676. const noButton = document.createElement("button");
  677. noButton.className = "button";
  678. noButton.textContent = "NO";
  679. noButton.onclick = () => {
  680. document.body.removeChild(resetPopup);
  681. };
  682. buttonsContainer.appendChild(noButton);
  683.  
  684. const yesButton = document.createElement("button");
  685. yesButton.className = "button";
  686. yesButton.textContent = "YES";
  687. yesButton.onclick = () => {
  688. localStorage.removeItem("savedButtons");
  689. localStorage.removeItem("removedDefaults");
  690. location.reload();
  691. };
  692. buttonsContainer.appendChild(yesButton);
  693.  
  694. resetPopup.appendChild(buttonsContainer);
  695. document.body.appendChild(resetPopup);
  696. dragElement(document.getElementById("resetPopup"));
  697. });
  698.  
  699. function dragElement(elmnt) {
  700. var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  701. if (document.getElementById(elmnt.id + "Header")) {
  702. document.getElementById(elmnt.id + "Header").onmousedown = dragMouseDown;
  703. } else {
  704. elmnt.onmousedown = dragMouseDown;
  705. }
  706.  
  707. function dragMouseDown(e) {
  708. e = e || window.event;
  709. e.preventDefault();
  710. pos3 = e.clientX;
  711. pos4 = e.clientY;
  712. document.onmouseup = closeDragElement;
  713. document.onmousemove = elementDrag;
  714. }
  715.  
  716. function elementDrag(e) {
  717. e = e || window.event;
  718. e.preventDefault();
  719. pos1 = pos3 - e.clientX;
  720. pos2 = pos4 - e.clientY;
  721. pos3 = e.clientX;
  722. pos4 = e.clientY;
  723. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  724. elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
  725. }
  726.  
  727. function closeDragElement() {
  728. document.onmouseup = null;
  729. document.onmousemove = null;
  730. }
  731. }
  732. })();