mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +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 => {
|
||||
// Only rebuild menus if whitelist menu present
|
||||
// WebExt typings are broken again here, so ugly casting
|
||||
|
||||
Reference in New Issue
Block a user