Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name close-the-menu-bar-with-one-esc-keystroke.uc.js
- // @version 1
- // @description Escキー1回でメニューバーとメニューの両方を閉じる。
- // @include chrome://browser/content/browser.xhtml
- // ==/UserScript==
- (function () {
- "use strict";
- const menubar = document.getElementById("main-menubar");
- menubar.addEventListener("popuphidden", (event) => {
- setTimeout(function () {
- if (!menubar.querySelector("menu[open]")) {
- menubar.dispatchEvent(
- new KeyboardEvent("keydown", {
- altKey: true,
- code: "AltRight",
- key: "Alt",
- keyCode: 18,
- }),
- );
- }
- }, 0);
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement