Go@d m@Cr0

Toggle Macros with 'L'. Press 'Esc' to open the menu. Macros won't work while chatting or writing in the alliance tribe input.

  1. // ==UserScript==
  2. // @name Go@d m@Cr0
  3. // @author dahlia ingram
  4. // @description Toggle Macros with 'L'. Press 'Esc' to open the menu. Macros won't work while chatting or writing in the alliance tribe input.
  5. // @version 1
  6. // @match *://*.moomoo.io/*
  7. // @namespace https://greasyfork.org/users/1190411
  8. // @icon https://cdn.glitch.com/82ae8945-dcc6-4276-98a9-665381b4cd2b/cursor12.png
  9. // @license MIT
  10. // @grant none
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. var mt = 0;
  16. var mel = null;
  17. var mv = false;
  18. var isd = false;
  19. var ix;
  20. var iy;
  21. var menuElement = null;
  22.  
  23. var hhk = {
  24. 0: 0, //unnequip hat
  25. 51: 0,// Moo Cap
  26. 50: 0, // Apple Cap
  27. 28: 0, // Moo Head
  28. 29: 0, // Pig Head
  29. 30: 0, // Fluff Head
  30. 36: 0, // Pandou Head
  31. 37: 0, // Bear Head
  32. 38: 0, // Monkey Head
  33. 44: 0, // Polar Head
  34. 35: 0, // Fez Hat
  35. 42: 0, // Enigma Hat
  36. 43: 0, // Blitz Hat
  37. 49: 0, // Bob XIII Hat
  38. 57: 0, // Pumpkin
  39. 8: 0, // Bummle Hat
  40. 2: 0, // Straw Hat
  41. 15: 0, // Winter Cap
  42. 5: 0, // Cowboy Hat
  43. 4: 0, // Ranger Hat
  44. 18: 0, // Explorer Hat
  45. 31: 0, // Flipper Hat
  46. 1: 0, // Marksman Cap
  47. 10: 0, // Bush Gear
  48. 48: 0, // Halo
  49. 6: 0, // Soldier Helmet
  50. 23: 0, // Anti Venom Gear
  51. 13: 0, // Medic Gear
  52. 9: 0, // Miners Helmet
  53. 32: 0, // Musketeer Hat
  54. 7: 0, // Bull Helmet
  55. 22: 0, // Emp Helmet
  56. 12: 0, // Booster Hat
  57. 26: 0, // Barbarian Armor
  58. 21: 0, // Plague Mask
  59. 46: 0, // Bull Mask
  60. 14: 0, // Windmill Hat
  61. 11: 0, // Spike Gear
  62. 53: 0, // Turret Gear
  63. 20: 0, // Samurai Armor
  64. 58: 0, // Dark Knight
  65. 27: 0, // Scavenger Gear
  66. 40: 0, // Tank Gear
  67. 52: 0, // Thief Gear
  68. 55: 0, // Bloodthirster
  69. 56: 0 // Assassin Gear
  70. };
  71.  
  72. function iso() {
  73. return document.activeElement.id.toLowerCase() === 'chatbox';
  74. }
  75.  
  76. function iaia() {
  77. return document.activeElement.id.toLowerCase() === 'allianceinput';
  78. }
  79.  
  80. function shhk() {
  81. return !iso() && !iaia();
  82. }
  83.  
  84. function toggleMacros() {
  85. mt = (mt + 1) % 2;
  86. document.title = mt === 1 ? "𝙷𝚊𝚝𝚜 𝙾𝙽" : "𝙷𝚊𝚝𝚜 𝙾𝙵𝙵";
  87.  
  88. var macroStateElement = document.getElementById("macroState");
  89. macroStateElement.textContent = mt === 1 ? "On" : "Off";
  90.  
  91. if (mt === 1) {
  92. mel = function (e) {
  93. if (shhk()) {
  94. for (var hatId in hhk) {
  95. if (e.keyCode === hhk[hatId]) {
  96. storeEquip(hatId);
  97. break;
  98. }
  99. }
  100. }
  101. };
  102.  
  103. document.addEventListener('keydown', mel);
  104. } else {
  105. document.removeEventListener('keydown', mel);
  106. mel = null;
  107. }
  108. }
  109.  
  110. function toggleMenu() {
  111. var menuElement = document.getElementById('hatMacroMenu');
  112. if (mv) {
  113. menuElement.style.display = 'none';
  114. mv = false;
  115. } else {
  116. menuElement.style.display = 'block';
  117. mv = true;
  118. }
  119. }
  120.  
  121. function dragStart(e) {
  122. isd = true;
  123. ix = e.clientX - menuElement.getBoundingClientRect().left;
  124. iy = e.clientY - menuElement.getBoundingClientRect().top;
  125. }
  126.  
  127. function dragEnd() {
  128. isd = false;
  129. }
  130.  
  131. function drag(e) {
  132. if (!isd) return;
  133. menuElement.style.left = (e.clientX - ix) + 'px';
  134. menuElement.style.top = (e.clientY - iy) + 'px';
  135. }
  136.  
  137. function createMenu() {
  138. menuElement = document.createElement('div');
  139. menuElement.id = 'hatMacroMenu';
  140. menuElement.style.display = 'none';
  141. menuElement.style.background = 'rgba(0, 0, 0, 0.8)';
  142. menuElement.style.fontFamily = 'Hammersmith One, sans-serif';
  143. menuElement.style.position = 'absolute';
  144. menuElement.style.width = '300px';
  145. menuElement.style.height = '250px';
  146. menuElement.style.border = '1.5px solid #000';
  147. menuElement.style.borderRadius = '8px';
  148. menuElement.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 1)';
  149. menuElement.style.top = 'calc(20px + 2vh)';
  150. menuElement.style.right = 'calc(20px + 2vw)';
  151. menuElement.style.zIndex = '9999';
  152. menuElement.style.overflowY = 'auto';
  153. menuElement.style.color = '#fff';
  154. menuElement.style.fontSize = '17px !important';
  155. menuElement.style.boxShadow = '5px 5px 10px rgba(0, 0, 0, 0.4)';
  156. menuElement.style.padding = '18px';
  157. document.body.appendChild(menuElement);
  158.  
  159. var hti = {
  160. 0: "No Hat",
  161. 51: "Moo Cap",
  162. 50: "Apple Cap",
  163. 28: "Moo Head",
  164. 29: "Pig Head",
  165. 30: "Fluff Head",
  166. 36: "Pandou Head",
  167. 37: "Bear Head",
  168. 38: "Monkey Head",
  169. 44: "Polar Head",
  170. 35: "Fez Hat",
  171. 42: "Enigma Hat",
  172. 43: "Blitz Hat",
  173. 49: "Bob XIII Hat",
  174. 57: "Pumpkin",
  175. 8: "Bummle Hat",
  176. 2: "Straw Hat",
  177. 15: "Winter Cap",
  178. 5: "Cowboy Hat",
  179. 4: "Ranger Hat",
  180. 18: "Explorer Hat",
  181. 31: "Flipper Hat",
  182. 1: "Marksman Cap",
  183. 10: "Bush Gear",
  184. 48: "Halo",
  185. 6: "Soldier Helmet",
  186. 23: "Anti Venom Gear",
  187. 13: "Medic Gear",
  188. 9: "Miners Helmet",
  189. 32: "Musketeer Hat",
  190. 7: "Bull Helmet",
  191. 22: "Emp Helmet",
  192. 12: "Booster Hat",
  193. 26: "Barbarian Armor",
  194. 21: "Plague Mask",
  195. 46: "Bull Mask",
  196. 14: "Windmill Hat",
  197. 11: "Spike Gear",
  198. 53: "Turret Gear",
  199. 20: "Samurai Armor",
  200. 58: "Dark Knight",
  201. 27: "Scavenger Gear",
  202. 40: "Tank Gear",
  203. 52: "Thief Gear",
  204. 55: "Bloodthirster",
  205. 56: "Assassin Gear"
  206. };
  207.  
  208. var ohti = {
  209. 0: "No Hat",
  210. 51: "Moo Cap",
  211. 50: "Apple Cap",
  212. 28: "Moo Head",
  213. 29: "Pig Head",
  214. 30: "Fluff Head",
  215. 36: "Pandou Head",
  216. 37: "Bear Head",
  217. 38: "Monkey Head",
  218. 44: "Polar Head",
  219. 35: "Fez Hat",
  220. 42: "Enigma Hat",
  221. 43: "Blitz Hat",
  222. 49: "Bob XIII Hat",
  223. 57: "Pumpkin",
  224. 8: "Bummle Hat",
  225. 2: "Straw Hat",
  226. 15: "Winter Cap",
  227. 5: "Cowboy Hat",
  228. 4: "Ranger Hat",
  229. 18: "Explorer Hat",
  230. 31: "Flipper Hat",
  231. 1: "Marksman Cap",
  232. 10: "Bush Gear",
  233. 48: "Halo",
  234. 6: "Soldier Helmet",
  235. 23: "Anti Venom Gear",
  236. 13: "Medic Gear",
  237. 9: "Miners Helmet",
  238. 32: "Musketeer Hat",
  239. 7: "Bull Helmet",
  240. 22: "Emp Helmet",
  241. 12: "Booster Hat",
  242. 26: "Barbarian Armor",
  243. 21: "Plague Mask",
  244. 46: "Bull Mask",
  245. 14: "Windmill Hat",
  246. 11: "Spike Gear",
  247. 53: "Turret Gear",
  248. 20: "Samurai Armor",
  249. 58: "Dark Knight",
  250. 27: "Scavenger Gear",
  251. 40: "Tank Gear",
  252. 52: "Thief Gear",
  253. 55: "Bloodthirster",
  254. 56: "Assassin Gear"
  255. };
  256.  
  257. var predefinedKeycodes = {
  258. "No Hat": 16,
  259. "Bull Helmet": 82,
  260. "Tank Gear": 90,
  261. "Soldier Helmet": 71,
  262. "Booster Hat": 66,
  263. "Flipper Hat": 89,
  264. "Winter Cap": 78,
  265. "Emp Helmet": 74,
  266. "Fluff Head": 73,
  267. "Turret Gear": 84,
  268. "Barbarian Armor": 77,
  269. "Samurai Armor": 85,
  270. "Spike Gear": 72
  271. };
  272.  
  273. for (var hatId in hti) {
  274. var input = hti[hatId];
  275. var keycode = predefinedKeycodes[input];
  276. hhk[hatId] = keycode;
  277. }
  278.  
  279. var tableHTML = `
  280. <h1 style="font-size: 28px !important; margin-top: 15px; text-align: center;">Hat Shortcuts <span id="macroState"">Off</span></h1>
  281. <hr>
  282. <table style="margin: 0 auto; text-align: center;">
  283. <tr>
  284. <td><b>Hats</b></td>
  285. <td></td>
  286. <td><b>Keycodes</b></td>
  287. </tr>`;
  288.  
  289. var ukwii = {
  290. 51: "https://static.wikia.nocookie.net/moom/images/a/ac/Hat_51.png",
  291. 50: "https://static.wikia.nocookie.net/moom/images/2/2e/Hat_50.png",
  292. 28: "https://static.wikia.nocookie.net/moom/images/5/58/Hat_28.png",
  293. 29: "https://static.wikia.nocookie.net/moom/images/0/0d/Hat_29.png",
  294. 30: "https://static.wikia.nocookie.net/moom/images/4/49/Hat_30.png",
  295. 36: "https://static.wikia.nocookie.net/moom/images/4/4e/Hat_36.png",
  296. 37: "https://static.wikia.nocookie.net/moom/images/b/bf/Hat_37.png",
  297. 38: "https://static.wikia.nocookie.net/moom/images/b/b6/Hat_38.png",
  298. 44: "https://static.wikia.nocookie.net/moom/images/2/21/Hat_44.png",
  299. 35: "https://static.wikia.nocookie.net/moom/images/d/df/Hat_35.png",
  300. 42: "https://static.wikia.nocookie.net/moom/images/9/90/Hat_42.png",
  301. 43: "https://static.wikia.nocookie.net/moom/images/f/fb/Hat_43.png",
  302. 49: "https://static.wikia.nocookie.net/moom/images/b/b7/Hat_49.png",
  303. 57: "https://static.wikia.nocookie.net/moom/images/7/7c/Hat_57.png",
  304. 8: "https://static.wikia.nocookie.net/moom/images/e/e9/Hat_8.png",
  305. 2: "https://static.wikia.nocookie.net/moom/images/9/9b/Hat_2.png",
  306. 15: "https://static.wikia.nocookie.net/moom/images/6/66/Hat_15.png",
  307. 5: "https://static.wikia.nocookie.net/moom/images/5/51/Hat_5.png",
  308. 4: "https://static.wikia.nocookie.net/moom/images/e/e8/Hat_4.png",
  309. 18: "https://static.wikia.nocookie.net/moom/images/a/ad/Hat_18.png",
  310. 31: "https://static.wikia.nocookie.net/moom/images/4/43/Hat_31.png",
  311. 1: "https://static.wikia.nocookie.net/moom/images/b/b1/Hat_1.png",
  312. 10: "https://static.wikia.nocookie.net/moom/images/9/90/Hat_10.png",
  313. 48: "https://static.wikia.nocookie.net/moom/images/d/d4/Hat_48.png",
  314. 6: "https://static.wikia.nocookie.net/moom/images/3/3f/Hat_6.png",
  315. 23: "https://static.wikia.nocookie.net/moom/images/b/b1/Hat_23.png",
  316. 13: "https://static.wikia.nocookie.net/moom/images/b/b0/Hat_13.png",
  317. 9: "https://static.wikia.nocookie.net/moom/images/e/eb/Hat_9.png",
  318. 32: "https://static.wikia.nocookie.net/moom/images/4/45/Hat_32.png",
  319. 7: "https://static.wikia.nocookie.net/moom/images/f/f9/Hat_7.png",
  320. 22: "https://static.wikia.nocookie.net/moom/images/f/fd/Hat_22.png",
  321. 12: "https://static.wikia.nocookie.net/moom/images/3/31/Hat_12.png",
  322. 26: "https://static.wikia.nocookie.net/moom/images/1/11/Hat_26.png",
  323. 21: "https://static.wikia.nocookie.net/moom/images/c/c6/Hat_21.png",
  324. 46: "https://static.wikia.nocookie.net/moom/images/3/3f/Hat_46.png",
  325. 14: "https://static.wikia.nocookie.net/moom/images/4/42/Hat_14_P.png",
  326. 11: "https://static.wikia.nocookie.net/moom/images/a/a3/Hat_11_P.png",
  327. 53: "https://static.wikia.nocookie.net/moom/images/e/e8/Hat_53_P.png",
  328. 20: "https://static.wikia.nocookie.net/moom/images/2/2a/Hat_20.png",
  329. 58: "https://static.wikia.nocookie.net/moom/images/d/da/Hat_58.png",
  330. 27: "https://static.wikia.nocookie.net/moom/images/8/88/Hat_27.png",
  331. 40: "https://static.wikia.nocookie.net/moom/images/0/08/Hat_40.png",
  332. 52: "https://static.wikia.nocookie.net/moom/images/9/9b/Hat_52.png",
  333. 55: "https://static.wikia.nocookie.net/moom/images/0/0d/Hat_55.png",
  334. 56: "https://static.wikia.nocookie.net/moom/images/5/53/Hat_56.png"
  335. };
  336.  
  337. for (hatId in hti) {
  338. input = hti[hatId];
  339. keycode = hhk[hatId];
  340. var imagePath = ukwii[hatId];
  341.  
  342. if (keycode === undefined) {
  343. keycode = "";
  344. }
  345.  
  346. if (hatId === "0") {
  347. tableHTML += `
  348. <tr>
  349. <td>${input}</td>
  350. <td></td>
  351. <td>
  352. <input type="text" id="${input}Key" value="${keycode}" maxlength="3" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 3em;">
  353. <span id="${input}KeyLabel" style="color: gray;"></span>
  354. </td>
  355. </tr>`;
  356. } else {
  357.  
  358. var imageWidth = "35px";
  359. var imageHeight = "35px";
  360.  
  361. tableHTML += `
  362. <tr>
  363. <td>${input}</td>
  364. <td><img src="${ukwii[hatId]}" alt="${input}" style="width: ${imageWidth}; height: ${imageHeight};"></td>
  365. <td>
  366. <input type="text" id="${input}Key" value="${keycode}" maxlength="3" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 3em;">
  367. <span id="${input}KeyLabel" style="color: gray;"></span>
  368. </td>
  369. </tr>`;
  370. }
  371. }
  372.  
  373. tableHTML += `
  374. </tr>
  375. </table>
  376. <hr>
  377. <div style="text-align: center; margin-top: 20px;">
  378. <button id="Save">Save</button>
  379. </div>`;
  380.  
  381. menuElement.innerHTML = tableHTML;
  382.  
  383. function saveHotkeys() {
  384. var savedHotkeys = {};
  385.  
  386. for (var hatId in hhk) {
  387. var inputField = document.getElementById(`${hti[hatId]}Key`);
  388. var nkc = parseInt(inputField.value);
  389. savedHotkeys[hatId] = nkc;
  390. }
  391.  
  392. localStorage.setItem('hhk', JSON.stringify(savedHotkeys));
  393. }
  394.  
  395. function loadHotkeys() {
  396. var savedHotkeysStr = localStorage.getItem('hhk');
  397. if (savedHotkeysStr) {
  398. var savedHotkeys = JSON.parse(savedHotkeysStr);
  399.  
  400. for (var hatId in savedHotkeys) {
  401. hhk[hatId] = savedHotkeys[hatId];
  402. var inputField = document.getElementById(`${hti[hatId]}Key`);
  403. inputField.value = savedHotkeys[hatId];
  404. }
  405. }
  406. }
  407.  
  408. document.getElementById("Save").addEventListener("click", function () {
  409. for (var hatId in ohti) {
  410. var input = ohti[hatId];
  411. var nkc = parseInt(document.getElementById(`${input}Key`).value);
  412. hhk[hatId] = nkc;
  413. var keyLabel = document.getElementById(`${input}KeyLabel`);
  414. keyLabel.textContent = keyCodeToLabel(nkc);
  415. keyLabel.style.color = '#909090';
  416.  
  417. var macroStateElement = document.getElementById("macroState");
  418. macroStateElement.style.fontSize = "28px";
  419. }
  420. saveHotkeys();
  421. });
  422.  
  423. loadHotkeys();
  424.  
  425. function keyCodeToLabel(keyCode) {
  426. var label = '';
  427. switch (keyCode) {
  428. case 3:
  429. label = 'Cancel';
  430. break;
  431. case 8:
  432. label = 'Backspace';
  433. break;
  434. case 9:
  435. label = 'Tab';
  436. break;
  437. case 12:
  438. label = 'Clear';
  439. break;
  440. case 13:
  441. label = 'Enter';
  442. break;
  443. case 16:
  444. case 160:
  445. label = 'Shift';
  446. break;
  447. case 17:
  448. case 161:
  449. label = 'Control';
  450. break;
  451. case 18:
  452. case 162:
  453. label = 'Alt';
  454. break;
  455. case 19:
  456. label = 'Pause';
  457. break;
  458. case 20:
  459. label = 'Caps Lock';
  460. break;
  461. case 21:
  462. label = 'Unidentified';
  463. break;
  464. case 25:
  465. label = 'Unidentified';
  466. break;
  467. case 27:
  468. label = 'Escape';
  469. break;
  470. case 28:
  471. label = 'Henkan';
  472. break;
  473. case 29:
  474. label = 'Muhenkan';
  475. break;
  476. case 32:
  477. label = '(blank space)';
  478. break;
  479. case 33:
  480. label = 'PageUp';
  481. break;
  482. case 34:
  483. label = 'PageDown';
  484. break;
  485. case 35:
  486. label = 'End';
  487. break;
  488. case 36:
  489. label = 'Home';
  490. break;
  491. case 37:
  492. label = 'ArrowLeft';
  493. break;
  494. case 38:
  495. label = 'ArrowUp';
  496. break;
  497. case 39:
  498. label = 'ArrowRight';
  499. break;
  500. case 40:
  501. label = 'ArrowDown';
  502. break;
  503. case 41:
  504. label = 'Select';
  505. break;
  506. case 42:
  507. label = 'Print';
  508. break;
  509. case 43:
  510. label = 'Execute';
  511. break;
  512. case 44:
  513. label = 'F13';
  514. break;
  515. case 45:
  516. label = 'Insert';
  517. break;
  518. case 46:
  519. label = 'Delete';
  520. break;
  521. case 47:
  522. label = 'Help';
  523. break;
  524. case 48:
  525. label = '0';
  526. break;
  527. case 49:
  528. label = '1';
  529. break;
  530. case 50:
  531. label = '2';
  532. break;
  533. case 51:
  534. label = '3';
  535. break;
  536. case 52:
  537. label = '4';
  538. break;
  539. case 53:
  540. label = '5';
  541. break;
  542. case 54:
  543. label = '6';
  544. break;
  545. case 55:
  546. label = '7';
  547. break;
  548. case 56:
  549. label = '8';
  550. break;
  551. case 57:
  552. label = '9';
  553. break;
  554. case 58:
  555. label = ':';
  556. break;
  557. case 59:
  558. label = ';';
  559. break;
  560. case 60:
  561. label = '<';
  562. break;
  563. case 61:
  564. label = '=';
  565. break;
  566. case 63:
  567. label = 'ß';
  568. break;
  569. case 64:
  570. label = '@';
  571. break;
  572. case 65:
  573. label = 'a';
  574. break;
  575. case 66:
  576. label = 'b';
  577. break;
  578. case 67:
  579. label = 'c';
  580. break;
  581. case 68:
  582. label = 'd';
  583. break;
  584. case 69:
  585. label = 'e';
  586. break;
  587. case 70:
  588. label = 'f';
  589. break;
  590. case 71:
  591. label = 'g';
  592. break;
  593. case 72:
  594. label = 'h';
  595. break;
  596. case 73:
  597. label = 'i';
  598. break;
  599. case 74:
  600. label = 'j';
  601. break;
  602. case 75:
  603. label = 'k';
  604. break;
  605. case 76:
  606. label = 'l';
  607. break;
  608. case 77:
  609. label = 'm';
  610. break;
  611. case 78:
  612. label = 'n';
  613. break;
  614. case 79:
  615. label = 'o';
  616. break;
  617. case 80:
  618. label = 'p';
  619. break;
  620. case 81:
  621. label = 'q';
  622. break;
  623. case 82:
  624. label = 'r';
  625. break;
  626. case 83:
  627. label = 's';
  628. break;
  629. case 84:
  630. label = 't';
  631. break;
  632. case 85:
  633. label = 'u';
  634. break;
  635. case 86:
  636. label = 'v';
  637. break;
  638. case 87:
  639. label = 'w';
  640. break;
  641. case 88:
  642. label = 'x';
  643. break;
  644. case 89:
  645. label = 'y';
  646. break;
  647. case 90:
  648. label = 'z';
  649. break;
  650. case 91:
  651. case 224:
  652. label = 'Meta';
  653. break;
  654. case 92:
  655. case 225:
  656. label = 'Meta';
  657. break;
  658. case 93:
  659. label = 'ContextMenu';
  660. break;
  661. case 95:
  662. label = 'Standby';
  663. break;
  664. case 96:
  665. label = '0';
  666. break;
  667. case 97:
  668. label = '1';
  669. break;
  670. case 98:
  671. label = '2';
  672. break;
  673. case 99:
  674. label = '3';
  675. break;
  676. case 100:
  677. label = '4';
  678. break;
  679. case 101:
  680. label = '5';
  681. break;
  682. case 102:
  683. label = '6';
  684. break;
  685. case 103:
  686. label = '7';
  687. break;
  688. case 104:
  689. label = '8';
  690. break;
  691. case 105:
  692. label = '9';
  693. break;
  694. case 106:
  695. label = '*';
  696. break;
  697. case 107:
  698. label = '+';
  699. break;
  700. case 108:
  701. label = ',';
  702. break;
  703. case 109:
  704. label = '-';
  705. break;
  706. case 110:
  707. label = '.';
  708. break;
  709. case 111:
  710. label = '/';
  711. break;
  712. case 112:
  713. label = 'F1';
  714. break;
  715. case 113:
  716. label = 'F2';
  717. break;
  718. case 114:
  719. label = 'F3';
  720. break;
  721. case 115:
  722. label = 'F4';
  723. break;
  724. case 116:
  725. label = 'F5';
  726. break;
  727. case 117:
  728. label = 'F6';
  729. break;
  730. case 118:
  731. label = 'F7';
  732. break;
  733. case 119:
  734. label = 'F8';
  735. break;
  736. case 120:
  737. label = 'F9';
  738. break;
  739. case 121:
  740. label = 'F10';
  741. break;
  742. case 122:
  743. label = 'F11';
  744. break;
  745. case 123:
  746. label = 'F12';
  747. break;
  748. case 124:
  749. label = 'F13';
  750. break;
  751. case 125:
  752. label = 'F14';
  753. break;
  754. case 126:
  755. label = 'F15';
  756. break;
  757. case 127:
  758. label = 'F16';
  759. break;
  760. case 128:
  761. label = 'F17';
  762. break;
  763. case 129:
  764. label = 'F18';
  765. break;
  766. case 130:
  767. label = 'F19';
  768. break;
  769. case 131:
  770. label = 'F20';
  771. break;
  772. case 132:
  773. label = 'F21';
  774. break;
  775. case 133:
  776. label = 'F22';
  777. break;
  778. case 134:
  779. label = 'F23';
  780. break;
  781. case 135:
  782. label = 'F24';
  783. break;
  784. case 136:
  785. label = 'F25';
  786. break;
  787. case 137:
  788. label = 'F26';
  789. break;
  790. case 138:
  791. label = 'F27';
  792. break;
  793. case 139:
  794. label = 'F28';
  795. break;
  796. case 140:
  797. label = 'F29';
  798. break;
  799. case 141:
  800. label = 'F30';
  801. break;
  802. case 142:
  803. label = 'F31';
  804. break;
  805. case 143:
  806. label = 'F32';
  807. break;
  808. case 144:
  809. label = 'NumLock';
  810. break;
  811. case 145:
  812. label = 'ScrollLock';
  813. break;
  814. case 151:
  815. label = 'Airplane Mode';
  816. break;
  817. case 161:
  818. label = 'Volume Mute';
  819. break;
  820. case 162:
  821. label = 'Volume Down';
  822. break;
  823. case 163:
  824. label = 'Volume Up';
  825. break;
  826. case 186:
  827. label = ';';
  828. break;
  829. case 187:
  830. label = '=';
  831. break;
  832. case 188:
  833. label = ',';
  834. break;
  835. case 189:
  836. label = '-';
  837. break;
  838. case 190:
  839. label = '.';
  840. break;
  841. case 191:
  842. label = '/';
  843. break;
  844. case 192:
  845. label = '`';
  846. break;
  847. case 193:
  848. label = '/';
  849. break;
  850. case 219:
  851. label = '[';
  852. break;
  853. case 220:
  854. label = '\\';
  855. break;
  856. case 221:
  857. label = ']';
  858. break;
  859. case 222:
  860. label = "'";
  861. break;
  862. case 223:
  863. label = '`';
  864. break;
  865. case 224:
  866. label = 'Meta';
  867. break;
  868. case 225:
  869. label = 'AltGraph';
  870. break;
  871. case 226:
  872. label = '\\';
  873. break;
  874. case 229:
  875. label = 'Non-conversion';
  876. break;
  877. case 230:
  878. label = 'Alphanumeric';
  879. break;
  880. case 231:
  881. label = 'Hiragana/Katakana';
  882. break;
  883. case 233:
  884. label = 'Zenkaku/Hankaku';
  885. break;
  886. case 234:
  887. label = 'Kanji Mode';
  888. break;
  889. case 240:
  890. label = 'WakeUp';
  891. break;
  892. case 255:
  893. label = 'WakeUp';
  894. break;
  895. default:
  896. label = '';
  897. }
  898. return label;
  899. }
  900.  
  901. menuElement.querySelectorAll('span, td, p').forEach(element => {
  902. element.style.fontSize = '17px';
  903. element.style.color = '#fff';
  904. });
  905.  
  906. menuElement.addEventListener('mousedown', dragStart);
  907. menuElement.addEventListener('mouseup', dragEnd);
  908. menuElement.addEventListener('mousemove', drag);
  909. document.getElementById("Save").click();
  910.  
  911. var Save = document.getElementById("Save");
  912. Save.addEventListener('click', saveHotkeys);
  913. document.getElementById("Save").click();
  914.  
  915. }
  916.  
  917. createMenu();
  918.  
  919. function saveHotkeys() {
  920. for (var hatId in hhk) {
  921. var inputField = document.getElementById("hat" + hatId + "Key");
  922. var nkc = parseInt(inputField.value);
  923. hhk[hatId] = nkc;
  924.  
  925. document.removeEventListener('keydown', function (e) {
  926. if (e.keyCode === nkc) {
  927. storeEquip(hatId);
  928. }
  929. });
  930.  
  931. document.addEventListener('keydown', function (e) {
  932. if (e.keyCode === nkc && shhk()) {
  933. storeEquip(hatId);
  934. }
  935. });
  936. }
  937. }
  938.  
  939. document.addEventListener('keydown', function (e) {
  940. if (e.keyCode === 76 && !iso() && !iaia()) {
  941. toggleMacros();
  942. } else if (e.keyCode === 27 && shhk() && storeMenu.style.display !== 'block') {
  943. toggleMenu();
  944. }
  945. });
  946.  
  947. var headerText = document.querySelector('h1').textContent;
  948. var macrosEnabled = headerText.includes('Macros On');
  949.  
  950. if (macrosEnabled) {
  951. toggleMacros();
  952. }
  953. })();