mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Always show "Cast..." menu item
This commit is contained in:
@@ -91,8 +91,8 @@ async function initMenus () {
|
||||
|
||||
type MenuId = string | number;
|
||||
|
||||
let menuIdCast: MenuId;
|
||||
let menuIdMediaCast: MenuId;
|
||||
let menuIdMirroringCast: MenuId;
|
||||
let menuIdWhitelist: MenuId;
|
||||
let menuIdWhitelistRecommended: MenuId;
|
||||
|
||||
@@ -101,6 +101,12 @@ async function initMenus () {
|
||||
|
||||
const opts = await options.getAll();
|
||||
|
||||
// Global "Cast..." menu item
|
||||
menuIdCast = await browser.menus.create({
|
||||
contexts: [ "browser_action", "page", "tools_menu" ]
|
||||
, title: _("contextCast")
|
||||
});
|
||||
|
||||
// <video>/<audio> "Cast..." context menu item
|
||||
menuIdMediaCast = await browser.menus.create({
|
||||
contexts: [ "audio", "video" ]
|
||||
@@ -111,16 +117,6 @@ async function initMenus () {
|
||||
: URL_PATTERNS_REMOTE
|
||||
});
|
||||
|
||||
// Screen/Tab mirroring "Cast..." context menu item
|
||||
menuIdMirroringCast = await browser.menus.create({
|
||||
contexts: [ "browser_action", "page", "tools_menu" ]
|
||||
, title: _("contextCast")
|
||||
, visible: opts.mirroringEnabled
|
||||
|
||||
// Mirroring doesn't work from file:// urls
|
||||
, documentUrlPatterns: URL_PATTERNS_REMOTE
|
||||
});
|
||||
|
||||
|
||||
menuIdWhitelist = await browser.menus.create({
|
||||
contexts: [ "browser_action" ]
|
||||
@@ -195,7 +191,7 @@ async function initMenus () {
|
||||
break;
|
||||
}
|
||||
|
||||
case menuIdMirroringCast: {
|
||||
case menuIdCast: {
|
||||
const selection = await ReceiverSelectorManager.getSelection(
|
||||
tab.id, info.frameId);
|
||||
|
||||
@@ -372,12 +368,6 @@ async function initMenus () {
|
||||
const alteredOpts = ev.detail;
|
||||
const newOpts = await options.getAll();
|
||||
|
||||
if (alteredOpts.includes("mirroringEnabled")) {
|
||||
browser.menus.update(menuIdMirroringCast, {
|
||||
visible: newOpts.mirroringEnabled
|
||||
});
|
||||
}
|
||||
|
||||
if (alteredOpts.includes("mediaEnabled")) {
|
||||
browser.menus.update(menuIdMediaCast, {
|
||||
visible: newOpts.mediaEnabled
|
||||
|
||||
Reference in New Issue
Block a user