Firefox 鼠标中键单击打开标签页菜单

Firefox 2022-06-27 180℃ 0 0

卡饭有人求,也不复杂,但是吧我是习惯了中键关闭标签,弹出菜单真难受,不会用这个。

location.href.startsWith('chrome://browser/content/browser.x') && setTimeout(() => {
    eval("gBrowser.tabContainer.__proto__.handleEvent = " + gBrowser.tabContainer.__proto__.handleEvent.toString().replace("handleEvent(aEvent)", "function handleEvent(aEvent)").replace('case "mouseout":', 'case "click":\n          if(event.button === 1) {\n            event.preventDefault();\n            const tab = event.target.closest(".tabbrowser-tab");\n            TabContextMenu.contextTab = tab;\n            document.getElementById("tabContextMenu").openPopup(null, "after_pointer", event.clientX, event.clientY, false, false);\n          }\n          break;\n        case "mouseout":'));
}, 1000);

评论 (0)

Top