阅读:6287回复:3
[已解决]请问右键菜单的图标能不能添加或者替换?
想加个主页图标,或者把添加书签换成主页
|
|
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) |
|
2楼#
发布于:2021-12-07 20:58
edit_check:// ==UserScript==Thank you! It's very nice. |
|
3楼#
发布于:2022-02-05 12:01
edit_check:// ==UserScript==thx |
|
|