MooMoo.io - Toggle Menus

Press "-" to open/close the alliance menu, and press "." to open/close the store menu.

目前為 2023-10-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name         MooMoo.io - Toggle Menus
// @author       Seryo
// @description  Press "-" to open/close the alliance menu, and press "." to open/close the store menu.
// @version      0.1
// @match        *://*.moomoo.io/*
// @namespace    https://gf.qytechs.cn/users/1190411
// @icon         https://cdn.glitch.com/82ae8945-dcc6-4276-98a9-665381b4cd2b/cursor12.png
// @run-at       document-end
// @license      MIT
// @grant        GM_info
// ==/UserScript==


(function () {
  'use strict';

  let allianceMenu = document.getElementById('allianceMenu');
  let storeMenu = document.getElementById('storeMenu');

  document.addEventListener('keydown', function (event) {
    if (shouldHandleMenus(event)) {
      if (event.key === ',') {
        toggleMenu(allianceMenu, storeMenu);
      } else if (event.key === '.') {
        toggleMenu(storeMenu, allianceMenu);
      }
    }
  });

  function shouldHandleMenus(event) {
    const chatboxActive = document.activeElement.id.toLowerCase() === 'chatbox';
    const allianceInputActive = document.activeElement.id.toLowerCase() === 'allianceinput';

    return !chatboxActive && !allianceInputActive;
  }

  function toggleMenu(menu, otherMenu) {
    if (menu.style.display === 'none' || menu.style.display === '') {
      menu.style.display = 'block';
      if (otherMenu.style.display !== 'none') {
        otherMenu.style.display = 'none';
      }
    } else {
      menu.style.display = 'none';
    }
  }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址