鼠标中键打开右键菜单的ucjs失效了
firefox吧
全部回复
仅看楼主
level 2
AISWFT 楼主
RT,一个辅助右键关闭标签页使用的ucjs
在更新140版本后失效。请问大佬们还有没有抢救的可能[泪]
// ==UserScript==
// @name 中键打开标签菜单
// @Description 方便开启右键关闭标签页后使用中键打开标签菜单
// @license MIT License
// @Compatibility Firefox 90
// @charset UTF-8
// @include chrome://browser/content/browser.xhtml
// @homepageURL https://github.com/benzBrake/FirefoxCustomize/tree/master/userChromeJS
// ==/UserScript==
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);
2025年07月12日 11点07分 1
level 2
AISWFT 楼主
用来辅助这个ucjs的:
//右键关闭标签页,ctrl或Shift+右键打开菜单
gBrowser.tabContainer.addEventListener("click",
function(event) {
if (event.button == 2 && !event.ctrlKey && !event.shiftKey) {
const tab = event.target.closest('.tabbrowser-tab');
if(!tab) return;
gBrowser.removeTab(tab);
gBrowser.removeTab(tab, {animate: true});
event.stopPropagation();
event.preventDefault();
}
},
false);
2025年07月12日 11点07分 2
level 2
AISWFT 楼主
标题说错了,应该是在标签上鼠标中键打开右键菜单
2025年07月12日 11点07分 3
1