fire/fox
火狐狸
火狐狸
  • UID32624
  • 注册日期2010-04-21
  • 最后登录2024-02-02
  • 发帖数172
  • 经验169枚
  • 威望0点
  • 贡献值182点
  • 好评度9点
  • 社区居民
  • 忠实会员
阅读:5629回复:3

[已解决]请问右键菜单的图标能不能添加或者替换?

楼主#
更多 发布于:2021-12-03 17:53
想加个主页图标,或者把添加书签换成主页
edit_check
小狐狸
小狐狸
  • UID57451
  • 注册日期2020-02-02
  • 最后登录2022-10-22
  • 发帖数3
  • 经验3枚
  • 威望0点
  • 贡献值0点
  • 好评度2点
1楼#
发布于:2021-12-07 17:24
// ==UserScript==
// @name            HomeToContext
// @version            1.12.7
// @charset            UTF-8
// @include            chrome://browser/content/browser.xhtml
// ==/UserScript==
    
var HomeToContext = {
    init: function() {
        let ContextMenu = document.getElementById('context-navigation');
        if(!ContextMenu) return;
        //Añado
        let HomeContext = document.createXULElement('menuitem');
        HomeContext.setAttribute('id', 'context-homebutton');
        HomeContext.setAttribute('accesskey', 'H');
        HomeContext.setAttribute('aria-label', 'Home Page');
        HomeContext.setAttribute('tooltiptext', 'Go to Home');
        HomeContext.setAttribute('oncommand', 'BrowserHome(event);');
        HomeContext.setAttribute('class', 'menuitem-iconic');
        HomeContext.setAttribute('style', 'list-style-image: url(chrome://browser/skin/home.svg)');
        ContextMenu.appendChild(HomeContext);
        //Remuevo
        let MenuArea = document.getElementById('contentAreaContextMenu');
        let BookmarkPage = document.getElementById('context-bookmarkpage');
        MenuArea.addEventListener("popupshowing", ()=>{ BookmarkPage.hidden = true }, false);
    }
}
    
HomeToContext.init();

Need userChromeJS installed.
From: https://github.com/xiaoxiaoflood/firefox-scripts
Or: https://github.com/alice0775/userChrome.js
(i use xiaoxiaoflood)
fire/fox
火狐狸
火狐狸
  • UID32624
  • 注册日期2010-04-21
  • 最后登录2024-02-02
  • 发帖数172
  • 经验169枚
  • 威望0点
  • 贡献值182点
  • 好评度9点
  • 社区居民
  • 忠实会员
2楼#
发布于:2021-12-07 20:58
edit_check:// ==UserScript==
// @name            HomeToContext
// @version            1.12.7
// @charset            UTF-8
// @i...
回到原帖
Thank you! It's very nice.
齿轮key
火狐狸
火狐狸
  • UID57347
  • 注册日期2019-11-14
  • 最后登录2022-10-08
  • 发帖数252
  • 经验81枚
  • 威望0点
  • 贡献值52点
  • 好评度6点
  • 社区居民
  • 忠实会员
3楼#
发布于:2022-02-05 12:01
edit_check:// ==UserScript==
// @name            HomeToContext
// @version            1.12.7
// @charset            UTF-8
// @i...
回到原帖
thx
跑跑原神火狐 & ACGN 的社区:popkart.org
游客

返回顶部