mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 10:39:57 +00:00
Hide cast and browser default menu items in extension pages
This commit is contained in:
@@ -226,6 +226,22 @@ async function initMenus () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide cast item on extension pages
|
||||||
|
browser.menus.onShown.addListener(info => {
|
||||||
|
if (info.pageUrl?.startsWith(browser.runtime.getURL(""))) {
|
||||||
|
browser.menus.update(menuIdCast, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.menus.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
browser.menus.onHidden.addListener(() => {
|
||||||
|
browser.menus.update(menuIdCast, {
|
||||||
|
visible: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
browser.menus.onShown.addListener(async info => {
|
browser.menus.onShown.addListener(async info => {
|
||||||
// Only rebuild menus if whitelist menu present
|
// Only rebuild menus if whitelist menu present
|
||||||
// WebExt typings are broken again here, so ugly casting
|
// WebExt typings are broken again here, so ugly casting
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
, "permissions": [
|
, "permissions": [
|
||||||
"history"
|
"history"
|
||||||
, "menus"
|
, "menus"
|
||||||
|
, "menus.overrideContext"
|
||||||
, "nativeMessaging"
|
, "nativeMessaging"
|
||||||
, "storage"
|
, "storage"
|
||||||
, "tabs"
|
, "tabs"
|
||||||
|
|||||||
@@ -361,3 +361,9 @@ window.addEventListener("load", () => {
|
|||||||
<PopupApp />
|
<PopupApp />
|
||||||
, document.querySelector("#root"));
|
, document.querySelector("#root"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("contextmenu", () => {
|
||||||
|
browser.menus.overrideContext({
|
||||||
|
showDefaults: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user