diff --git a/src/_locales/en/messages.json.ts b/src/_locales/en/messages.json.ts index 5f1d9095c..190d0b2ba 100644 --- a/src/_locales/en/messages.json.ts +++ b/src/_locales/en/messages.json.ts @@ -28,6 +28,9 @@ export default exportAsMessages({ // The text of an OK button. okButton: "OK", + // The text that represents the user's own personal blocklist. + personalBlocklist: "Personal Blocklist", + // The text that means one site has been blocked. content_singleSiteBlocked: "uBlacklist has blocked 1 site", @@ -89,6 +92,18 @@ export default exportAsMessages({ // The text of the button to activate this extension. popup_activateButton: "Activate", + // The title of the disclosure widget that contains the matching rules information. + popup_matchingRules: "Matching Rules", + + // The label for the textarea that shows rules blocking the entry. + popup_blockingRulesLabel: "Rules blocking this entry", + + // The label for the textarea that shows rules unblocking the entry. + popup_unblockingRulesLabel: "Rules unblocking this entry", + + // The label for the textarea that shows rules highlighting the entry. + popup_highlightingRulesLabel: "Rules highlighting this entry", + // The title of the general section. options_generalTitle: "General", diff --git a/src/_locales/pt_BR/messages.json.ts b/src/_locales/pt_BR/messages.json.ts index dedca9949..9d7445376 100644 --- a/src/_locales/pt_BR/messages.json.ts +++ b/src/_locales/pt_BR/messages.json.ts @@ -11,6 +11,7 @@ export default exportAsMessages({ "Não autorizado. Por favor, desligue a sincronização e ligue novamente.", cancelButton: "Cancelar", okButton: "OK", + personalBlocklist: "Lista de Bloqueio Pessoal", content_singleSiteBlocked: "uBlacklist bloqueou 1 site", content_multipleSitesBlocked: "uBlacklist bloqueou $1 sites", content_showBlockedSitesLink: "Mostrar", @@ -31,6 +32,10 @@ export default exportAsMessages({ popup_active: "uBlacklist está ativo", popup_inactive: "uBlacklist está inativo", popup_activateButton: "Ativar", + popup_matchingRules: "Regras em efeito", + popup_blockingRulesLabel: "Regras bloqueando este resultado", + popup_unblockingRulesLabel: "Regras desbloqueando este resultado", + popup_highlightingRulesLabel: "Regras destacando este resultado", options_generalTitle: "Geral", options_blacklistLabel: "Sites bloqueados de aparecer nos resultados de busca do Google", diff --git a/src/common/locales.ts b/src/common/locales.ts index fc588ebc2..442dd8d5a 100644 --- a/src/common/locales.ts +++ b/src/common/locales.ts @@ -7,6 +7,7 @@ export type MessageName = | "unauthorizedError" | "cancelButton" | "okButton" + | "personalBlocklist" | "content_singleSiteBlocked" | "content_multipleSitesBlocked" | "content_showBlockedSitesLink" @@ -27,6 +28,10 @@ export type MessageName = | "popup_active" | "popup_inactive" | "popup_activateButton" + | "popup_matchingRules" + | "popup_blockingRulesLabel" + | "popup_unblockingRulesLabel" + | "popup_highlightingRulesLabel" | "options_generalTitle" | "options_blacklistLabel" | "options_blacklistHelper" diff --git a/src/scripts/block-dialog.tsx b/src/scripts/block-dialog.tsx index 8715bd1da..2f61ec6d5 100644 --- a/src/scripts/block-dialog.tsx +++ b/src/scripts/block-dialog.tsx @@ -30,8 +30,8 @@ import type { InteractiveRuleset } from "./interactive-ruleset.ts"; import { translate } from "./locales.ts"; import { PathDepth } from "./path-depth.ts"; import type { LinkProps } from "./ruleset/ruleset.ts"; -import type { DialogTheme } from "./types.ts"; -import { makeAltURL, svgToDataURL } from "./utilities.ts"; +import type { DialogTheme, MatchingRulesText } from "./types.ts"; +import { getMatchingRulesText, makeAltURL, svgToDataURL } from "./utilities.ts"; type BlockDialogContentProps = { blockWholeSite: boolean; @@ -59,6 +59,8 @@ const BlockDialogContent: React.FC = ({ unblock: false, host: "", detailsOpen: false, + matchingRulesOpen: false, + matchingRulesText: null as MatchingRulesText | null, pathDepth: null as PathDepth | null, depth: "", rulesToAdd: "", @@ -76,6 +78,8 @@ const BlockDialogContent: React.FC = ({ blockWholeSite ? tldts.getDomain(url.host) ?? url.host : url.host, ); state.detailsOpen = false; + state.matchingRulesOpen = false; + state.matchingRulesText = null; state.pathDepth = enablePathDepth ? new PathDepth(url) : null; state.depth = "0"; state.rulesToAdd = patch.rulesToAdd; @@ -86,6 +90,8 @@ const BlockDialogContent: React.FC = ({ state.unblock = false; state.host = entryProps.url; state.detailsOpen = false; + state.matchingRulesOpen = false; + state.matchingRulesText = null; state.pathDepth = null; state.depth = ""; state.rulesToAdd = ""; @@ -269,6 +275,89 @@ const BlockDialogContent: React.FC = ({ +
{ + const { open } = e.currentTarget; + const matchingRulesText = open + ? getMatchingRulesText(ruleset, entryProps) + : null; + setState((s) => ({ + ...s, + matchingRulesOpen: open, + matchingRulesText, + })); + }} + > + + {translate("popup_matchingRules")} + + + + + + + {translate("popup_blockingRulesLabel")} + + + {state.matchingRulesOpen && ( +