mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-11 01:59:58 +00:00
Add additional comments
This commit is contained in:
@@ -32,7 +32,6 @@ let menuIdWhitelistRecommended: MenuId;
|
||||
|
||||
const whitelistChildMenuPatterns = new Map<MenuId, string>();
|
||||
|
||||
|
||||
export async function initMenus() {
|
||||
logger.info("init (menus)");
|
||||
|
||||
@@ -90,7 +89,6 @@ browser.menus.onClicked.addListener(async (info, tab) => {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (tab?.id === undefined) {
|
||||
throw logger.error("Menu handler tab ID not found.");
|
||||
}
|
||||
@@ -192,7 +190,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If page URL doesn't exist, we're not on a page and have
|
||||
* nothing to whitelist, so disable the menu and return.
|
||||
@@ -206,7 +203,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const url = new URL(info.pageUrl);
|
||||
const urlHasOrigin = url.origin !== "null";
|
||||
|
||||
@@ -224,13 +220,11 @@ browser.menus.onShown.addListener(async info => {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Enable the whitelist menu
|
||||
browser.menus.update(menuIdWhitelist, {
|
||||
enabled: true
|
||||
});
|
||||
|
||||
|
||||
for (const [ menuId ] of whitelistChildMenuPatterns) {
|
||||
// Clear all page-specific temporary menus
|
||||
if (menuId !== menuIdWhitelistRecommended) {
|
||||
@@ -240,7 +234,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
whitelistChildMenuPatterns.delete(menuId);
|
||||
}
|
||||
|
||||
|
||||
// If there is more than one subdomain, get the base domain
|
||||
const baseDomain = (url.hostname.match(/\./g) || []).length > 1
|
||||
? url.hostname.substring(url.hostname.indexOf(".") + 1)
|
||||
@@ -254,7 +247,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
const patternWildcardSubdomain = `${url.protocol}//*.${baseDomain}/*`;
|
||||
const patternWildcardProtocolAndSubdomain = `*://*.${baseDomain}/*`;
|
||||
|
||||
|
||||
// Update recommended menu item
|
||||
browser.menus.update(menuIdWhitelistRecommended, {
|
||||
title: _("contextAddToWhitelistRecommended", patternRecommended)
|
||||
@@ -274,7 +266,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
whitelistSearchMenuId, patternSearch);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Split URL path into segments and add menu items for each
|
||||
* partial path as the segments are removed.
|
||||
@@ -308,7 +299,6 @@ browser.menus.onShown.addListener(async info => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const wildcardProtocolMenuId = browser.menus.create({
|
||||
title: _("contextAddToWhitelistAdvancedAdd"
|
||||
, patternWildcardProtocol)
|
||||
|
||||
Reference in New Issue
Block a user