LeoShone
小狐狸
小狐狸
  • UID7490
  • 注册日期2005-07-21
  • 最后登录2020-12-13
  • 发帖数61
  • 经验50枚
  • 威望0点
  • 贡献值26点
  • 好评度1点
阅读:2251回复:2

怎么给油猴图标加右键菜单?

楼主#
更多 发布于:2016-11-18 15:45
为了美观,把油猴的三角去掉了,用下面的脚本,可以给工具栏上的油猴添加右键菜单。
但是我把油猴拖到三道杠面板里面,这个脚本就不灵了。
麻烦看看要怎么改,才能在面板里面也有效?


// ==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);
}
游客

返回顶部