阅读:2503回复:2
怎么给油猴图标加右键菜单?
为了美观,把油猴的三角去掉了,用下面的脚本,可以给工具栏上的油猴添加右键菜单。
但是我把油猴拖到三道杠面板里面,这个脚本就不灵了。 麻烦看看要怎么改,才能在面板里面也有效? // ==UserScript== // @name fixGMPM // @namespace fixGMPM@zbinlin // @include main // @author zbinlin // @homepage http://www.czcp.co.cc // @version 0.0.1 // ==/UserScript== if (location == "chrome://browser/content/browser.xul") { (function (doc) { var greasemonkeyTBB = doc.getElementById('greasemonkey-tbb'); if (!greasemonkeyTBB) return; var menupopup = greasemonkeyTBB.firstChild; greasemonkeyTBB.addEventListener("click", function (e) { if (e.button == 2) { e.preventDefault(); menupopup.openPopup(this, "after_pointer", 0, 0, false, false); } }, false); //menupopup.setAttribute("id", "greasemonkey-menupopup"); //greasemonkeyTBB.setAttribute("contextmenu", "greasemonkey-menupopup"); })(document); } |
|
1楼#
发布于:2017-01-30 18:18
同求
|
|
|
2楼#
发布于:2017-01-31 11:34
MoveButton脚本也有去掉小箭头把菜单改成右键菜单的功能,测试可行,看62~68行
https://github.com/ywzhaiqi/userChromeJS/blob/master/moveButton/moveButton.uc.js |
|